- By using the RMAN DUPLICATE command
- By using the OEM Database Control
- By manually performing the copy with SQL
RMAN provides the DUPLICATE command, which uses the backups of a database to create a newdatabase. The files are restored to the target database, after which an incomplete recovery is performedand the new database is opened with the OPEN RESETLOGS command.
- Create a new init.ora file for the auxiliary database. The init.ora file should have the following parameters, with the data files and log file parameters changed to ensure that theoriginal database files arent used for the new database:
- DB_FILE_NAME_CONVERT
- LOG_FILE_NAME_CONVERT - Start the target database instance.
SQL > startup nomount - Connect the recovery catalog to the target database and the auxiliary database
RMAN > CONNECT target / catalog rman/rman1@catalog_db auxiliary sys/password@auxiliary_db - Issue the RMAN DUPLICATE command, as follows:
RMAN> DUPLICATE TARGET DATABASE TO auxiliary_db
pfile =/u01/app/oracle/10.2.0/db_1/dbs/init_auxiliary_db; - Opens the duplicated database with the RESETLOGS
SQL> alter database open resetlogs
To clone a database manually, you need to first use the operating system to copy all of the source database files to the target location.
- Copy the prod database files to the target location.
- Prepare a text file for the creation of a control file for the new database as follows:
SQL> ALTER DATABASE BACKUP CONTROLFILE TO TRACE RESETLOGS;
- On the target location, create all the directories for the various files.
- change SID, path, of the backup control trace file controlfile_open.sql
- Run the following command
SQL> startup nomount;
SQL> @controlfile_open.sql