Oracle NID Utility – Changing the Database Name
This utility allows the user to change the DBID or the database name
NID utility was introduced in Oracle 10g.
Giving a database a new DBNAME is common after migration of a database instance using Data Guard or duplicate where DBNAME and DB_UNIQUE_NAME differs and shall be synchronized afterwards. In some situtation an ORA-01103 error occurs and changing the DBNAME to a new value may be needed.
The DBID is an internal, unique identifier for a database. RMAN uses this DBID to identify a database. If you restore a database on an other server and you want to backup the new database in your rman catalog, you have to change the DBID in order to register the database. You will not have to use NID if you use the duplicate command instead of the restore command.
Without rman catalog, we just want or need to rename our database
We need to take a backup of our database , password file, listener and tns entries.
Note : After changing the DBID of a database, all previous backups and archived logs of the database become unusable.
Check your DBID and the database name:
SQL> select dbid, name from v$database;
We need to make the database in mount state,
SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP MOUNT
NID command usage:
We can use the nid command here ,
nid TARGET=SYS DBNAME=TESTDB SETNAME=YES
Creating password file command:
After changing the db name it promotes we need to generate a new password file,
[oracle@trichy dbs]$orapwd file=orapwtestdb.ora password=paswword0! entries=10
Modify the DB_NAME parameter in the initialization parameter file
SQL> startup nomount
ORACLE instance started.
Total System Global Area 9026142208 bytes
Fixed Size 8629560 bytes
Variable Size 1610613448 bytes
Database Buffers 7381975040 bytes
Redo Buffers 24924160 bytes
SQL> ALTER SYSTEM SET DB_NAME=TESTDB SCOPE=SPFILE;
SQL> ALTER DATABASE OPEN;
Database altered.
Our database has opened , We can check our database name,
SQL> select dbid, name from v$database;