Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
In the final part of this series, we will rename the duplicated Oracle database. After duplicating a database, renaming it is crucial to avoid conflicts with the original source database.
First, shut down the database on the destination server.
SQL> shutdown immediate;
Next, start the database in NOMOUNT mode using the modified PFILE.
SQL> startup nomount pfile='/u01/app/oracle/product/19.0.0/db_1/dbs/initorcl.ora';
SQL> alter database mount;
Use the nid
(DBNEWID) utility to rename the duplicated database.
nid target=sys/password dbname=test
Edit the parameter file to reflect the new database name.
vi /u01/app/oracle/product/19.0.0/db_1/dbs/initorcl.ora
Change the db_name
parameter to the new name:
*.db_name='test'
Create a new password file for the renamed database.
cd /u01/app/oracle/product/19.0.0/db_1/dbs
orapwd file=orapwtest password=<password> entries=10
The RESETLOGS
option is used after renaming or restoring the database because it creates a new incarnation of the database. This is necessary to reset the online redo logs and avoid conflicts with previous log history, ensuring the integrity of the database’s new identity. It effectively marks the start of a fresh timeline for the database, allowing it to continue normal operations without referencing any outdated log sequences.
Finally, start the database and open it using RESETLOGS
:
SQL> startup mount;
SQL> alter database open resetlogs;
Confirm that the database has been renamed and is running properly.
SQL> select instance_name, status from v$instance;
SQL> select open_mode, name, created from v$database;
In this last part of the series, we have successfully renamed the duplicated Oracle 19c database. You now have a fully functioning duplicate of your production database under a new name, ready for use in development, testing, or other non-production environments.