Sunday, July 08, 2012

'DBNEWID' Utility

Using DBNEWID utility, we can change the DBNAME as well as DBID.
  1. DBID and DBNAME
  2. DBNAME only
  3. DBID only
 
1. DBID and DBNAME
 
Before ivoking DBNEWID utility, it's highly recommended to take a full consistent backup of the target database. Then startup the database in mount stage:
 
SQL> shut immediate
SQL> startup mount
 
Invoke the DBNEWID utility by specifying the new DBNAME from the commandline using SYS user:
 
# nid TARGET=sys/password@dbuat01srv DBNAME=dbtau01
 
When prompted to confirm change of database ID and database name, press 'Y'. Once the database name and DBID is changed successfully, please remember to modify the parameter file and generate a new password file with the new DBNAME before restarting the database.

Then, finally open the database using 'RESETLOGS'.

SQL> shut immediate
SQL> startup mount
SQL> alter database open resetlogs;
 
2. DBNAME only
 
The same process must be repeated as shown in the previous example. However, with 'SETNAME' clause.
 
# nid TARGET=sys/password@dbuat01srv DBNAME=dbtau01 SETNAME=YES
 
The SETNAME clause instructs the DBNEWID utility to only alter the database name. While opening the database, 'RESETLOGS' options is not required. The database can be started with 'STARTUP' command. Of course, parameter file and password files must be modified with the new DBNAME.
 
 
3. DBID only
 
A full database backup is highly recommended. Bring the database into mount stage after a clean shutdown.
 
SQL> shut immediate
SQL> startup mount
 
Invoke the DBNEWID utility (nid) from the commandline as SYS user. Here, no DBNAME or SETNAME clauses are required here.
 
# nid target=sys/password@dbuat01srv
 
Thereafter, shutdown and open the database with 'RESETLOGS'.
 
SQL> shut immediate
SQL> startup mount
SQL> alter database open resetlogs;
 
Take a consistent full backup!
 
 
[ Top ]
 
Last modified: Jul 05, 2012 11:45 IST

No comments: