How to change DBID in RAC

recently i restore a database from tape to a different host and at the same time i need to rename the database.

the dbid of my new database same from my source database. since we are using tape to backup our database i need to change the DB of our new database.

Note : DB is 2 node cluster.

Disable the cluster parameter and restart the database.

SQL> alter system set  cluster_database=false scope=spfile;

System altered.

SQL> exit

[oracle@ncxxdsgtu21 admin]$ srvctl stop database -d NCXXN2PT

[oracle@ncxxdsgtu21 admin]$ sqlplus '/ as sysdba'

SQL*Plus: Release 11.2.0.4.0 Production on Fri Jan 15 04:42:06 2016

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

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 3.2068E+10 bytes
Fixed Size                  2269072 bytes
Variable Size            5301600368 bytes
Database Buffers         2.6709E+10 bytes
Redo Buffers               55242752 bytes
Database mounted.
SQL> select dbid, name from v$database;

      DBID NAME
---------- ---------
1304770496 NCXXN2PT

SQL> exit

Now perform the NID command.

[oracle@ncxxdsgtu21 admin]$ nid TARGET='/ as sysdba'

DBNEWID: Release 11.2.0.4.0 - Production on Fri Jan 15 04:42:48 2016

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

Password:
Connected to database NCXXN2PT (DBID=1304770496)

Connected to server version 11.2.0

Control Files in database:
    +DATA/ncxx2pt/controlfile/control_01.ctl
    +FRA/ncxx2pt/controlfile/control_02.ctl

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

Proceeding with operation
Changing database ID from 1304770496 to 2223919948
    Control File +DATA/ncxx2pt/controlfile/control_01.ctl - modified
    Control File +FRA/ncxx2pt/controlfile/control_02.ctl - modified
    Datafile +DATA/ncxx2pt/datafile/system.526.90115259 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/sysaux.282.90115031 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/undotbs1.712.90115023 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/undotbs2.449.90115105 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/dbaspace.592.90115240 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/audittbs.658.90115406 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/semsauditdb.527.90115406 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/users.485.90115245 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/patrol_tbsp.484.90115393 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.513.90115031 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.709.90115003 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.672.90115043 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.708.90114986 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.711.90115016 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.707.90114923 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.508.90115040 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.690.90115104 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.525.90115069 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.528.90115173 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/ggs_data.529.90115096 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.314.90114676 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.332.90114690 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.495.90114661 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.469.90114668 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.494.90114663 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/sysaux.498.90114657 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/undotbs1.497.90114661 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/undotbs2.489.90115112 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/opdb_data.480.90115097 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.319.90114680 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.344.90114716 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.727.90114754 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.283.90114764 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/undotbs1.345.90114730 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/undotbs2.519.90115087 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/opdb_data.514.90115181 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/opdb_data.481.90115036 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/opdb_data.510.90115136 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/opdb_data.716.90114747 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/opdb_data.467.90114674 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/opdb_data.723.90114725 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/opdb_data.714.90114755 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/users.725.90115364 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.665.90113938 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/dbaspace.669.90115334 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/undotbs1.551.90114648 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.591.90113938 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.602.90113938 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.659.90113938 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.341.90113938 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.666.90113938 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.646.90113938 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.340.90113938 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.471.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.667.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.679.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.680.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.472.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.692.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.681.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.470.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.475.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.457.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.285.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.316.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.329.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.321.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.458.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.477.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.478.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.575.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.574.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.577.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.641.90113940 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.578.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.570.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.576.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.502.90115213 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.516.90115268 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.612.90115194 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.601.90115406 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.582.90115343 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.522.90115188 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.594.90115355 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.611.90115284 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.609.90115286 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.682.90115278 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.486.90115341 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.315.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.342.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.717.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.719.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.331.90114685 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.493.90114668 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.343.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.722.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.290.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.718.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.720.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.468.90114672 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.496.90114661 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.590.90114604 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.459.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.463.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.464.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.465.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.476.90113941 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.462.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.461.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.460.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.330.90113942 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.466.90114675 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/dbaspace.671.90115396 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/system.490.90115261 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/sysaux.515.90115379 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/sysaux.613.90115066 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/opdb_data.673.90115181 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/ggs_data.589.90114645 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/opdb_data.648.90113940 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.289.90113940 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.649.90113940 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.552.90113940 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_rgn.280.90113940 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.647.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.474.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.473.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/index_tbs.581.90113940 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.501.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.492.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.500.90113939 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.550.90113940 - dbid changed
    Datafile +DATA/ncxx2pt/datafile/data_gbl.511.90113940 - dbid changed
    Datafile +DATA/ncxx2pt/tempfile/temp.491.90116305 - dbid changed
    Datafile +DATA/ncxx2pt/tempfile/temp.509.90116305 - dbid changed
    Datafile +DATA/ncxx2pt/tempfile/temp.505.90116305 - dbid changed
    Datafile +DATA/ncxx2pt/tempfile/temp.482.90116305 - dbid changed
    Datafile +DATA/ncxx2pt/tempfile/temp.504.90116305 - dbid changed
    Control File +DATA/ncxx2pt/controlfile/control_01.ctl - dbid changed
    Control File +FRA/ncxx2pt/controlfile/control_02.ctl - dbid changed
    Instance shut down

Database ID for database NCXXN2PT changed to 2223919948.
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.

Now start the database and open resetlogs.

[oracle@ncxxdsgtu21 admin]$ sqlplus '/ as sysdba'

SQL*Plus: Release 11.2.0.4.0 Production on Fri Jan 15 04:43:45 2016

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

Connected to an idle instance.

SQL> startup mount;
ORACLE instance started.

Total System Global Area 3.2068E+10 bytes
Fixed Size                  2269072 bytes
Variable Size            5301600368 bytes
Database Buffers         2.6709E+10 bytes
Redo Buffers               55242752 bytes
Database mounted.
SQL> alter database open resetlogs;

Database altered.

SQL> select dbid, name from v$database;

      DBID NAME
---------- ---------
2223919948 NCXXN2PT

Enable the cluster parameter and restart the database.

SQL> alter system set  cluster_database=true scope=spfile;

System altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit

Now start the cluster database.

[oracle@ncxxdsgtu21 admin]$ srvctl start database -d NCXXN2PT
[oracle@ncxxdsgtu21 admin]$

[oracle@ncxxdsgtu21 admin]$ srvctl status database -d NCXXN2PT
Instance NCXXN2PT1 is running on node ncxxdsgtu21
Instance NCXXN2PT2 is running on node ncxxdsgtu22
[oracle@ncxxdsgtu21 admin]$

Instance                Host                                Startup              Database                     Shutdown Active
Name / Number  Thread # Name                         Status Time                 Status   Archiver Logins?    Pending? State  Version
------------- --------- ---------------------------- ------ -------------------- -------- -------- ---------- -------- ------ -----------------
NCXXN2PT1 (1)          1 ncxxdsgtu21                  OPEN   15-JAN-2016 04:46:05 ACTIVE   STARTED  ALLOWED    NO       NORMAL 11.2.0.4.0
NCXXN2PT2 (2)          2 ncxxdsgtu22                  OPEN   15-JAN-2016 04:46:06 ACTIVE   STARTED  ALLOWED    NO       NORMAL 11.2.0.4.0

SQL>

Thanks!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s