Skip Headers
Oracle® Database Backup and Recovery Advanced User's Guide
10g Release 2 (10.2)

Part Number B14191-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

Using DUPLICATE DATABASE to Resynchronize a Duplicate Database: Example

You may want to synchronize a duplicate database with the original database that was duplicated. The solution is to run the DUPLICATE DATABASEcommand again, essentially re-creating the duplicate database.This technique requires making complete copies of the datafiles of the duplicate database.

In this example, RMAN connects to the database on host_src as its target database and the duplicate database on host_dup as an auxiliary database. The example uses the DUPLICATE DATABASE command to transfer complete copies of all updated datafiles from the source database to the duplicate site.

This example makes the same assumptions about file names, locations, and the datafiles to be duplicated in "Duplicating When the Datafiles Use Inconsistent Paths: Example".

As an initial setup step, the CONFIGURE command is used to set persistent new names for the datafiles. These new names are recorded in the control file and used every time you perform the duplication in the future.

Using CONFIGURE AUXNAME to Specify Names for Duplicate Database Datafiles

The script shown in Example 13-4 performs the one-time setup of the names for the datafiles.

Example 13-4 Configuring Auxiliary Names for Datafiles

# start RMAN and then connect to the target and auxiliary databases     
CONNECT TARGET /;
CONNECT CATALOG rman/cat@catdb;
CONNECT AUXILIARY SYS/oracle@dupdb;

# configure auxiliary names for the datafiles only once     
CONFIGURE AUXNAME FOR DATAFILE 1 TO '/oradata1/system01.dbf'; 
CONFIGURE AUXNAME FOR DATAFILE 2 TO '/oradata2/undotbs01.dbf'; 
CONFIGURE AUXNAME FOR DATAFILE 3 TO '/oradata3/cwmlite01.dbf'; 
CONFIGURE AUXNAME FOR DATAFILE 4 TO '/oradata4/drsys01'; 
CONFIGURE AUXNAME FOR DATAFILE 5 TO '/oradata5/example01.dbf'; 
CONFIGURE AUXNAME FOR DATAFILE 6 TO '/oradata6/indx01.dbf';
# Do not set a newname for datafile 7, because it is in the tools tablespace,
# and in this example you are excluding tools from the duplicate database.
CONFIGURE AUXNAME FOR DATAFILE 8 TO '/oradata7/users01.dbf'; 

Syncrhonizing the Duplicate With the Source Using Configured Auxnames

Run the script in Example 13-5 whenever you want to synchronize the duplicate with the source database. For example, you might run the script daily or weekly.

Example 13-5 Reduplicating the Database

# start RMAN and then connect to the target and auxiliary databases     
CONNECT TARGET /;
CONNECT CATALOG rman/cat@catdb;
CONNECT AUXILIARY SYS/oracle@dupdb;

# Create the duplicate database. Run the same command periodically
# to re-create the database, thereby keeping the duplicate 
# in sync with the target.
DUPLICATE TARGET DATABASE TO dupdb
SKIP TABLESPACE tools
  LOGFILE
    GROUP 1 ('/duplogs/redo01a.log', 
             '/duplogs/redo01b.log') SIZE 200K REUSE, 
    GROUP 2 ('/duplogs/redo02a.log', 
             '/duplogs/redo02b.log') SIZE 200K REUSE;