Traditional Method
alter database backup controlfile to trace
Change all references to the old instance name in all locations for sqlnet.ora, listener.ora, tnsnames.ora and the init.ora
STARTUP NOMOUNT
CREATE CONTROLFILE set DATABASE "orcl" NORESETLOGS
NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 240
MAXINSTANCES 1
MAXLOGHISTORY 113
LOGFILE
GROUP 1 ('/u03/oradata/orcl/log1a.dbf',
'/u03/oradata/olslsq/log1b.dbf') SIZE 30M,
GROUP 2 ('/u04/oradata/orcl/log2a.dbf',
'/u04/oradata/orcl/log2b.dbf') SIZE 30M
DATAFILE
'/u01/oradata/orcl/system01.dbf',
'/u01/oradata/orcl/mydatabase.dbf'
;
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE ''/u04/oradata/orcl/log2a.dbf/temp.dbf'
SIZE 104857600 REUSE AUTOEXTEND OFF;
=================================================================================
DBNEWID Utility(NID)
DBID And DBNAME
SQL> SHUDOWN IMMEDIATE;
SQL> STARTUP MOUNT;
Invoke the DBNEWID utility (nid) specifying the new DBNAME from the command line using a user with SYSDBA privilege:
C:\orcl\920\bin>nid TARGET=sys/password@orcl DBNAME=oracle
DBNEWID: Release 9.2.0.3.0 - Production
Copyright (c) 1995, 2002, orcl Corporation. All rights reserved.
Connected to database orcl (DBID=1024166118)
Control Files in database:
C:\orcl\ORADATA\orcl\CONTROL01.CTL
C:\orcl\ORADATA\orcl\CONTROL02.CTL
C:\orcl\ORADATA\orcl\CONTROL03.CTL
Change database ID and database name orcl to oracle? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 1024166118 to 1317278975
Changing database name from orcl to oracle
Control File C:\orcl\ORADATA\orcl\CONTROL01.CTL - modified
Control File C:\orcl\ORADATA\orcl\CONTROL02.CTL - modified
Control File C:\orcl\ORADATA\orcl\CONTROL03.CTL - modified
Datafile C:\orcl\ORADATA\orcl\SYSTEM01.DBF - dbid changed, wrote new name
Datafile C:\orcl\ORADATA\orcl\UNDOTBS01.DBF - dbid changed, wrote new name
Datafile C:\orcl\ORADATA\orcl\CWMLITE01.DBF - dbid changed, wrote new name
Datafile C:\orcl\ORADATA\orcl\DRSYS01.DBF - dbid changed, wrote new name
Datafile C:\orcl\ORADATA\orcl\EXAMPLE01.DBF - dbid changed, wrote new name
Datafile C:\orcl\ORADATA\orcl\INDX01.DBF - dbid changed, wrote new name
Datafile C:\orcl\ORADATA\orcl\ODM01.DBF - dbid changed, wrote new name
Datafile C:\orcl\ORADATA\orcl\TOOLS01.DBF - dbid changed, wrote new name
Datafile C:\orcl\ORADATA\orcl\USERS01.DBF - dbid changed, wrote new name
Datafile C:\orcl\ORADATA\orcl\XDB01.DBF - dbid changed, wrote new name
Datafile C:\orcl\ORADATA\orcl\TEMP01.DBF - dbid changed, wrote new name
Control File C:\orcl\ORADATA\orcl\CONTROL01.CTL - dbid changed, wrote new name
Control File C:\orcl\ORADATA\orcl\CONTROL02.CTL - dbid changed, wrote new name
Control File C:\orcl\ORADATA\orcl\CONTROL03.CTL - dbid changed, wrote new name
Database name changed to oracle.
Modify parameter file and generate a new password file before restarting.
Database ID for database oracle changed to 1317278975.
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 succesfully.
Connect to SQL* Plus and shutdown the database
SQL> SHUDOWN IMMEDIATE;
Change DB_NAME initialization parameter in the initialization parameter file (PFILE) to the new database name.
SQL> STARTUP MOUNT;
SQL > ALTER SYSTEM SET DB_NAME=oracle SCOPE=spfile;
SQL> SHUDOWN IMMEDIATE;
Create a new password file
On Windows:
C:\> orapwd file= C:\oracle\product\10.2.0\db_1\database\pwdoracle.ora password=xxxxxxx entries=10
On Unix:
$ orapwd file= /s/oracle10g/product/10.2.0/oracle/dbs/ pwdoracle.ora password=xxxxxxx entries=10
STARTUP MOUNT
ALTER DATABASE OPEN RESETLOGS;
Backup the whole database again
DBID Only
Changing the DBID is necessary when you want to use an RMAN catalog to backup a cloned instance. RMAN identifies instances
using the DBID, preventing the original and cloned instance being managed by the same catalog
Backup the database.
Mount the database after a clean shutdown.
SHUTDOWN IMMEDIATE
STARTUP MOUNT
Invoke the DBNEWID utility (nid) from the command line using a user with SYSDBA privilege. Do not specify a new DBNAME.
nid TARGET=sys/password@orcl
Shutdown and open the database with RESETLOGS.
SHUTDOWN IMMEDIATE
STARTUP MOUNT
ALTER DATABASE OPEN RESETLOGS;
Backup the database.
DBNAME Only
Repeat the process as before except use the following command to start the DBNEWID utility.
nid TARGET=sys/password@orcl DBNAME=oracle SETNAME=YES
The SETNAME parameter tells the DBNEWID utility to only alter the database name.
When opening the database the RESETLOGS option is not needed so the database can be started using the STARTUP command.