As recommended by Oracle, the Oracle DBID must be unique for each data center. After you perform a cross-restore to an alternate host, change the DBID of the restored database according to the following instructions. You can also optionally change the database name.
Prerequisites
Before you change the DBID of the Oracle instance, ensure that you have a recoverable whole database backup.
About this task
NOTE
For more information about the procedures for changing the Oracle DBID or database name, refer to the
Oracle Database Utilities Guide from the Oracle Help Center.
The
DBNEWID utility can change only the database name (DBNAME), not the instance name (SID).
Steps
Ensure that the target database is mounted but not open. Ensure that the database was shut down consistently before mounting. For example:
rman target /
Recovery Manager: Release 12.2.0.1.0 - Production on Fri Sep 18 17:23:16 2020
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1573350876)
RMAN> shutdown immediate;
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 2483027968 bytes
Fixed Size 8795808 bytes
Variable Size 553650528 bytes
Database Buffers 1912602624 bytes
Redo Buffers 7979008 bytes
To run the
DBNEWID utility to change the Oracle DBID, run the
nid command and include the
TARGET option to specify a valid user with SYSDBA privileges.
The
DBNEWID utility performs the following operations:
The utility prompts for the database user password.
The utility performs validations in the headers of the data files and control files.
If the validations are successful, the utility prompts for confirmation before changing the DBID.
NOTE If you have specified a log file, the utility does not prompt for confirmation.
The utility changes the DBID for each data file, including offline normal and read-only data files, and then shuts down the database and exits.
The following examples show the outputs of the
nid command:
nid
DBNEWID: Release 12.2.0.1.0 - Production on Fri Sep 18 17:27:16 2020
Copyright (c) 1982, 2017, 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
nid TARGET=SYS
DBNEWID: Release 12.2.0.1.0 - Production on Fri Sep 18 17:27:36 2020
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to database ORCL (DBID=1573350876)
Connected to server version 12.2.0
Control Files in database:
/home/oracle/app/oracle/oradata/orcl/control101.ctl
/home/oracle/app/oracle/fast_recovery_area/orcl/control102.ctl
Change database ID of database ORCL? (Y/[N]) => y
Proceeding with operation
Changing database ID from 1573350876 to 1579271059
Control File /home/oracle/app/oracle/oradata/orcl/control101.ctl - modified
Control File /home/oracle/app/oracle/fast_recovery_area/orcl/control102.ctl - modified
Datafile /home/oracle/app/oracle/oradata/orcl/system01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/sysaux01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/undotbs01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/pdbseed/system01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/pdbseed/sysaux01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/users01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/pdbseed/undotbs01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/orclpdb/system01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/orclpdb/sysaux01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/orclpdb/undotbs01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/orclpdb/users01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/temp01.db - dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/pdbseed/temp012020-07-12_12-09-35-835-PM.db dbid changed
Datafile /home/oracle/app/oracle/oradata/orcl/orclpdb/temp01.db - dbid changed
Control File /home/oracle/app/oracle/oradata/orcl/control101.ctl - dbid changed
Control File /home/oracle/app/oracle/fast_recovery_area/orcl/control102.ctl - dbid changed
Instance shut down
Database ID for database ORCL changed to 1579271059.
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.
Successfully changed database ID.
DBNEWID - Completed successfully.
Mount the database, and open the database in RESETLOGS mode. For example:
rman target /
Recovery Manager: Release 12.2.0.1.0 - Production on Fri Sep 18 17:42:26 2020
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup mount
Oracle instance started
database mounted
Total System Global Area 2483027968 bytes
Fixed Size 8795808 bytes
Variable Size 671091040 bytes
Database Buffers 1795162112 bytes
Redo Buffers 7979008 bytes
RMAN> ALTER DATABASE OPEN RESETLOGS;
using target database control file instead of recovery catalog
Statement processed
RMAN> exit
Recovery Manager complete.
At this point, you can resume normal operations with the database, which has the new DBID. For example:
rman target /
Recovery Manager: Release 12.2.0.1.0 - Production on Fri Sep 18 18:00:30 2020
copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1579271059)
RMAN>
Perform a full database backup. Because the online redo logs have been reset, the previous backups and archived logs are no longer usable in the new incarnation of the database.
Data is not available for the Topic
Please provide ratings (1-5 stars).
Please provide ratings (1-5 stars).
Please provide ratings (1-5 stars).
Please select whether the article was helpful or not.
Comments cannot contain these special characters: <>()\