<<Back to DB Administration Main Page
In this post NID utility is used to change both database name together with DBID
About NID and its Syntax:
NID utility is used to change Database Name , Database Identifier (DBID) both or just any one of them.
You can invoke the command as below as user oracle after setting the environment of the database you want to work on.
Change DB Name as well as DBID
$nid TARGET=SYS DBNAME=TEST1D
Change DB Name Only
$nid TARGET=SYS DBNAME=TEST1D SETNAME=YES
Check out the post How to Rename Oracle Database Using NID Utility if want to change the database name only.
Change DBID Only
$nid TARGET=SYS
DBNEWID: Release 11.2.0.4.0 - Production on Mon Mar 2 11:29:26 2020
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Keyword Description (Default)
----------------------------------------------------
TARGET Username/Password (NONE)
DBNAME New database name (NONE)
LOGFILE Output Log (NONE)
REVERT Revert failed change NO
SETNAME Set a new database name only NO
APPEND Append to output log NO
HELP Displays these messages NO
STEP BY STEP INSTRUCTION CHANGING BOTH DBID AND DATABASE NAME
Old Database Name: ORCL1P
Changed Database Name: TEST1D
Clean shutdown the database.
SQL> alter system checkpoint;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system checkpoint;
SQL> alter system checkpoint;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system checkpoint;
Startup and do some logswitches
SQL> shut immediate;
SQL> shut immediate;
SQL> startup;
SQL> alter system checkpoint;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system checkpoint;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system switch logfile;
SQL> alter system checkpoint;
Start the database in mount mode
SQL> shut immediate;
SQL> startup mount;
As oracle user run NID utility
$nid TARGET=SYS DBNAME=TEST1D
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
oracle@host1:[TEST1D] nid TARGET=SYS DBNAME=TEST1D
DBNEWID: Release 11.2.0.4.0 - Production on Fri Feb 28 12:08:55 2020
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to database ORCL1P (DBID=195317934)
Connected to database ORCL1P (DBID=195317934)
Connected to server version 11.2.0
Control Files in database:
/ora_data1/TEST1D/control/control_01.ctl
/ora_data1/TEST1D/control/control_02.ctl
/ora_data1/TEST1D/control/control_03.ctl
/ora_data1/TEST1D/control/control_01.ctl
/ora_data1/TEST1D/control/control_02.ctl
/ora_data1/TEST1D/control/control_03.ctl
Change database ID and database name ORCL1P to TEST1D? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 195317934 to 1273565543
Changing database name from ORCL1P to TEST1D
Control File /ora_data1/TEST1D/control/control_01.ctl - modified
Control File /ora_data1/TEST1D/control/control_02.ctl - modified
Control File /ora_data1/TEST1D/control/control_03.ctl - modified
Datafile /ora_data1/TEST1D/dbfile/system_01.db - dbid changed, wrote new name
Datafile /ora_data1/TEST1D/dbfile/sysaux_01.db - dbid changed, wrote new name
Datafile /ora_data1/TEST1D/dbfile/auditing.db - dbid changed, wrote new name
Datafile /ora_data1/TEST1D/dbfile/symyx_01.db - dbid changed, wrote new name
Datafile /ora_data1/TEST1D/dbfile/data01.db - dbid changed, wrote new name
.....................
......................
Control File /ora_data1/TEST1D/control/control_01.ctl - dbid changed, wrote new name
Control File /ora_data1/TEST1D/control/control_02.ctl - dbid changed, wrote new name
Control File /ora_data1/TEST1D/control/control_03.ctl - dbid changed, wrote new name
Instance shut down
Changing database ID from 195317934 to 1273565543
Changing database name from ORCL1P to TEST1D
Control File /ora_data1/TEST1D/control/control_01.ctl - modified
Control File /ora_data1/TEST1D/control/control_02.ctl - modified
Control File /ora_data1/TEST1D/control/control_03.ctl - modified
Datafile /ora_data1/TEST1D/dbfile/system_01.db - dbid changed, wrote new name
Datafile /ora_data1/TEST1D/dbfile/sysaux_01.db - dbid changed, wrote new name
Datafile /ora_data1/TEST1D/dbfile/auditing.db - dbid changed, wrote new name
Datafile /ora_data1/TEST1D/dbfile/symyx_01.db - dbid changed, wrote new name
Datafile /ora_data1/TEST1D/dbfile/data01.db - dbid changed, wrote new name
.....................
......................
Control File /ora_data1/TEST1D/control/control_01.ctl - dbid changed, wrote new name
Control File /ora_data1/TEST1D/control/control_02.ctl - dbid changed, wrote new name
Control File /ora_data1/TEST1D/control/control_03.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to TEST1D.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST1D changed to 1273565543.
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 successfully.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST1D changed to 1273565543.
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 successfully.
Some Important Info from Alertlog
=================================================================
*** DBNEWID utility started ***
DBID will be changed from 195317934 to new DBID of 1273565543 for database ORCL1P
DBNAME will be changed from ORCL1P to new DBNAME of TEST1D
Starting datafile conversion
Datafile conversion complete
Database name changed to TEST1D.
Modify parameter file and generate a new password file before restarting.
Database ID for database TEST1D changed to 1273565543.
All previous backups and archived redo logs for this database are unusable.
Database has been shutdown, open with RESETLOGS option.
Succesfully changed database name and ID.
*** DBNEWID utility finished succesfully ***
Shutting down instance (immediate)
Shutting down instance: further logons disabled
Stopping background process MMNL
Stopping background process MMON
License high water mark = 1
alter database dismount
Shutting down archive processes
Archiving is disabled
Completed: alter database dismount
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Fri Feb 28 12:09:31 2020
Stopping background process VKTM
ARCH: Archival disabled due to shutdown: 1089
Shutting down archive processes
Archiving is disabled
Fri Feb 28 12:09:34 2020
Instance shutdown complete
Comments
Post a Comment