It is inevitable that dbname and dbid need to be modified during work, such as restoring the database to the same machine. However, dbname and dbid are one of the important symbols used to identify the database, especially dbid, which is unique. Therefore, the modification should be handled with caution. This document describes how to modify dbname and dbid and provides an example.
1. Influence of dbid and dbname Modification
A. Modify dbid
It is equivalent to creating a new database. The difference is that the data already exists in the data file. This is determined by the uniqueness of dbid.
After the modification, all the previous backup and archive logs will be unavailable, because dbid will be detected during recovery. Because of the mismatch, all backups will be invalid.
After modification, you need to use open resetlogs to open the database. A new incarnation will be created and the sequence will be set to 1.
If the database is successfully modified and open, we recommend that you disable the database consistently, restart the database, and perform a complete backup.
B. Modify dbname
After modification, you do not need to use open resetlogs to open the database. (Note that dbname is not unique, and global name is unique ).
After modification, all the backups are archived logs still available.
After modification, You need to modify the db_name parameter in pfile/spfile and recreate the corresponding Oracle password file.
If you need to use the old control file to restore the database, you should use the pfile/spfile before modification and the password file to start the database and then restore it.
C. Modify the dbid and dbname simultaneously.
If the modification is made at the same time, it is a combination of the above two cases. After the modification, you need to open resetlogs and modify pfile/spifle, password file, and full backup database.
2. NID command
Robin @ szdb: ~> Nid
Dbnewid: Release 10.2.0.3.0-production on Thu Apr 24 16:34:28 2013
Copyright (c) 1982,200 5, Oracle. 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
When executing the NID command, the program will verify all the data files in the current database and the header information of the control file. After the verification is successful, it will prompt whether to modify the information.
If the logfile output to the log file is used, no modification prompt is displayed.
Next, NID will use the new dbid (or dbname) to change the header of the control file one by one, data files (including read-only files and normal offline files.
After successful modification, the database is automatically closed and exited.
Note: For read-only files, normal offline files are not tested in this document. Second, we should ensure that the database is in the archive state, and the database can be normally archived and there are no data files to be recovered.
3. Modification steps
A. Full backup database. If it is a hot backup (RMAN or OS), ensure that all archived logs and online logs are available.
B. Delete dbconsole ([ID 863800.1] has this requirement. If dbconsole is used, follow this operation)
C. Start the database to be modified to the Mount status (startup mount)
D. If you use the spfile file to start the database, back up the spfile file to pfile to modify db_name.
E. Release the NID command
NID target = sys/password # This method only modifies dbid
NID target =/dbname = new_dbname [setname = Yes] # // indicates the SID connecting to the current environment and operating system authentication is used.
NID target = sys/password dbname = new_dbname [setname = Yes] # setname = yes only modifies the database name. If this parameter is omitted, both parameters are modified at the same time.
NID target = sys/pwdd @ conn_string dbname = new_dbname [setname = Yes] # use a connection string to connect to the remote host and modify
F. Modify db_name in the Oracle parameter file pfile (which was backed up from spfile earlier). skip this step if you only modify dbid.
G. Use the new parameter file pfile to start the file to the Mount State (if dbname is modified and only dbid is used, use the original pfile or spfile to start the file)
H. Open the database using open resetlogs (modify the non-dbid and open it directly)
I. Rebuild the oralce password file of the current database and convert the pfile file to the spfile file.
J. Modify the Listener Configuration values, including listener. ora and tnsnames. ora.
K. Modify the global dbname, if applicable. Alter database rename global_name to <newname>. <domain>;
L. Recreate dbconsole $ emca-config dbcontrol DB-repos recreate
M. Full backup database
4. Demonstrate modifying dbname
$ Export oracle_sid = CLBO $ sqlplus/As sysdba --> dbid, name, and status of the current database. the following example uses the pfile file to start the database. SQL> select dbid, name, open_mode from V $ database; dbid name open_mode ------------- ---------- 1924111546 CLBO mounted $ NID target = sys/Oracle dbname = mmbo setname = yesdbnewid: release 10.2.0.3.0-production on Wed Apr 24 18:16:54 2013 copyright (c) 1982,200 5, Oracle. all rights reserved. connected to datab Ase clbo (dbid = 1924111546) connected to server version 10.2.0control files in Database:/u02/database/Sybo/controlf/cntl1sybo. CTL/u02/database/Sybo/controlf/cntl2sybo. CTL/u02/database/Sybo/controlf/cntl3sybo. ctlchange Database Name of database CLBO to mmbo? (Y/[N]) => yproceeding with operationchanging database name from CLBO to mmbo control file/u02/database/Sybo/controlf/cntl1sybo. CTL-modified control file/u02/database/Sybo/controlf/cntl2sybo. CTL-modified control file/u02/database/Sybo/controlf/cntl3sybo. CTL-modified ................. omitted ................. database name changed to mmbo. modify parameter file and generate a new password file before restarting. succesfully changed database name. dbnewid-completed succesfully. -- modify the db_name parameter in the pfile file and restart the database (Omitted) -- check the status after the repair, dbid does not change, however, dbname and $ export oracle_sid = mmbo $ sqlplus/As sysdbasql> select dbid, name, open_mode from V $ database; dbid name open_mode ---------- --------- -------- 1924111546 mmbo read write
5. Modify the dbname and dbid at the same time.
$ Export oracle_sid = mmbosql> startup Mount pfile =/u02/database/Sybo/initmmbo. ora $ NID target =/dbname = sybodbnewid: Release 10.2.0.3.0-production on Wed Apr 24 19:12:57 2013 copyright (c) 1982,200 5, Oracle. all rights reserved. connected to database mmbo (dbid = 1924111546) connected to server version 10.2.0control files in Database:/u02/database/Sybo/controlf/cntl1sybo. CTL/u02/database/Sybo/Control F/cntl2sybo. CTL/u02/database/Sybo/controlf/cntl3sybo. ctlchange Database ID and database name mmbo to Sybo? (Y/[N]) => yproceeding with operationchanging Database ID from 1924111546 to 4235963258 changing database name from mmbo to Sybo control file/u02/database/Sybo/controlf/cntl1sybo. CTL-modified control file/u02/database/Sybo/controlf/cntl2sybo. CTL-modified control file/u02/database/Sybo/controlf/cntl3sybo. CTL-modified datafile/u02/database/Sybo/oradata/syssybo. DBF-dbid changed, wrote new name ................ datafile/u02/database/Sybo/temp/tmp. DBF-dbid changed, wrote new name control file/u02/database/Sybo/controlf/cntl1sybo. CTL-dbid changed, wrote new name control file/u02/database/Sybo/controlf/cntl2sybo. CTL-dbid changed, wrote new name control file/u02/database/Sybo/controlf/cntl3sybo. CTL-dbid changed, wrote new name instance shut downdatabase name changed to Sybo. modify parameter file and generate a new password file before restarting. database ID for database Sybo changed to 4235963258.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 succesfully. -- modify the db_name of the pfile and rename the pfile to initsybo. orasql> startup pfile =/u02/database/Sybo/initsybo. oraoracle instance started. database mounted. ORA-01589: must use resetlogs or noresetlogs option for database open -- Author: Robinson -- Blog: http://blog.csdn.net/robinson_0612SQL> alter database open resetlogs; database altered. SQL> select dbid, name, open_mode from V $ database; dbid name open_mode ------------- ---------- 2315014338 Sybo read write -- re-create the spfile and password file, configure value listening, tnsnames. ora, modify global name, recreate dbconsole, and perform full backup, which is omitted here. -- do not demonstrate the modification of dbid only. run NID target = sys/pwd in the Mount status.
More references
For more information about Oracle RAC, see
Use crs_setperm to modify the resource owner and permissions of RAC.
Use crs_profile to manage RAC resource configuration files
RAC database startup and Shutdown
Oracle RAC services
Services in Oracle Database 10g
Migrate datbase from single instance to Oracle RAC
Connect Oracle RAC to a specified instance
Oracle RAC load balancing test (combined with server and client)
Oracle RAC server connection Load Balance)
Load Balance)
Non-Default port listening configuration in Oracle RAC (listener. ora tnsnames. ora)
Oracle RAC Listener Configuration (listener. ora tnsnames. ora)
Configure RAC load balancing and Failover
CRS-1006, CRS-0215 fault case
Installing Oracle 10g RAC Based on Linux (RHEL 5.5)
Use runcluvfy to verify the Oracle RAC installation environment
For more information about the basics and concepts of Oracle network configuration, see:
Configure dynamic service registration for non-default ports
Configure sqlnet. ora to restrict IP Access to Oracle
Configure and manage Oracle listener logs
Set the Oracle listener password (listener)
Configure the Oracle client to connect to the database
For more information about user-managed backup and recovery, see
Oracle cold backup
Oracle Hot Backup
Concept of Oracle backup recovery
Oracle instance recovery
Oracle recovery based on user management
System tablespace management and Backup Recovery
Sysaux tablespace management and recovery
Oracle backup control file recovery (unsing backup controlfile)
For information on RMAN backup recovery and management, see
RMAN overview and architecture
RMAN configuration, Monitoring and Management
Detailed description of RMAN backup
RMAN restoration and recovery
Create and use RMAN catalog
Create RMAN storage script based on catalog
Catalog-based RMAN backup and recovery
RMAN backup path confusion
Use RMAN for recovery from different machine backups (WIN platform)
Use RMAN to migrate a file system database to ASM
Linux RMAN backup shell script
Use RMAN to migrate the database to a different machine
For the Oracle architecture, see
Oracle tablespace and data files
Oracle Password File
Oracle parameter file
Oracle online redo log file)
Oracle Control File)
Oracle archiving logs
Oracle rollback and undo)
Oracle database instance startup and Shutdown Process
Automated Management of Oracle 10g SGA
Oracle instances and Oracle databases (Oracle Architecture)