RMAN provides the DUPLICATE command , which uses the backups of a databse to create a new database. The files are restored to the target database, after which an incomplete recovery is performed and the new database is opened with the OPEN RESETLOGS command.
The good thing about using RMAN is that all the preceding steps are performed automatically,without any user intervention.
The duplicate database can be the exact replica of the original,or it can contain only a subset of it.
The following steps are involved in cloning a database:
1) Create a new init.ora file for the auxillary database. The init.ora file should have the following parameters, with the data files and log files parameters changed to ensure that the original database files aren't used for the new database:
DB_FILE_NAME_CONVERT :
This parameter transforms the target data file names to the duplicate database data file names.
LOG_FILE_NAME_CONVERT :
This parameter converts the target database redo log file names to the duplicate database redo log file names.
2) Start the taarget database instance. We must start the target database instance in the nomount mode
3) Connect the recovery catalog to the target database and auxillary database
RMAN> CONNECT target / catalog rman/rman@catalog_db auxillary
4) Issue the RMAN DUPLICATE command as follows :
RMAN> DUPLICATE TARGET DATABASE TO
auxillary_db /* actual name of auxillary database here */
pfile=/u01/app/oracle/10.2.0/db_1/dbs/init_auxillary_db;
The preceding is a simplified presentation of the database duplication process using RMAN.
When we issue DUPLICATE TARGET DATABASE TO.....command RMAN will shutdown the auxillary database and start it up again. It then performs the following steps:
1) Restores all the backed up files of the target database to the destination auxillary database, using all available archived redo logs
2) Opens the duplicated database with the RESETLOGS option