5 1 0:Oracle Duplicate Database

From SEPsesam
Other languages:


Docs latest icon.png Welcome to the latest SEP sesam documentation version 5.1.0 Apollon. For previous documentation version(s), check documentation archive.


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).

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

  1. 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;
     }
  2. Invoke RMAN to duplicate the database. RMAN must get the metadata either from SOURCE or the RMAN catalog and must be connected to the new database RESTORE. There are several ways to get the metadata depending on the backup strategy (e.g., ORACLE_SID is set to RESTORE):
  3. 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 /
  4. Execute the script from RMAN: @duplicate_SOURCE.rman
SEP Tip.png 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 RestoreOracle Requirements and ConfigurationOracle Backup

External references

Copyright © SEP AG 1999-2024. All rights reserved.
Any form of reproduction of the contents or parts of this manual is allowed only with the express written permission from SEP AG. When compiling and designing user documentation SEP AG uses great diligence and attempts to deliver accurate and correct information. However, SEP AG cannot issue a guarantee for the contents of this manual.