Original link:
Http://www.eygle.com/faq/use.nid.to.change.your.dbname.htm
NID is the tool that Oracle starts from 9iR2, which can be used to change the database name without the need to rebuild the control file before the reconstruction of the control file. It is necessary to explain that although this tool comes from 9iR2, it is still used for Oracle8i.
Let's take a look at help:
C: /> nid -help
DBNewid: Release 10.1.0.2.0 - Production
CopyRight (C) 2001, 2004, Oracle. All Rights Reserved.
Keyword description (default)
-------------------------------------------------- -
Target username / password (none)
DBNAME new database name (none)
Logfile output log (none)
Revert Restore failure changes No
SetName only sets new database names
Append attached to output logs No
Help Shows these messages No
We look at the usage by examples:
1. Database Current Settings
SQL> SELECT * FROM V $ VERSION;
Banner
-------------------------------------------------- ----------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL / SQL Release 9.2.0.1.0 - Production
Core 9.2.0.1.0 Production
TNS for 32-Bit Windows: Version 9.2.0.1.0 - Production
NLSRTL VERSION 9.2.0.1.0 - Production
SQL> Show Parameter Name
Name Type Value
----------------------------------- --- ---------------------------
DB_FILE_NAME_CONVERT STRING
DB_NAME STRING EYGLEV
Global_names Boolean False
Instance_name String Eyglev
LOCK_NAME_SPACE STRING
LOG_FILE_NAME_CONVERT STRING
Oracle_trace_collection_name string
Oracle_trace_facility_name string ORACLED
PLSQL_NATIVE_MAKE_FILE_NAME STRING
Service_names String Eyglev
2. SHUTDOWN database
SQL> Connect Sys / ORASYS As Sysdbaconnected.
SQL> Shutdown Immediate
Database closed.
Database dismount.
Oracle Instance Shut Down.
3. Startup Mount
SQL> Startup MountainOracle Instance Started.
Total System Global Area 135338868 Bytesfixed Size 453492 bytesvariable size 109051904 bytesdatabase buffers 25165824 bytesdatabase mounted.
4. Changed using NID
SQL> Host
Microsoft Windows 2000 [Version 5.00.2195]
(C) All rights reserved 1985-2000 Microsoft Corp.
C: /> Nid Target = SYS / ORASYS DBNAME = Eyglen
DBNewID: Release 9.2.0.1.0 - Production
CopyRight (C) 1995, 2002, Oracle Corporation. All Rights Reserved.
Connected to Database Eyglev (DBID = 677189177)
Control Files in Database:
E: /oracle/oradata/eyglen/control01.ctl
E: /oracle/oradata/eyglen/control02.ctl
E: /oracle/oradata/eyglen/control03.ctl
CHANGE DATABASE ID AND DATABASE NAME EYGLEV TO EYGLEN? (Y / [N]) => y
Proceeding with operation
Changing Database ID from 677189177 to 3955758099
Changing Database Name from Eyglev to Eyglen
Control File E: /oracle/oradata/eyglen/control01.ctl - modified
Control file e: /oracle/oradata/eyglen/control02.ctl - modifi
Control file e: /oracle/oradata/eyglen/control03.ctl - modified
DataFile E: /oracle/oradata/eyglen/system01.dbf - DBID CHANGED, WROTE NEW NAME
DataFile E: /oracle/oradata/eyglen/undotbs01.dbf - DBID CHANGED, WROTE NEW NAME
DataFile E: /oracle/oradata/eyglen/cwmlite01.dbf - DBID CHANGED, WROTE NEW NAME
DataFile E: / Oracle/oradata/eyglen/drsys01.dbf - DBID CHANGED, WROTE New Name
DataFile E: /Oracle/oradata/eyglen/indx01.dbf - DBID CHANGED, WROTE NAME
DataFile E: / Oracle/oradata/eyglen/odm01.dbf - DBID CHANGED, WROTE New Name
DataFile E: /Oracle/oradata/eyglen/tools01.dbf - DBID Changed, Wrote New NamedataFile E: / ORACLE/Ordata/eyglen/users01.dbf - DBID CHANGED, Wrote New Name
DataFile E: /oracle/oradata/eyglen/xdb01.dbf - DBID CHANGED, WROTE New Name
DataFile E: /oracle/oradata/eyglen/eygle.dbf - DBID CHANGED, WROTE New Name
DataFile E: /oracle/oradata/eyglen/temp01.dbf - DBID CHANGED, WROTE NEW NAME
Control file e: /oracle/oradata/eyglen/control01.ctl - dbid change, wrote new name
Control file e: /oracle/oradata/eyglen/control02.ctl - dbid change, wrote new name
Control file e: /oracle/oradata/eyglen/control03.ctl - dbid change, wrote new name
Database name change to Eyglen.
Modify Parameter File and Generate A New Password File Before Restarting.
Database ID for database Eyglen Changed to 3955758099.
All Previous Backups and Archived Redo Logs for this Database Are Unusable.
Shut Down Database and Open with RESETLOGS OPTION.
SUCCESFULLY CHANGED DATABASE NAME AND ID.
DBNewID - Completed success.
5. Shutdown Database
SQL> Shutdown Immediateora-01109: Database Not Open
Database Dismbounted.Oracle Instance Shut Down.
6. Modify the initialization parameter file, spfile file (init.ora / spfile)
################################################################################## ##################################################################################################################### # db_name = Eyglev ################################################################
7. Reconstruction SPFILE file If you don't use spfile, there is of course no need to rebuild, skip to 8
SQL> Startup Pfile = E: /oracle/admin/eyglen/pfile/init.ora
Oracle Instance Started.
Total System Global Area 135338868 BYtes
Fixed size 453492 bytes
Variable size 109051904 bytes
Database buffers 25165824 bytesredo buffers 667648 BYTES
ORA-01991: Invalid Password file 'E: /oracle/ora9ir2/database/pwdeyglen.ora'
SQL> CREATE SPFILE = 'E: /oracle/ora9ir2/Database/spfileeyglen.ora' from
2 pfile = 'e: /oracle/admin/eyglen/pfile/init.ora';
File created.
8. Rebuild password file
SQL> HostMicrosoft Windows 2000 [Version 5.00.2195] (C) Copyright 1985-2000 Microsoft Corp.
C: /> ORAPWD File = E: /oracle/ora9ir2/database/pwdeyglen.ora Password = Oracle Entries = 5
9. SHUTDOWN Database If you do not use SPFile, you can jump to 10
SQL> Shutdown Immediateora-01109: Database Not Open
Database Dismbounted.Oracle Instance Shut Down.
10. STARTUP MOUNT, RESETLOGS open
SQL> Startup Mount
Oracle Instance Started.
Total System Global Area 135338868 BYtes
Fixed size 453492 bytes
Variable size 109051904 bytes
Database buffers 25165824 BYTES
Redo buffers 667648 bytes
Database mounted.
SQL> ALTER DATABASE OPEN RESETLOGS
2 /
Database altered.
SQL>
11. Modified parameters
SQL> Show Parameter Name
Name Type Value
----------------------------------- --- ---------------------------
DB_FILE_NAME_CONVERT STRING
DB_NAME STRING EYGLEN
Global_names Boolean False
Instance_name String Eyglen
LOCK_NAME_SPACE STRING
LOG_FILE_NAME_CONVERT STRING
Oracle_trace_collection_name string
Oracle_trace_facility_name string ORACLED
PLSQL_NATIVE_MAKE_FILE_NAME STRING
Service_names string Eyglen12. Make a full backup to the database
Attachment: Change 817 database using NID
1. Change
SVRMGR> Startup Mount
Oracle instance has been launched.
There are 619,70460 bytes in the overall system of the system.
FIXED SIZE 75804 bytes
Variable size 17645568 bytes
Database buffers 44171264 bytes
Redo buffers 77824 bytes
A database is already loaded.
SVRMGR> show parameter name
Name Type Value
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------
DB_FILE_NAME_CONVERT string
DB_NAME String Vilen
Global_names Boolean True
Instance_name string Vilen
LOCK_NAME_SPACE string
Log_file_name_convert string
Oracle_trace_collection_name string
Oracle_trace_facility_name string ORACLED
Service_names string Vilen
SVRMGR>
2. modify
C: /> Nid Target = SYS / ORASYS @ Vilen DBNAME = Vilene
DBNewID: Release 9.2.0.1.0 - Production
CopyRight (C) 1995, 2002, Oracle Corporation. All Rights Reserved.
Connected to Database Vilen (DBID = 1535443189)
Control Files in Database:
C: /oracle/oradata/vilen/control01.ctl
C: /oracle/oradata/vilen/control02.ctl
C: /oracle/oradata/vilen/control03.ctl
CHANGE DATABASE ID AND DATABASE NAME VILEN TO VILENE? (Y / [N]) => Y
Proceeding with operation
Changing Database ID from 1535443189 to 681857412
Changing Database Name from Vilen to Vilene
Control File C: /oracle/oradata/vilen/control01.ctl - modified
Control File C: /oracle/oradata/vilen/control02.ctl - modified
Control File C: /oracle/oradata/vilen/control03.ctl - ModifiedDataFile C: /oracle/oradata/vilen/system01.dbf - DBID CHANGED, Wrote New Name
DataFile C: /oracle/oradata/vilen/rbs01.dbf - DBID CHANGED, WROTE NEW NAME
DataFile C: /oracle/oradata/vilen/users01.dbf - DBID CHANGED, WROTE New Name
DataFile C: /oracle/oradata/vilen/temp01.dbf - DBID CHANGED, WROTE New Name
DataFile C: /oracle/oradata/vilen/tools01.dbf - DBID CHANGED, WROTE NEW NAME
DataFile C: /oracle/oradata/vilen/indx01.dbf - DBID CHANGED, WROTE NEW NAME
DataFile C: /oracle/oradata/vilen/eqsp01.dbf - DBID CHANGED, WROTE New Name
DataFile C: /oracle/roadata/vilen/perfstatat.dbf - DBID CHANGED, WROTE New Name
Control File C: /oracle/oradata/vilen/control01.ctl - DBID CHANGED, WROTE New Name
Control File C: /oracle/oradata/vilen/control02.ctl - DBID CHANGED, WROTE New Name
Control File C: /oracle/oradata/vilen/control03.ctl - DBID CHANGED, WROTE New Name
Database name change to Vilene.
Modify Parameter File and Generate A New Password File Before Restarting.
Database id for database vilene change to 681857412.
All Previous Backups and Archived Redo Logs for this Database Are Unusable.
Shut Down Database and Open with RESETLOGS OPTION.
SUCCESFULLY CHANGED DATABASE NAME AND ID.
DBNewID - Completed success.
3. Close the database
SVRMGR> Shutdown Immediateora-01109: The database has not been removed the database. Oracle instance is closed.
4. Modify parameter file
DB_NAME = "Vilene" #db_name = "Vilen"
Instance_name = Vilene # instance_name = Vilen
5. Rebuild password file
C: / Oracle / Database> ORAPWD File = PWDVILEN.ORA Password = Oracle Entries = 5
C: / Oracle / Database>
6. mount database
SVRMGR> Startup Mount
Oracle Instance Started.
Total System Global Area 61970460 Bytesfixed Size 75804 Bytes
Variable size 17645568 bytes
Database buffers 44171264 BYTES
Redo buffers 77824 bytes
Database mounted.
7. Open the database
SVRMGR> ALTER DATABASE OPEN RESETLOGS2> / Statement Processed.
8. Modified parameters
SVRMGR> show parameter name
Name Type Value
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ----------------------
DB_FILE_NAME_CONVERT STRING
DB_NAME STRING VILENE
Global_names Boolean True
Instance_name String Vilene
LOCK_NAME_SPACE STRING
LOG_FILE_NAME_CONVERT STRING
Oracle_trace_collection_name string
Oracle_trace_facility_name string ORACLED
Service_names string Vilen