How To Change The DBID, DBNAME Using NID Utility (Doc ID 863800.1)
How To Change The DBID, DBNAME Using NID Utility (Doc ID 863800.1)
1
Copyright (c) 2024, Oracle. All rights reserved. Oracle Confidential.
How to Change the DBID, DBNAME Using NID Utility (Doc ID 863800.1)
In this Document
Goal
Solution
Changing the DBID and Database Name (DB_NAME)
Changing Only the Database ID
Changing Only the Database Name
Logs for NID :
References
APPLIES TO:
GOAL
The goal of this note is to describe how to change DBID AND/OR DB_NAME of a database.
Note:
If you change DBID at Primary in a Standby Environment, the STANDBY Database must be rebuild.
Without Standby recreated, you will see messages like this example in Alert.log:
.
Standby database ID mismatch [0x80a847ae:0x396b3b92] (2158512046:963328914)
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=8yfbnhqfm_102&id=863800.1 1/7
4/23/24, 4:39 PM Document 863800.1
Mon Apr 07 12:18:26 2014
Standby database ID mismatch [0x80a847ae:0x396b3b92] (2158512046:963328914)
.
Changing the DBNAME without changing the DBID does not require you to open with the RESETLOGS option, so database backups and archived logs are not
invalidated. However, changing the DBNAME does have consequences. You must change the DB_NAME initialization parameter after a database name change to
reflect the new name. Also, you may have to re-create the Oracle password file. If you restore an old backup of the control file (before the name change), then you
should use the initialization parameter file and password file from before the database name change.
For RAC Databases, ensure that you shutdown all instances, start only one instance with CLUSTER_DATABASE=FALSE and perform below activities. After the activity is
performed, start all rac instances normally.
This procedure can also be executed to change the name of a container database.
SOLUTION
1. Ensure you have valid cold/hot backup of database. If it's a hot backup (RMAN or OS), ensure you also have all the archived logs and backup of all Online Redo logs
(after database is consistently shutdown).
3. cd <Oracle Home>/bin
6. If you need to use TNS to connect to database, make sure that you have DB_OLD specified in the tnsnames.ora and listener is started.
You can also check if you able to connect to the database using sqlplus :
$ sqlplus sys/<password>@DB_OLD
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=8yfbnhqfm_102&id=863800.1 2/7
4/23/24, 4:39 PM Document 863800.1
or
The DBNEWID utility performs validations in the headers of the datafiles and control files before attempting I/O to the files. If validation is successful, then
DBNEWID prompts you to confirm the operation (unless you specify a log file, in which case it does not prompt), changes the DBID (and the DBNAME, if specified,
as in this example) for each datafile, including offline normal and read-only datafiles, shuts down the database, and then exits.
The following is an example of what the output for this would look like:
Change database ID and database name <OLD DB Name> to <NEW DB Name>? (Y/[N]) => Y
If validation is not successful, then DBNEWID terminates and leaves the target database intact, as shown in the following sample output. You can open the
database, fix the error, and then either resume the DBNEWID operation or continue using the database without changing its DBID.
The NID utility does not change the server parameter file (SPFILE). Therefore, if you use SPFILE to start your Oracle database, you must re-create the initialization
parameter file from the server parameter file, remove the server parameter file, change the DB_NAME in the initialization parameter file, and then re-create the
server parameter file.
9. If you are using ASM and want to change the file name, follow this Article at this point
10. NID Utility will shutdown the database after the execution. So mount the database once again.
SQL> STARTUP MOUNT
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.
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=8yfbnhqfm_102&id=863800.1 4/7
4/23/24, 4:39 PM Document 863800.1
12. Recreate the password file since the DB NAME has been changed:
where
file - name of password file (mand),
password - password for SYS (mand),
entries - maximum number of distinct DBA,
force - whether to overwrite existing file (opt),
nosysdba - whether to shut out the SYSDBA logon (opt for Database Vault only).
Note: There are no spaces around the equal-to (=) character.
13. Change the $ORACLE_HOME/network/admin/tnsnames.ora file wherever it has the old db name.
14. If there is a static registration of the database in the listener.ora file then change the database name in the following file
$ORACLE_HOME/network/admin/listener.ora.
If you are dealing with a database in a distributed database system, then each database should have a unique global database name. The DBNEWID utility does not
change global database names. This can only be done with the SQL ALTER DATABASE statement, for which the syntax is as follows:
The global database name is made up of a database name and a domain, which are determined by the DB_NAME and DB_DOMAIN initialization parameters when the
database is first created.
This command will ask you the new SID and will delete and recreate the service.
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=8yfbnhqfm_102&id=863800.1 5/7
4/23/24, 4:39 PM Document 863800.1
1-6 except 4. Follow the steps 1 to 6 (except step 4) given in above section.
$ nid TARGET=SYS/<password>@<service>
or
$ nid TARGET=SYS/<password>
8. NID Utility will shutdown the database after the execution. So mount the database once again.
SQL> STARTUP MOUNT
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.
or
8. Change the DB_NAME in the pfile/spfile: Follow step 8 from the first section.
9. If you are using ASM and want to change the file name, follow this Article at this point
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=8yfbnhqfm_102&id=863800.1 6/7
4/23/24, 4:39 PM Document 863800.1
REFERENCES
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=8yfbnhqfm_102&id=863800.1 7/7