How to Change the DBID, DBNAME Using NID Utility in version 11gR2 onwards
Source database name is ORCL convert it to TEST
[oracle@oracledb ~]$ export
ORACLE_SID=orcl
[oracle@oracledb ~]$ sqlplus sys as sysdba
SQL>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
[oracle@oracledb ~]$ sqlplus sys as sysdba
SQL>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1345376 bytes
Variable Size 360712352 bytes
Database Buffers 167772160 bytes
Redo Buffers 5832704 bytes
Database mounted.
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1345376 bytes
Variable Size 360712352 bytes
Database Buffers 167772160 bytes
Redo Buffers 5832704 bytes
Database mounted.
SQL> exit;
[oracle@oracledb ~]$ nid
target=sys/*** dbname=TEST
DBNEWID: Release 11.2.0.2.0 - Production on Fri Apr 27 14:40:10 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to database ORCL (DBID=3355521024)
Connected to server version 11.2.0
Control Files in database:
/orcl /dbs/control01.ctl
/orcl /dbs/control02.ctl
/orcl /dbs/control03.ctl
Change database ID and database name ORCL to TEST? (Y/[N]) => Y
DBNEWID: Release 11.2.0.2.0 - Production on Fri Apr 27 14:40:10 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to database ORCL (DBID=3355521024)
Connected to server version 11.2.0
Control Files in database:
/orcl /dbs/control01.ctl
/orcl /dbs/control02.ctl
/orcl /dbs/control03.ctl
Change database ID and database name ORCL to TEST? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 3355521024 to 3803284043
Changing database name from ORCL to TEST
Control File /orcl /dbs/control01.ctl - modified
Control File /orcl /dbs/control02.ctl - modified
Control File /orcl /dbs/control03.ctl - modified
Datafile /orcl /dbs/system01.db - dbid changed, wrote new name
Datafile /orcl /dbs/undotbs01.db - dbid changed, wrote new name
Datafile /orcl /dbs/sysaux01.db - dbid changed, wrote new name
Datafile /orcl /dbs/users01.db - dbid changed, wrote new name
Datafile /orcl /dbs/indx01.db - dbid changed, wrote new name
Datafile /orcl /dbs/tools01.db - dbid changed, wrote new name
Datafile /orcl /dbs/data/ora_data.db - dbid changed, wrote new name
Datafile /orcl /dbs/temp01.db - dbid changed, wrote new name
Control File /orcl /dbs/control01.ctl - dbid changed, wrote new name
Control File /orcl /dbs/control02.ctl - dbid changed, wrote new name
Control File /orcl /dbs/control03.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to TEST.
Changing database ID from 3355521024 to 3803284043
Changing database name from ORCL to TEST
Control File /orcl /dbs/control01.ctl - modified
Control File /orcl /dbs/control02.ctl - modified
Control File /orcl /dbs/control03.ctl - modified
Datafile /orcl /dbs/system01.db - dbid changed, wrote new name
Datafile /orcl /dbs/undotbs01.db - dbid changed, wrote new name
Datafile /orcl /dbs/sysaux01.db - dbid changed, wrote new name
Datafile /orcl /dbs/users01.db - dbid changed, wrote new name
Datafile /orcl /dbs/indx01.db - dbid changed, wrote new name
Datafile /orcl /dbs/tools01.db - dbid changed, wrote new name
Datafile /orcl /dbs/data/ora_data.db - dbid changed, wrote new name
Datafile /orcl /dbs/temp01.db - dbid changed, wrote new name
Control File /orcl /dbs/control01.ctl - dbid changed, wrote new name
Control File /orcl /dbs/control02.ctl - dbid changed, wrote new name
Control File /orcl /dbs/control03.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to TEST.
Modify parameter file and generate
a new password file before restarting.
Database ID for database TEST changed to 3803284043.
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 name and ID.
DBNEWID - Completed succesfully.
[oracle@oracledb ~]$ cd /apps/oracle11g/product/11.2.0/dbhome_2/dbs/
Now, create new password file for new name:
[oracle@oracledb dbs]$ orapwd file=$ORACLE_HOME/dbs/orapwTEST password=sys force=y
Make new init.ora file and from existing init.ora file and change db_name parameter from orcl to TEST
Database ID for database TEST changed to 3803284043.
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 name and ID.
DBNEWID - Completed succesfully.
[oracle@oracledb ~]$ cd /apps/oracle11g/product/11.2.0/dbhome_2/dbs/
Now, create new password file for new name:
[oracle@oracledb dbs]$ orapwd file=$ORACLE_HOME/dbs/orapwTEST password=sys force=y
Make new init.ora file and from existing init.ora file and change db_name parameter from orcl to TEST
Now, create new init.ora file for new instance:
[oracle@oracledb dbs]$ cp initorcl
.ora initTEST.ora
[oracle@oracledb dbs]$ vi initTEST.ora
[oracle@oracledb dbs]$ vi initTEST.ora
change *.db_name='orcl ' to
*.db_name='TEST' in init file.
Change the listener name and tnsname to TEST netmgr
Change the listener name and tnsname to TEST netmgr
Open the database with Reset logs option:
[oracle@oracledb dbs]$ sqlplus sys as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Fri Apr 27 15:00:03 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Enter password:
Connected to an idle instance.
SQL> startup mount
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1345376 bytes
Variable Size 167774368 bytes
Database Buffers 360710144 bytes
Redo Buffers 5832704 bytes
Database mounted.
SQL> alter database open resetlogs;
Database altered.
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
TEST
No comments:
Post a Comment