Thursday, February 22, 2007

Change DBID of database

When cloning a database, the database will get no new DBID. This makes it impossible to backup the database with RMAN as the DBID is no longer unique. A new DBID and optional a new DB_NAME can be created with nid.

Below the steps are detailed to change the DBID:

SQL> connect /as sysdba
Connected.

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

SQL> startup mount
ORACLE instance started.

Total System Global Area 641728512 bytes
Fixed Size 1304432 bytes
Variable Size 437000336 bytes
Database Buffers 201326592 bytes
Redo Buffers 2097152 bytes
Database mounted.

Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining options


bash-3.00$ nid target=/
DBNEWID: Release 10.1.0.5.0 - 64bit Production
Copyright (c) 2001, 2004, Oracle. All rights reserved.

Connected to database PINF1 (DBID=4250054534)

Connected to server version 10.1.0

Control Files in database:
/u03/oradata/PINF1/control01.ctl
/u04/oradata/PINF1/control02.ctl

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

Proceeding with operation
Changing database ID from 4250054534 to 4266449216
Control File /u03/oradata/PINF1/control01.ctl - modified
Control File /u04/oradata/PINF1/control02.ctl - modified
Datafile /u03/oradata/PINF1/system001.dbf - dbid changed
Datafile /u04/oradata/PINF1/undotbs001.dbf - dbid changed
Datafile /u03/oradata/PINF1/sysaux001.dbf - dbid changed
Datafile /u03/oradata/PINF1/users001.dbf - dbid changed
Datafile /u03/oradata/PINF1/portal.dbf - dbid changed
Datafile /u03/oradata/PINF1/ptldoc.dbf - dbid changed
Datafile /u03/oradata/PINF1/ptlidx.dbf - dbid changed
Datafile /u03/oradata/PINF1/ptllog.dbf - dbid changed
Datafile /u03/oradata/PINF1/ias_meta01.dbf - dbid changed
Datafile /u03/oradata/PINF1/discopltm1.dbf - dbid changed
Datafile /u03/oradata/PINF1/discopltc1.dbf - dbid changed
Datafile /u03/oradata/PINF1/dcm.dbf - dbid changed
Datafile /u03/oradata/PINF1/oss_sys01.dbf - dbid changed
Datafile /u03/oradata/PINF1/wcrsys01.dbf - dbid changed
Datafile /u03/oradata/PINF1/ip_rt.dbf - dbid changed
Datafile /u03/oradata/PINF1/ip_dt.dbf - dbid changed
Datafile /u03/oradata/PINF1/ip_idx.dbf - dbid changed
Datafile /u03/oradata/PINF1/ip_lob.dbf - dbid changed
Datafile /u03/oradata/PINF1/oca.dbf - dbid changed
Datafile /u03/oradata/PINF1/uddisys01.dbf - dbid changed
Datafile /u03/oradata/PINF1/attrs1_oid.dbf - dbid changed
Datafile /u03/oradata/PINF1/battrs1_oid.dbf - dbid changed
Datafile /u03/oradata/PINF1/gcats1_oid.dbf - dbid changed
Datafile /u03/oradata/PINF1/gdefault1_oid.dbf - dbid changed
Datafile /u03/oradata/PINF1/svrmg1_oid.dbf - dbid changed
Datafile /u03/oradata/PINF1/temp001.dbf - dbid changed
Control File /u03/oradata/PINF1/control01.ctl - dbid changed
Control File /u04/oradata/PINF1/control02.ctl - dbid changed
Instance shut down

Database ID for database PINF1 changed to 4266449216.
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.

bash-3.00$ sqlplus /nolog

SQL*Plus: Release 10.1.0.5.0 - Production on Thu Feb 22 16:18:13 2007

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

SQL> connect /as sysdba
Connected to an idle instance.

SQL> startup mount ;
ORACLE instance started.

Total System Global Area 641728512 bytes
Fixed Size 1304432 bytes
Variable Size 437000336 bytes
Database Buffers 201326592 bytes
Redo Buffers 2097152 bytes
Database mounted.

SQL> alter database open resetlogs ;

Database altered.


No comments: