RMAN Cloning: (Source: PRODDB, Target: RCLONE)
Backup the source database
RMAN> connect target /
RMAN> backup database plus archivelog;
Backup database;
Backup archivelog all;
mkdir –p /u01/oracle/10g/oradata/RCLONE/
mkdir –p /u01/oracle/10g/RCLONE/admin/RCLONE/adump
mkdir –p /u01/oracle/10g/RCLONE/admin/RCLONE/bdump
mkdir –p /u01/oracle/10g/RCLONE/admin/RCLONE/cdump
mkdir –p /u01/oracle/10g/RCLONE/admin/RCLONE/udump
mkdir –p /u01/oracle/10g/RCLONE/flash_recovery_area
Create password file using orapwd utility from the source
orapwd file=orapwdPRODDB password=welcome
Create a new INIT.ORA (initRCLONE.ora
Review all parameters and make the required changes.
DB_NAME=RCLONE, control_files=’/u01/oradata/RCLONEB/control1.dbf’
DB_FILE_NAME_CONVERT=(/u01/oradata/ PRODDB/, /u01/oradata/ RCLONE/)
LOG_FILE_NAME_CONVERT=(/u01/oradata/ PRODDB/, /u01/oradata/ RCLONE/)
export ORACLE_SID=RCLONE
sqlplus “/as sysdba”
startup nomount
RMAN> connect target sys/welcome@testdb1
RMAN> connect catalog rman/rman@catalogdb
RMAN> connect auxiliary /
RMAN>run {
allocate auxiliary channel aux1 type disk;
set until sequence 89;
duplicate target database to RCLONE;
}
RMAN> connect target sys/welcome@testdb1
connected to target database: TESTDB1 (DBID=483837369)
RMAN> connect auxiliary /
connected to auxiliary database: RCLONE (not mounted)
RMAN> run
2> { duplicate target database to RCLONE until sequence 15; }
The above script will connect to the "target" (database that will be cloned), the recovery catalog (to get
backup info), and the auxiliary database (new duplicate DB). Previous backups will be restored and the
database recovered to the "set until time or set until sequence" specified in the script.
Notes: the "set newname" commands are only required if your datafile names will different from the
target database.
The newly cloned DB will have its own unique DBID.
=============================================================
FAQ
=============================================================
The NID (New Database ID) utility allows you to change only the DBNAME, or only
the DBID or both DBNAME and DBID in the same command.
If you change the DBID you must open the database with the RESETLOGS option, which re-
creates the online redo logs and resets their sequence to 1.