Saturday, January 6, 2024

How to change DBID

How to change DBID?

Current DBID 492103932 and new DBID 535155273

1. Query the current DBID

[oracle@oracledb ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Thu Jan 4 05:21:52 2024

Copyright (c) 1982, 2016, Oracle. All rights reserved.

Last Successful login time: Tue Jan 05 2014 23:35:38 -07:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select dbid from v$database;
      DBID
----------
 492103932

SQL>

2. Use nid to change the DBID 

[oracle@oracledb ~]$ nid TARGET=sys/Mallik123

DBNEWID: Release 12.2.0.1.0 - Production on Thu Jan 4 06:22:01 2024

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

Connected to database ORA12C (DBID=492103932)

Connected to server version 12.2.0

Control Files in database:
    /u01/app/oracle/oradata/ORA12C/controlfile/o1_mf_kk22c4gq_.ctl
    /u01/app/oracle/fast_recovery_area/ORA12C/ORA12C/controlfile/o1_mf_kk22c4jf_.ctl

Change database ID of database ORA12C? (Y/[N]) => y

Proceeding with operation
Changing database ID from 492103932 to 535155273
    Control File /u01/app/oracle/oradata/ORA12C/controlfile/o1_mf_kk22c4gq_.ctl - modified
    Control File /u01/app/oracle/fast_recovery_area/ORA12C/ORA12C/controlfile/o1_mf_kk22c4jf_.ctl - modified
    Datafile /u01/app/oracle/oradata/ORA12C/datafile/o1_mf_system_kk227xkb_.db - dbid changed
    Datafile /u01/app/oracle/oradata/ORA12C/datafile/o1_mf_sysaux_kk229c5s_.db - dbid changed
    Datafile /u01/app/oracle/oradata/ORA12C/datafile/o1_mf_undotbs1_kk22b4f5_.db - dbid changed
    Datafile /u01/app/oracle/oradata/ORA12C/datafile/o1_mf_test1_ldnqcqrv_.db - dbid changed
    Datafile /u01/app/oracle/oradata/ORA12C/datafile/o1_mf_users_kk22b5h6_.db - dbid changed
    Datafile /u01/app/oracle/oradata/ORA12C/datafile/o1_mf_temp_kk22ch45_.tm - dbid changed
    Control File /u01/app/oracle/oradata/ORA12C/controlfile/o1_mf_kk22c4gq_.ctl - dbid changed
    Control File /u01/app/oracle/fast_recovery_area/ORA12C/ORA12C/controlfile/o1_mf_kk22c4jf_.ctl - dbid changed
    Instance shut down

Database ID for database ORA12C changed to 535155273.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.

[oracle@oracledb ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Thu Jan 4 06:22:52 2024

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> STARTUP MOUNT
ORACLE instance started.

Total System Global Area 3707764736 bytes
Fixed Size                  8627248 bytes
Variable Size             855641040 bytes
Database Buffers         2835349504 bytes
Redo Buffers                8146944 bytes
Database mounted.
SQL> ALTER DATABASE OPEN RESETLOGS;

Database altered.

SQL> select dbid from v$database;

      DBID
----------
 535155273

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
[oracle@oracledb ~]$

Regards,
Mallik

2 comments:

  1. In nid where did you mention new id?

    ReplyDelete
    Replies
    1. Should this be nid TARGET=sys/Mallik123 dbid=535155273 ? Please confirm.

      Delete

Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...