Duplicate Database example In the following example of active database duplication, a connection is established to three database instances, all through the use of net service names:
RMAN> CONNECT TARGET SYS/sysdba@prod; # source databaseconnected to target database: PROD (DBID=39525561)RMAN> CONNECT AUXILIARY SYS/sysdba@dupdb; # duplicate database instanceconnected to auxiliary database: DUPDB (not mounted)RMAN> CONNECT CATALOG rman/rman@catdb; # recovery catalog databaseconnected to recovery catalog databaseTo duplicate a database to a remote host with the same directory structure
========================================================== ====================================== How to perform active duplication when the SPFILE clause is specified. DUPLICATE requires the NOFILENAMECHECK option because the source database files have the same names as the duplicate database files.
DUPLICATE TARGET DATABASE TO dupdb FROM ACTIVE DATABASE PASSWORD FILE SPFILE NOFILENAMECHECK;
The password file option specifies that RMAN shocould copy the password file to the destination host. RMAN automatically copies the server parameter file to the destination host, starts the auxiliary instance with the server parameter file, copies all necessary database files and archived redo logs over the network to the destination host, and recovers the database. finally, RMAN opens the database with the RESETLOGS option to create the online redo log. backup-Based Duplication With a Target Connection ================================ ========================
DUPLICATE TARGET DATABASE TO dupdb SPFILE NOFILENAMECHECK UNTIL TIME 'SYSDATE-7';Backup-Based Duplication Without a Target and a Recovery Catalog Connection
===========================================================================DUPLICATE DATABASE TO dupdb UNTIL TIME "TO_DATE('11/01/2007 14:00:00', 'MM/DD/YYYY HH24:MI:SS')" SPFILE BACKUP LOCATION '/prod_backups' NOFILENAMECHECK;%bSpecifies the file name stripped of directory paths. For example, if a datafile is named /oradata/prod/financial.dbf, then %b results in financial.dbf.%fSpecifies the absolute file number of the datafile for which the new name is generated. For example, if datafile 2 is duplicated, then %f generates the value 2.%ISpecifies the DBID.%NSpecifies the tablespace name.%USpecifies the following format: data-D-%d_id-%I_TS-%N_FNO-%f..../system01.dbf SYSTEM 1 /oradata/data-D-PROD_id-87650928_TS-SYSTEM_FNO-1RUN { SET NEWNAME FOR TABLESPACE users TO '/oradata%f/%b'; SET NEWNAME FOR DATAFILE 1 TO '/oradata1/system01.dbf'; SET NEWNAME FOR DATAFILE 2 TO '/oradata2/sysaux01.dbf'; SET NEWNAME FOR DATAFILE 3 TO '/oradata3/undotbs01.dbf'; SET NEWNAME FOR TEMPFILE 1 TO '/oradatat/temp01.dbf'; DUPLICATE TARGET DATABASE TO dupdb SKIP TABLESPACE tools LOGFILE GROUP 1 ('/duplogs/redo01a.log', '/duplogs/redo01b.log') SIZE 4M REUSE, GROUP 2 ('/duplogs/redo02a.log', '/duplogs/redo02b.log') SIZE 4M REUSE;}