Duplicate Database example
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 database connected to target database: PROD (DBID=39525561) RMAN> CONNECT AUXILIARY SYS/sysdba@dupdb; # duplicate database instance connected to auxiliary database: DUPDB (not mounted) RMAN> CONNECT CATALOG rman/rman@catdb; # recovery catalog database connected to recovery catalog database To 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 should 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; %b Specifies the file name stripped of directory paths. For example, if a datafile is named /oradata/prod/financial.dbf, then %b results in financial.dbf. %f Specifies 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. %I Specifies the DBID. %N Specifies the tablespace name. %U Specifies 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-1 RUN { 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; }