Showing posts with label Duplicate Database in Oracle. Show all posts
Showing posts with label Duplicate Database in Oracle. Show all posts

Monday 29 December 2014

Step by Step Duplicate a Database Using RMAN in Oracle Database 11g Release 2

Step 1: start Database in nomount mode using parameter file

SQL>startup nomount pfile='/tmp/stldb.ora';

Step 2: Restore control file using following command

RMAN>RESTORE CONTROLFILE from  '/source/app/oracle/fast_recovery_area/DB11G/Full_control_stldb_20141221_1724_866861424_1.ctl';

Step 3: Mount Database using following command

RMAN>alter database mount;

Step 4: Catalog the backup pieces which need to restore

RMAN>CATALOG START WITH '/source/app/oracle/fast_recovery_area/DB11G/';

Step 5: We can then duplicate the database using one of the following commands.

# Backup files are in matching location to that on the source server.
# Duplicate database to TARGET's current state.
DUPLICATE TARGET DATABASE TO DB11G
  SPFILE
  NOFILENAMECHECK;

# Duplicate database to TARGET's state 4 days ago.
DUPLICATE TARGET DATABASE TO DB11G
  UNTIL TIME 'SYSDATE-4'
  SPFILE
  NOFILENAMECHECK;

# Backup files are in a different location to that on the source server.
# Duplicate database to the most recent state possible using the provided backups.
# Works with just an AUXILIARY connection only.
DUPLICATE DATABASE TO DB11G
  SPFILE
  BACKUP LOCATION '/source/app/oracle/fast_recovery_area/DB11G'
  NOFILENAMECHECK;

or

DUPLICATE DATABASE TO DB11G
UNTIL TIME "TO_DATE('08/21/2014 02:41:47','MM/DD/YYYY HH24:MI:SS')"
BACKUP LOCATION '/source/app/oracle/fast_recovery_area/DB11G' NOFILENAMECHECK NORESUME;  
  

The time it takes to complete varies depending on the size of the database and the specification of the server. Once the process is finished RMAN produces a completion message and you have your duplicate instance.  
  

Ref: http://oracle-base.com/articles/11g/duplicate-database-using-rman-11gr2.php