DATABASE CLONING WITH RMAN
DATABASE CLONING WITH RMAN..........................................................................1 Recovery Catalog is created and registered with Database.................................................2 Listener for recover catalog is up and running....................................................................2 Target database is started and running.................................................................................2 Listener of Target database is up and running.....................................................................2 Steps to be performed under target database.......................................................................3 Steps to be performed under Clone (Duplicate) Database...................................................3 Observations........................................................................................................................4
Prepared by: Nikhil Rangaraju ORACLE NAIO
Recovery Catalog is created and registered with Database Steps to create Recovery catalog: Assume that my database SID is db02 and I am going to create recovery catalog in db02. a) export ORACLE_SID=db02 b) sqlplus ‘/as sysdba’ c) create tablespace dummy datafile ‘/u01/oracle9i/oradata/db02/dummy01.dbf’ size 200m autoextend on; d) create user catalog identified by catalog default tablespace dummy quota unlimited on dummy; e) Grant recovery_catalog_owner to rman; f) Exit g) Connect as catalog user as connect catalog/catalog@db02 h) Create catalog i) Exit Steps to register recovery catalog with target database: a) rman catalog catalog/catalog target sys/welcome@db01 b) register database. Hence Recovery catalog is create and registered with target database. Listener for recover catalog is up and running Lsnrctl start and see that db02 is configured with listener with netmgr tool or edit listener.ora and tnsnames.ora file located in $ORACLE_HOME/network/admin manually.
Target database is started and running export ORACLE_SID=db01 Su – oracle9i Sqlplus ‘/as sysdba’ Startup
Listener of Target database is up and running Lsnrctl start and see that db01 is configured with listener with netmgr tool or edit listener.ora and tnsnames.ora file located in $ORACLE_HOME/network/admin manually.
Think of New Clone SID ORACLE_SID=dup Create all directory structures as required Oracle9i
Admin db01 bdump udump cdump
Oradata dup
db01
dup
bdump udump cdump
Steps to be performed under target database. From the target database rman target sys/welcome@db01 catalog catalog/catalog@db02 connect to rman…… backup database plus archivelog Whole Database backup along with archivelog files are taken. Steps to be performed under Clone (Duplicate) Database. Source the Environmental variables. (. Dup.env) Sqlplus ‘/as sysdba’ Startup nomount Exit Connect to RMAN: rman target sys/welcome@db01 catalog catalog/catalog@db02 auxiliary / Connected to rman....... CONFIGURE AUXILIARY NAME for all datafiles. using....
CONFIGURE AUXNAME FOR DATAFILE '/u01/oracle9i/oradata/db01/system01.dbf' TO '/u01/oracle9i/oradata/dup/system01.dbf'; CONFIGURE AUXNAME FOR DATAFILE '/u01/oracle9i/oradata/db01/undotbs01.dbf' TO '/u01/oracle9i/oradata/dup/undotbs01.dbf'; CONFIGURE AUXNAME FOR DATAFILE '/u01/oracle9i/oradata/db01/cwmlite01.dbf' TO '/u01/oracle9i/oradata/dup/cwmlite01.dbf'; CONFIGURE AUXNAME FOR DATAFILE '/u01/oracle9i/oradata/db01/drsys01.dbf' TO '/u01/oracle9i/oradata/dup/drsys01.dbf'; CONFIGURE AUXNAME FOR DATAFILE '/u01/oracle9i/oradata/db01/example01.dbf' TO '/u01/oracle9i/oradata/dup/example01.dbf'; CONFIGURE AUXNAME FOR DATAFILE '/u01/oracle9i/oradata/db01/indx01.dbf' TO '/u01/oracle9i/oradata/dup/indx01.dbf'; CONFIGURE AUXNAME FOR DATAFILE '/u01/oracle9i/oradata/db01/odm01.dbf' TO '/u01/oracle9i/oradata/dup/odm01.dbf'; CONFIGURE AUXNAME FOR DATAFILE '/u01/oracle9i/oradata/db01/tools01.dbf' TO '/u01/oracle9i/oradata/dup/tools01.dbf'; CONFIGURE AUXNAME FOR DATAFILE '/u01/oracle9i/oradata/db01/xdb01.dbf' TO '/u01/oracle9i/oradata/dup/xdb01.dbf'; From RMAN command prompt run the following command........ run { DUPLICATE TARGET DATABASE TO dup LOGFILE GROUP 1 ('/u01/oracle9i/oradata/dup/redo01.log') size 1m reuse, GROUP 2 ('/u01/oracle9i/oradata/dup/redo02.log') size 1m reuse, GROUP 3 ('/u01/oracle9i/oradata/dup/redo03.log') size 1m reuse; } Hence Cloning is done using RMAN.
Observations Processing........... Starting Duplicate Db at 12-APR-07 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: sid=12 devtype=DISK printing stored script: Memory Script { set until scn 529168;
set newname for datafile 1 to "/u01/oracle9i/oradata/dup/system01.dbf"; set newname for datafile 2 to "/u01/oracle9i/oradata/dup/undotbs01.dbf"; set newname for datafile 3 to "/u01/oracle9i/oradata/dup/cwmlite01.dbf"; set newname for datafile 4 to "/u01/oracle9i/oradata/dup/drsys01.dbf"; set newname for datafile 5 to "/u01/oracle9i/oradata/dup/example01.dbf"; set newname for datafile 6 to "/u01/oracle9i/oradata/dup/indx01.dbf"; set newname for datafile 7 to "/u01/oracle9i/oradata/dup/odm01.dbf"; set newname for datafile 8 to "/u01/oracle9i/oradata/dup/tools01.dbf"; set newname for datafile 10 to "/u01/oracle9i/oradata/dup/xdb01.dbf"; restore check readonly clone database ; } executing script: Memory Script executing command: SET until clause Starting restore at 12-APR-07 using channel ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: starting datafile backupset restore channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set restoring datafile 00001 to /u01/oracle9i/oradata/dup/system01.dbf restoring datafile 00002 to /u01/oracle9i/oradata/dup/undotbs01.dbf restoring datafile 00003 to /u01/oracle9i/oradata/dup/cwmlite01.dbf restoring datafile 00004 to /u01/oracle9i/oradata/dup/drsys01.dbf restoring datafile 00005 to /u01/oracle9i/oradata/dup/example01.dbf restoring datafile 00006 to /u01/oracle9i/oradata/dup/indx01.dbf restoring datafile 00007 to /u01/oracle9i/oradata/dup/odm01.dbf restoring datafile 00008 to /u01/oracle9i/oradata/dup/tools01.dbf restoring datafile 00010 to /u01/oracle9i/oradata/dup/xdb01.dbf channel ORA_AUX_DISK_1: restored backup piece 1 piece handle=/u01/oracle9i/rmanbackup/0nieum30 tag=TAG20070412T011824 params=NULL channel ORA_AUX_DISK_1: restore complete Finished restore at 12-APR-07
printing stored script: Memory Script { set until scn 529168; recover clone database delete archivelog ; } executing script: Memory Script executing command: SET until clause Starting recover at 12-APR-07 using channel ORA_AUX_DISK_1 printing stored script: Memory Script { Alter clone database open resetlogs; } executing script: Memory Script database opened Finished Duplicate Db at 12-APR-07.