5 2 0:Oracle Duplicate Database
Overview
The procedures and features explained herein provide only information about the SEP sesam-specific parts of Oracle duplicate database. For detailed information on Oracle-specific backup and recovery, see Oracle database documentation.
RMAN has the ability to duplicate a database from a backup or any active database. The purpose of database duplication is to create a duplicate database, which is a separate database that contains all or only a subset of the data from the source database. A duplicate database is useful for different purposes, such as testing.
You can create a duplicate database by using the RMAN DUPLICATE command. The duplicate database is the copied database, where the database that you are copying is the source database. The copied database has a different DBID than the source database and functions independently.
Prerequisites
Before duplicating a database, make sure the following prerequisites are met:
- Both databases must be located on the same ORACLE host under separate instances SOURCE and RESTORE with different paths or on the separate hosts.
- The instance for the RESTORE must be set up.
- Operating system authentication or password files.
- Initialization parameter files PFILE or SPFILE (init....ora file for the instance RESTORE).
- The necessary directories for the datafiles, archived redo logs and dump destinations must exist.
- The new instance RESTORE must be started (startup nomount).
- The connection to the new instance must be established either via the environment variable ORACLE_SID=RESTORE or
- $ORACLE_HOME/network/admin/listener.ora with an entry for RESTORE.
- $ORACLE_HOME/network/admin/tnsnames.ora with an entry for RESTORE.
- The SQL*Net listener must be reloaded, e.g., by the command lsnrctl reload.
- Successfully executed backups of the database SOURCE must exist with the RMAN backup catalog or with storing the backup history to the database SOURCE's controlfile (RMAN nocatalog).
- Full backup of datafiles with control file (RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON)
- Archived redo log backup
Duplicating a database from the backup
This section briefly describes how to duplicate the SOURCE database to the RESTORE database. For more information, see Oracle Restore.
Steps
- Create an RMAN command file for the duplication process (e.g., duplicate_SOURCE.rman).
- Set the type to 'SBT' (or 'SBT_TAPE') and set the 'parms ENV=(...)' to the SEP sesam backup task specific values.
- The keyword auxiliary in the allocate channel command specifies a connection between RMAN and the new instance RESTORE.
- set newname is used to rename datafiles and tempfiles during the restore. To produce a list of file IDs and filenames, you can use the output of the RMAN report schema.
- The syntax for the logfile options is the same as for the create database command.
Example:
run { allocate auxiliary channel t1 type 'SBT' parms 'ENV=(SESAM_SERVER=qsstor,SESAM_JOB=ORACLE_SOURCE,SESAM_DRIVE=,SESAM_POOL=7days,SOB_TRACE=0,SOB_LOGFILE=/tmp/restore.log)'; set newname for datafile 1 to '/opt/oracle/restore/RESTORE/system01.dbf'; set newname for datafile 2 to '/opt/oracle/restore/RESTORE/sysaux01.dbf'; set newname for datafile 3 to '/opt/oracle/restore/RESTORE/undotbs01.dbf'; set newname for datafile 4 to '/opt/oracle/restore/RESTORE/users01.dbf'; set newname for datafile 5 to '/opt/oracle/restore/RESTORE/example01.dbf'; set newname for datafile 6 to '/opt/oracle/restore/RESTORE/sesamdata.dbf'; set newname for tempfile 1 to '/opt/oracle/restore/RESTORE/tempfile01.dbf'; duplicate target database to 'RESTORE' logfile '/opt/oracle/restore/RESTORE/redo01.log' SIZE 50M, '/opt/oracle/restore/RESTORE/redo02.log' SIZE 50M, '/opt/oracle/restore/RESTORE/redo03.log' SIZE 50M; }
- Target, but no catalog
- The metadata comes from the target database controlfile: $ rman TARGET sys/password@SOURCE AUXILIARY /
- Catalog, but no target
- The metadata comes from the RMAN catalog: $ rman CATALOG rman/password@rman-catalog AUXILIARY /
- Target and catalog
- The metadata comes either from the target controlfile or the catalog: $ rman TARGET sys/password@SOURCE CATALOG rman/password@rman-catalog AUXILIARY /
- No target or catalog
- The metadata comes from backups: $ rman AUXILIARY /
Tip | |
To duplicate a database for standby, the DUPLICATE command must be used with the FOR STANDBY clause. In this case, RMAN does not create a unique DBID and does not open the database. |
See also
Oracle Restore – Oracle Requirements and Configuration – Oracle Backup
External references
- Duplicating a Database with Recovery Manager
- Duplicating a Database
- The Duplicate entry in Oracle Database Backup and Recovery Reference
- Creating a Standby Database with Recovery Manager
- Duplicate a Database Using RMAN in Oracle Database