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

Creating a Duplicate Database on a Local or Remote Host

The procedure to create a duplicate database depends on your configuration. This section contains the following topics:

Duplicating a Database on a Remote Host with the Same Directory Structure

The simplest case is to duplicate the database to a different host and to use the same directory structure. In this case, you do not need to change the initialization parameter file or set new filenames for the duplicate datafiles.

  1. Follow the steps in "Preparing the Auxiliary Instance for Duplication: Basic Steps".

  2. Run the DUPLICATE command, making sure to do the following:

    • If automatic channels are not configured, then allocate at least one auxiliary channel.

    • Specify the NOFILENAMECHECK parameter on the DUPLICATE command.

    • Specify the PFILE parameter if starting the auxiliary instance with a client-side parameter file. The client-side parameter file must exist on the same host as the RMAN client used to perform the duplication.

    The following example assumes that the RMAN client is running on the duplicate host. It duplicates the database with an automatic channel, specifies a client-side initialization parameter file, and specifies the NOFILENAMECHECK option:

    DUPLICATE TARGET DATABASE TO dupdb
      # specify client-side parameter file (on same host as RMAN client) for
      # auxiliary instance if necessary
      PFILE = /dup/oracle/dbs/initDUPDB.ora
      NOFILENAMECHECK;
    
    

RMAN automatically allocates the configured channels, then uses all incremental backups, archived redo log backups, and archived redo logs to perform incomplete recovery. Finally, RMAN opens the database with the RESETLOGS option to create the online redo logs.

Duplicating a Database on a Remote Host with a Different Directory Structure

If you create the duplicate database on a host with a different directory structure, then you must change several initialization parameters in order to generate new filenames for the duplicate database datafiles on the new directory structure. The different techniques available are described in "Renaming Datafiles When Duplicating a Database".

Converting Filenames with Only Initialization Parameters

This procedure assumes that you use only initialization parameters to rename the duplicate datafiles and log files.

  1. Follow the steps in "Preparing the Auxiliary Instance for Duplication: Basic Steps". You can either create a client-side parameter file, or copy the parameter file from its location in the target host directory structure to the same location in the duplicate host directory structure using operating system utilities.

    Perform the following tasks:

    • Review all initialization parameters that end in _DEST and specify a path name. Some may need to be changed.

    • Set DB_FILE_NAME_CONVERT so that it captures all the target datafiles and converts them appropriately, for example, from /oracle/oradata/ to /dup/oracle/oradata/.

    • Set LOG_FILE_NAME_CONVERT so that it captures all the online redo logs and converts them appropriately, for example, /oracle/oradata/redo to /dup/oracle/oradata/redo.


      Note:

      You can set multiple conversion pairs in DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT. For example, you can specify that DB_FILE_NAME_CONVERT changes /disk1/dbs to /dup1/dbs and /disk2/dbs to /dub2/dbs.

      While this scenario uses DB_FILE_NAME_CONVERT, you can use the CONFIGURE AUXNAME or SET NEWNAME commands to rename individual datafiles if you cannot easily generate all of your desired filenames using DB_FILE_NAME_CONVERT commands. As described in "Duplicating a Database to an Oracle Managed Files Storage Location", you can also duplicate your database to an Oracle Managed Files location and let the database generate names for your files.

  2. Perform the following operations when running the duplication:

    • If automatic channels are not configured, then allocate at least one auxiliary channel.

    • If using a client-side parameter file to start the auxiliary instance, specify the PFILE parameter.

Converting Filenames with Only Initialization Parameters: Example

The following example assumes that the duplicate host can access the same media manager as the primary database host. The example duplicates the database with an automatic sbt channel and uses a server-side parameter file located on the duplicate host to restart the auxiliary instance:

DUPLICATE
  TARGET DATABASE TO dupdb
  DEVICE TYPE sbt # restores from tape backups;
# DUPLICATE DEVICE TYPE sbt works only if the sbt device is configured
# by CONFIGURE CHANNEL, CONFIGURE DEVICE TYPE, or CONFIGURE DEFAULT DEVICE.

RMAN uses all incremental backups, archived redo log backups, and archived redo logs to perform incomplete recovery. RMAN then shuts down, starts, and opens the database with the RESETLOGS option to create the online redo logs.

Converting Filenames with Only DUPLICATE Parameters

This procedure assumes that you use the DB_FILE_NAME_CONVERT parameter of the DUPLICATE command to rename the duplicate datafiles, and the LOGFILE clause to specify names and sizes for the online redo logs.

Perform the following operations when running the duplication:

  • If automatic auxiliary channels are not configured, then allocate at least one auxiliary channel.

  • Specify the names and sizes for the duplicate database redo logs in the LOGFILE clause.

  • Specify new filenames for the duplicate database datafiles with the DB_FILE_NAME_CONVERT parameter.

  • If using a client-side parameter file to start the auxiliary instance, specify the PFILE parameter.

Converting Filenames with Only DUPLICATE Parameters: Example

The following example duplicates the database with an automatic channel and specifies an initialization parameter file:

DUPLICATE TARGET DATABASE TO dupdb
  # specify client-side parameter file for auxiliary instance if necessary
  PFILE = /dup/oracle/dbs/initDUPDB.ora
  DB_FILE_NAME_CONVERT=(/oracle/oradata/trgt/,/dup/oracle/oradata/trgt/)
  LOGFILE
    '/dup/oracle/oradata/trgt/redo01.log' SIZE 200K,
    '/dup/oracle/oradata/trgt/redo02.log' SIZE 200K,
    '/dup/oracle/oradata/trgt/redo03.log' SIZE 200K;

Converting Filenames with SET NEWNAME

This procedure assumes that you use the SET NEWNAME command to rename the duplicate datafiles.

  1. Follow the steps in "Preparing the Auxiliary Instance for Duplication: Basic Steps", making sure to use an operating system utility to copy the parameter file from its location in the target host directory structure to the same location in the duplicate host. Set all initialization parameters that end in _DEST and specify a path name.

  2. Perform the following operations when running the duplication:

    • If automatic auxiliary channels are not configured, then allocate at least one auxiliary channel.

    • If desired, specify the same number of redo log members and groups that are used in the target database.

    • Specify new filenames for the duplicate database datafiles.

    • If you use a client-side parameter file to start the auxiliary instance, then specify the PFILE parameter.

    The following example uses automatic channels and a default server-side initialization parameter file for the database duplication, and uses the LOGFILE clause to specify names and sizes for the online redo logs:

    RUN
    {
      # set new filenames for the datafiles
      SET NEWNAME FOR DATAFILE 1 TO '/dup/oracle/oradata/trgt/system01.dbf'; 
      SET NEWNAME FOR DATAFILE 2 TO '/dup/oracle/oradata/trgt/undotbs01.dbf'; 
      . . .
      # issue the duplicate command
      DUPLICATE TARGET DATABASE TO dupdb
      # create at least two online redo log groups
      LOGFILE
        GROUP1
        (
          '/dup/oracle/oradata/trgt/redo01a.log',
          '/dup/oracle/oradata/trgt/redo01b.log',
          '/dup/oracle/oradata/trgt/redo01c.log';
        ) SIZE 200K,
        GROUP2
        (
          '/dup/oracle/oradata/trgt/redo02a.log',
          '/dup/oracle/oradata/trgt/redo02b.log',
          '/dup/oracle/oradata/trgt/redo02c.log';
        ) SIZE 200K,
        GROUP3
        (
          '/dup/oracle/oradata/trgt/redo03a.log',
          '/dup/oracle/oradata/trgt/redo03b.log',
          '/dup/oracle/oradata/trgt/redo03c.log';
        ) SIZE 200K;
    
    

RMAN uses all incremental backups, archived redo log backups, and archived redo logs to perform incomplete recovery. RMAN shuts down, starts up, and then opens the database with the RESETLOGS option to create the online logs.

Converting Filenames with CONFIGURE AUXNAME

This procedure assumes that you use the CONFIGURE AUXNAME command to rename the duplicate datafiles.

  1. Follow the steps in "Preparing the Auxiliary Instance for Duplication: Basic Steps", making sure to use an operating system utility to copy the parameter file from its location in the target host directory structure to the same location in the duplicate host directory structure. Set all initialization parameters that end in _DEST and specify a path name.

  2. Add the following features when creating the RMAN commands to perform the duplication:

    • Prepare CONFIGURE AUXNAME commands for all datafiles, to be executed before database duplication.

    • If automatic auxiliary channels are not allocated, then allocate at least one auxiliary channel.

    • Use a LOGFILE clause to specify redo log groups and members for the duplicate database. (You do not have to use the same number of redo log groups or redo log group members in the duplicate database as you did in the target database.)

    • If you start the auxiliary instance with a client-side parameter file, then specify the PFILE parameter. The client-side parameter file must reside on the same host as the RMAN client used to perform the duplication.

Example 13-2 uses CONFIGURE AUXNAME to set new datafile names, uses automatic channels and a client-side initialization parameter file for the database duplication, and uses the LOGFILE clause to specify names and sizes for the online redo logs.

Example 13-2 Using CONFIGURE AUXNAME to Generate Database Filenames

# configure the new desired filenames
 CONFIGURE AUXNAME FOR DATAFILE 1 
        TO '/dup/oracle/oradata/trgt/system01.dbf'; 
 CONFIGURE AUXNAME FOR DATAFILE 2 
        TO '/dup/oracle/oradata/trgt/undotbs01.dbf'; 
# ... add more CONFIGURE AUXNAME commands as needed 

# run the DUPLICATE command
DUPLICATE TARGET DATABASE TO dupdb
# specify client-side parameter file for auxiliary instance if necessary
PFILE = /dup/oracle/dbs/initDUPDB.ora
.
.
.
# create at least two online redo log groups
 LOGFILE
    GROUP1
    (
      '/dup/oracle/oradata/trgt/redo01a.log',
      '/dup/oracle/oradata/trgt/redo01b.log',
      '/dup/oracle/oradata/trgt/redo01c.log';
    ) SIZE 200K,
    GROUP2
    (
      '/dup/oracle/oradata/trgt/redo02a.log',
      '/dup/oracle/oradata/trgt/redo02b.log',
      '/dup/oracle/oradata/trgt/redo02c.log';
    ) SIZE 200K,
    GROUP3
    (
      '/dup/oracle/oradata/trgt/redo03a.log',
      '/dup/oracle/oradata/trgt/redo03b.log',
      '/dup/oracle/oradata/trgt/redo03c.log';
    ) SIZE 200K;

RMAN uses all incremental backups, archived redo log backups, and archived redo logs to perform incomplete recovery and then opens the database with the RESETLOGS option to create the online redo logs.

After the duplication is complete, clear the configured auxiliary names for the datafiles in the duplicate database, so that they are not overwritten by mistake. For example, enter the following:

# un-specify auxiliary names for the datafiles
CONFIGURE AUXNAME FOR DATAFILE 1 CLEAR; 
CONFIGURE AUXNAME FOR DATAFILE 2 CLEAR; 
.
.
.

Creating a Duplicate Database on the Local Host

When creating a duplicate database on the same host as the target database, follow the same procedure as for duplicating to a remote host with a different directory structure as described in "Duplicating a Database on a Remote Host with a Different Directory Structure".

You can duplicate the database to the same Oracle home as the target database, but you must use a different database name from the target database, and convert the filenames by means of the same methods used for conversion on a separate host.


Caution:

Do not use the NOFILENAMECHECK option when duplicating to the same Oracle home as the primary database. If you do, then the DUPLICATE command may overwrite the datafiles of the target database.

Duplicating a Database to an Oracle Managed Files Storage Location

When creating a duplicate or standby database to an Oracle Managed Files (OMF) location, then you must set the initialization parameters correctly on the new database. The settings depend on whether all or only some files are stored in OMF.

This section contains the following topics:

Duplicating a Database When All Files Are Oracle Managed Files

When storing all files for the duplicate database in OMF, you must follow these rules:

  • Do not set the CONTROL_FILES initialization parameter if you want control files as Oracle Managed Files. It is recommended that you use an SPFILE at the duplicate database when using Oracle Managed Files for the control file.

  • Do not set the DB_FILE_NAME_CONVERT initialization parameter and do not use the DB_FILE_NAME_CONVERT parameter on the DUPLICATE command.

  • Do not set the LOG_FILE_NAME_CONVERT initialization parameter and do not use the LOGFILE parameter on the DUPLICATE command.

  • For a duplicate database that is not a standby database, change the value of the DB_NAME initialization parameter. For a standby database, keep DB_NAME the same, but change the DB_UNIQUE_NAME initialization parameter.

  • Set the DB_CREATE_FILE_DEST initialization parameter to the desired Oracle Managed Files storage location. The database files are created in the specified location during DUPLICATE.

  • If duplicating for standby, set STANDBY_FILE_MANAGEMENT to AUTO.

After verifying the preceding settings, you must decide the following:

  • How many copies of the control file are needed

  • How many online redo logs members are needed

  • Whether the online redo log and control file locations should be different from the datafile locations

As shown in Table 13-8, the previous decisions determine whether you use the Oracle Managed Files initialization parameters DB_RECOVERY_FILE_DEST, DB_CREATE_FILE_DEST, or DB_CREATE_ONLINE_DEST_n.

Table 13-8 Oracle Managed Files Initialization Parameter Settings

Copies of control files and online redo logs Control file, online log, and datafile locations Initialization parameter
n, where n is 3 or more Same or different DB_CREATE_ONLINE_LOG_DEST_n
n, where n is 1 or more Different DB_CREATE_ONLINE_LOG_DEST_n
2 Same DB_RECOVERY_FILE_DEST
1 Same DB_CREATE_FILE_DEST

Duplicating a Database When a Subset of Files Are Oracle Managed Files

The target database may have some but not all files in Oracle Managed Files storage. A different case is when the target database has datafiles in multiple Oracle Managed Files locations and you want to preserve the structure of the target database on the duplicate database site. For example, consider the following scenarios:

  • Some datafiles are stored on a fast ASM disk group +fast whereas others are stored on a slower ASM disk group +slow. You can duplicate the database while preserving that distribution across a second fast disk group +fast2 and a second slow disk group +slow2.

  • You want to duplicate a database with a different name in the same disk group, for example duplicating +dgroup/boston to +dgroup/sfo, where boston is the DB_UNIQUE_NAME of the primary database and sfo is the DB_UNIQUE_NAME of the duplicate database.

In the previous cases, you can use the DB_FILE_NAME_CONVERT and LOG_FILE_NAME_CONVERT initialization parameters to change the middle portion of the file paths for the database files and online redo logs, instead of changing the left-hand portion of the name. The RMAN command to duplicate the database does not change. You must make the following initialization parameter changes at the auxiliary database:

  • Set a different DB_NAME (for a duplicate database) or a different DB_UNIQUE_NAME (for a standby database).

  • Set LOG_FILE_NAME_CONVERT and DB_FILE_NAME_CONVERT to convert the filenames.

  • Modify the CONTROL_FILES initialization parameter to specify the new control files.

Alternatively, use the RMAN command SET NEWNAME FOR DATAFILE ... TO NEW to create the specified datafiles as an Oracle Manage Files. This technique is similar to the scenario described in "Converting Filenames with SET NEWNAME". When you run SET NEWNAME, RMAN creates an Oracle Managed File for the specified datafile by means of the DB_CREATE_FILE_DEST initialization parameter setting on the auxiliary instance. Similarly, you can run SET NEWNAME FOR TEMPFILE ... TO NEW to create a tempfile as an Oracle Managed File.

Duplicating a Database to an Automatic Storage Management Environment

The procedure for creating a duplicate database to an Automatic Storage Management (ASM) location is similar to the procedure described in "Duplicating a Database When All Files Are Oracle Managed Files". The difference is that you must edit the initialization parameter file in the auxiliary instance to set the DB_CREATE_FILE_DEST parameter to an ASM disk group.

For example, edit the auxiliary initialization parameter file as follows to create the database files in the disk group disk1:

*.DB_CREATE_FILE_DEST = '+disk1'