4 4 3:Oracle Duplicate Database

From SEPsesam
Jump to: navigation, search
Draft.png WORK IN PROGRESS
This page is a draft. Treat the information on this page with caution as it may be incomplete.

Copyright © SEP AG 1999-2020. 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.

Docs latest icon.png Welcome to the latest SEP sesam documentation version 4.4.3/4.4.3 Beefalo V2. For previous documentation version(s), check Oracle 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 from an any active database. The purpose of database duplication is the creation of a duplicate database, which is a separate database that contains all or a subset of the data from the source database. A duplicate database is useful for a different purposes, such as testing, etc.

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 from the source database and functions independently.

Prerequisites

You must meet a following prerequisites before duplicating a database:

  • 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 connectivity to the new instance must be set up either by 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.
  • Successful executed backups of database SOURCE must exist with RMAN backup catalog or with storing backup history to database SOURCE's controlfile (RMAN nocatalog).

Duplicating a database from the backup

This section briefly describes the duplication of the database SOURCE to the database RESTORE. For more information, see Oracle Restore.

Steps

  1. Create a RMAN command file for the duplicating 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 may use the output of RMAN report schema.
    • The syntax for the logfile options is the same used in 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';
    ser 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 from either 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
    Metadata comes from target database controlfile: $ rman TARGET sys/password@SOURCE AUXILIARY /
    Catalog, but no target
    Metadata comes from the RMAN catalog: $ rman CATALOG rman/password@rman-catalog AUXILIARY /
    Target and catalog
    Metadata can come from the target controlfile or the catalog: $ rman TARGET sys/password@SOURCE CATALOG rman/password@rman-catalog AUXILIARY /
    No target or catalog
    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 such case RMAN does not create a unique DBID and does not open the database.