Change DB Name

Nid Utility


Changing the DBID and DBNAME of a Database

The following steps describe how to change the DBID of a database. Optionally, you can change the database name as well.

1.The following steps describe how to change the DBID of a database. Optionally, you can change the database name as well.

Ensure that the target database is mounted but not open, and that it was shut down consistently before mounting. For example:

SHUTDOWN IMMEDIATE
STARTUP MOUNT

Invoke the DBNEWID utility on the command line, specifying a valid user (TARGET) that has the SYSDBAprivilege (you will be prompted for a password):
% nid TARGET=SYS

To change the database name in addition to the DBID, also specify the DBNAME parameter on the command line (you will be prompted for a password). The following example changes the database name to test_db:

% nid TARGET=SYS DBNAME=test_db
The dbnewid utility validates the datafile headerand the controlfiles before it could perform I/O into those files. Followed by a successful validation
the DBNEWID prompts you to confirm the operation - If you specify a logfile it does not prompt for a confirmation.
.
.
.
Connected to database PROD (DBID=78967211)
.
.
.
Control Files in database:
    /oracle/SREEJITH_DB/data/cf1.dbf
    /oracle/SREEJITH_DB/data/cf2.dbf

The following datafiles are offline clean:
    /oracle/SREEJITH_DB/data/tbs_61.dbf (23)
    /oracle/SREEJITH_DB/data/tbs_62.dbf (24)
    /oracle/SREEJITH_DB/data/temp3.dbf (3)
These files must be writable by this utility.

The following datafiles are read-only:
    /oracle/SREEJITH_DB/data/tbs_51.dbf (15)
    /oracle/SREEJITH_DB/data/tbs_52.dbf (16)
    /oracle/SREEJITH_DB/data/tbs_53.dbf (22)
These files must be writable by this utility.

Changing database ID from 78967211 to 1250654267
Changing database name from PROD to SREEJITH_DB
    Control File /oracle/SREEJITH_DB/data/cf1.dbf - modified
    Control File /oracle/SREEJITH_DB/data/cf2.dbf - modified
    Datafile /oracle/SREEJITH_DB/data/tbs_01.dbf - dbid changed, wrote new name
    Datafile /oracle/SREEJITH_DB/data/tbs_ax1.dbf - dbid changed, wrote new name
    Datafile /oracle/SREEJITH_DB/data/tbs_02.dbf - dbid changed, wrote new name
    Datafile /oracle/SREEJITH_DB/data/tbs_11.dbf - dbid changed, wrote new name
    Datafile /oracle/SREEJITH_DB/data/tbs_12.dbf - dbid changed, wrote new name
    Datafile /oracle/SREEJITH_DB/data/temp1.dbf - dbid changed, wrote new name
    Control File /oracle/SREEJITH_DB/data/cf1.dbf - dbid changed, wrote new name
    Control File /oracle/SREEJITH_DB/data/cf2.dbf - dbid changed, wrote new name
    Instance shut down

Database name changed to SREEJITH_DB.
Modify parameter file and generate a new password file before restarting.
Database ID for database SREEJITH_DB changed to 1250654267.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open database with RESETLOGS option.
Successfully changed database name and ID.
DBNEWID - Completed successfully.



Note * : Before performing the startup mount 

1. Change the export ORACLE_SID=<NEW_SID>
2. Create the necessary directories as per the initNEWSID.ora file
3. Create cdump bdump adump udump directories as per the init file

And startup mout with the new init file and perform the below steps. 


Mount the database.
STARTUP MOUNT
Open the database in RESETLOGS mode and resume normal use. For example:
ALTER DATABASE OPEN RESETLOGS;
Make a new database backup. Because you reset the online redo logs, the old backups and archived logs are no longer usable in the current incarnation of the database.

No comments:

Post a Comment