Skip Headers
Oracle® Database Backup and Recovery User's Guide
11g Release 2 (11.2)

Part Number E10642-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
Contact Us

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

24 Duplicating a Database: Advanced Topics

This chapter explains advanced forms of database duplication that are not covered in Chapter 23, "Duplicating a Database."

This section contains the following topics:

Specifying Alternative Names for Duplicate Database Files

"Step 2: Choosing a Strategy for Naming Duplicate Files" explains the recommended strategy of using the same names for the duplicate and source database files. In all other cases, you must choose an alternative naming strategy for the duplicate files. The strategy you use depends on whether the source and duplicate databases use Oracle Managed Files (OMF) or Automatic Storage Manager (ASM).

If the source datafiles use OMF, then you cannot rename them using DB_FILE_NAME_CONVERT. "Using Non-ASM Storage" discusses the details and options of OMF managed datafiles.

Specifying Non-OMF/Non-ASM Alternative Names for Duplicate Database Files

This section explains how to specify names for the duplicate files when the following condition is true:

  • The source and auxiliary hosts either use different directory structures or use the same structure but you want to name the duplicate files differently.

Table 24-1 summarizes the formats available for naming each type of file.

Using SET NEWNAME to Name File System Datafiles and Tempfiles

As shown in Table 24-1, one way to name duplicate datafiles is to use the SET NEWNAME command before executing the DUPLICATE command. RMAN supports the following commands, listed in order of precedence:

  1. SET NEWNAME FOR DATAFILE and SET NEWNAME FOR TEMPFILE

  2. SET NEWNAME FOR TABLESPACE

  3. SET NEWNAME FOR DATABASE

The order of precedence means that SET NEWNAME FOR TABLESPACE specifies names for files not already named by SET NEWNAME FOR DATAFILE and SET NEWNAME FOR TEMPFILE, while SET NEWNAME FOR DATABASE specifies names for files not already named by SET NEWNAME FOR TABLESPACE, SET NEWNAME FOR DATAFILE or SET NEWNAME FOR TEMPFILE.

When using SET NEWNAME FOR DATAFILE, you can specify a full path as a literal, as in /oradata1/system01.dbf. When using SET with FOR DATABASE or FOR TABLESPACE, however, you must use at least one of the first three substitution variables summarized in Table 24-1 (%I and %N are optional).

Table 24-1 Substitution Variables for SET NEWNAME

Variable Summary

%b

Specifies the file name stripped of directory paths. For example, if a datafile is named /oradata/prod/financial.dbf, then %b results in financial.dbf.

%f

Specifies the absolute file number of the datafile for which the new name is generated. For example, if datafile 2 is duplicated, then %f generates the value 2.

%I

Specifies the DBID.

%N

Specifies the tablespace name.

%U

Specifies the following format: data-D-%d_id-%I_TS-%N_FNO-%f.


To use SET NEWNAME to specify new filenames:

  1. Follow steps 1 through 4 in "Basic Steps of Database Duplication".

  2. Within a RUN command, issue the SET NEWNAME command before issuing DUPLICATE.

    Example 24-1 illustrates a script that specifies new names for datafiles 1 through 5 and tempfile 1. The script does not set a new name for datafile 6 because it is in the tools tablespace, which is excluded from the duplicate database.

    Example 24-1 Duplicating with SET NEWNAME FOR DATAFILE

    RUN
    {
      SET NEWNAME FOR DATAFILE 1 TO '/oradata1/system01.dbf'; 
      SET NEWNAME FOR DATAFILE 2 TO '/oradata2/sysaux01.dbf';
      SET NEWNAME FOR DATAFILE 3 TO '/oradata3/undotbs01.dbf';
      SET NEWNAME FOR DATAFILE 4 TO '/oradata4/users01.dbf'; 
      SET NEWNAME FOR DATAFILE 5 TO '/oradata5/users02.dbf';
      SET NEWNAME FOR TEMPFILE 1 TO '/oradatat/temp01.dbf'; 
      DUPLICATE TARGET DATABASE TO dupdb
        SKIP TABLESPACE tools
        LOGFILE
          GROUP 1 ('/duplogs/redo01a.log', 
                   '/duplogs/redo01b.log') SIZE 4M REUSE, 
          GROUP 2 ('/duplogs/redo02a.log', 
                   '/duplogs/redo02b.log') SIZE 4M REUSE;
    }
    

    Example 24-2 is a variation of Example 24-1 and uses one SET NEWNAME command to name all datafiles in the tablespace users. Once the example completes, the filenames for tablespace users are set to: /oradata4/users01.dbf and /oradata5/users02.dbf.

    Example 24-2 Duplicating with SET NEWNAME FOR DATAFILE and FOR TABLESPACE

    RUN
    {
      SET NEWNAME FOR TABLESPACE users TO '/oradata%f/%b';
      SET NEWNAME FOR DATAFILE 1 TO '/oradata1/system01.dbf'; 
      SET NEWNAME FOR DATAFILE 2 TO '/oradata2/sysaux01.dbf';
      SET NEWNAME FOR DATAFILE 3 TO '/oradata3/undotbs01.dbf'; 
      SET NEWNAME FOR TEMPFILE 1 TO '/oradatat/temp01.dbf'; 
      DUPLICATE TARGET DATABASE TO dupdb
        SKIP TABLESPACE tools
        LOGFILE
          GROUP 1 ('/duplogs/redo01a.log', 
                   '/duplogs/redo01b.log') SIZE 4M REUSE, 
          GROUP 2 ('/duplogs/redo02a.log', 
                   '/duplogs/redo02b.log') SIZE 4M REUSE;
    }
    

    Example 24-3 is a variation of Example 24-1 and uses a single SET command to name all datafiles in the database.

    Example 24-3 Duplicating with SET NEWNAME FOR DATABASE

    RUN
    {
      SET NEWNAME FOR DATABASE TO '/oradata/%U'; 
      DUPLICATE TARGET DATABASE TO dupdb
        SKIP TABLESPACE tools
        LOGFILE
          GROUP 1 ('/duplogs/redo01a.log', 
                   '/duplogs/redo01b.log') SIZE 4M REUSE, 
          GROUP 2 ('/duplogs/redo02a.log', 
                   '/duplogs/redo02b.log') SIZE 4M REUSE;
    }
    

Assume the following:

  • DBID is 87650928

  • Database name is PROD

Table 24-2 Results from Example 24-3 SET NEWNAME DATABASE Command

Before SET NEWNAME DATABASE Tablespace Name Datafile File Number After SET NEWNAME DATABASE TO '/oradata/%U';

.../system01.dbf

SYSTEM

1

/oradata/data-D-PROD_id-87650928_TS-SYSTEM_FNO-1

.../sysaux01.dbf

SYSAUX

2

/oradata/data-D-PROD_id-87650928_TS-SYSAUX_FNO-2

.../undotbs01.dbf

UNDOTS

3

/oradata/data-D-PROD_id-87650928_TS-UNDOTS_FNO-3

.../users01.dbf

USERS

4

/oradata/data-D-PROD_id-87650928_TS-USERS_FNO-4

.../users02.dbf

USERS

5

/oradata/data-D-PROD_id-87650928_TS-USERS_FNO-5

.../temp01.dbf

TEMP

1

/oradata/data-D-PROD_id-87650928_TS-TEMP_FNO-1


See Also:

Oracle Database Backup and Recovery Reference for details on substitution variables usable in SET NEWNAME

Using CONFIGURE AUXNAME to Name File System Datafiles and OMF/ASM Target Datafiles

CONFIGURE AUXNAME is an alternative to SET NEWNAME. The difference is that after you configure the auxiliary name the first time, additional DUPLICATE command reuse the configured settings. In contrast, you must reissue the SET NEWNAME command every time you execute the DUPLICATE command.

To use CONFIGURE AUXNAME to specify names for duplicate datafiles:

  1. Issue a CONFIGURE AUXNAME command for each file that you want to name in the duplicate database.

    For example, enter the following commands at the RMAN prompt to specify names for files datafiles 1 through 5:

    CONFIGURE AUXNAME FOR DATAFILE 1 TO '/oradata1/system01.dbf'; 
      CONFIGURE AUXNAME FOR DATAFILE 2 TO '/oradata2/sysaux01.dbf';
      CONFIGURE AUXNAME FOR DATAFILE 3 TO '/oradata3/undotbs01.dbf';
      CONFIGURE AUXNAME FOR DATAFILE 4 TO '/oradata4/users01.dbf'; 
      CONFIGURE AUXNAME FOR DATAFILE 5 TO '/oradata5/users02.dbf';
    
  2. Issue a DUPLICATE command.

    For example, enter the following command at the RMAN prompt:

    SET NEWNAME FOR TEMPFILE 1 TO '/oradatat/temp01.dbf'; 
    DUPLICATE TARGET DATABASE
      TO dupdb
      SKIP TABLESPACE tools
      LOGFILE
        GROUP 1 ('/duplogs/redo01a.log',
                 '/duplogs/redo01b.log') SIZE 4M REUSE,
        GROUP 2 ('/duplogs/redo02a.log',
                 '/duplogs/redo02b.log') SIZE 4M REUSE;
    

    RMAN uses the CONFIGURE AUXNAME settings to name datafiles 1 through 5.

See Also:

Oracle Database Backup and Recovery Reference for details on using CONFIGURE AUXNAME

Specifying OMF or ASM Alternative Names for Duplicate Database Files

The following sections discuss requirements for creating a duplicate database when some or all files of the duplicate database use OMF or ASM.

See Also:

Oracle Database Storage Administrator's Guide for an introduction to ASM and OMF

Setting and Restrictions for OMF Initialization Parameters

When creating a duplicate database that uses Oracle Managed Files, you must set initialization parameters in the auxiliary instance. If you use the SPFILE clause of DUPLICATE to name the files, then you can set initialization parameters in the SPFILE clause. Table 24-3 describes the relevant parameters and recommended settings and Table 24-4 lists the restrictions and initialization parameters that should not be set.

Table 24-3 Initialization Parameters for Oracle Managed Files

Initialization Parameter Purpose Recommendation

DB_CREATE_FILE_DEST

Specifies the default location for Oracle managed datafiles. This location is also the default location for Oracle managed control files and online logs if none of the DB_CREATE_ONLINE_LOG_DEST initialization parameters are specified.

Set this parameter to the location for the Oracle Managed Files. Any database files for which no other location is specified are created in DB_CREATE_FILE_DEST by DUPLICATE. You can override the default for specific files using SET NEWNAME, as described in "Using SET NEWNAME to Create OMF or ASM Files".

DB_CREATE_ONLINE_LOG_DEST_n

Specifies the default location for Oracle managed control files and online redo logs. If multiple parameters are set, then one control file and one online redo log is created in each location.

Set these parameters (_1, _2, and so on) only if you want to multiplex the control files and online redo log files in multiple locations.

DB_RECOVERY_FILE_DEST

Specifies the default location for the fast recovery area. The fast recovery area contains multiplexed copies of current control files and online redo log files.

Set this parameter if you want a multiplexed copy of the control file and online redo log file in the recovery area.


Table 24-4 Initialization Parameter Restrictions for Oracle Managed Files

Initialization Parameter Purpose Restriction

CONTROL_FILES

Specifies one or more names of control files, separated by commas.

Do not set this parameter if you want the duplicate database control files in an OMF format. Oracle recommends that you use a server parameter file at the duplicate database when using control files in an OMF format.

DB_FILE_NAME_CONVERT

Converts the filename of a new datafile on the primary database to a filename on the duplicate database.

Do not set this parameter. Omitting this parameter enables the database to generate valid Oracle managed filenames for the duplicate datafiles.

LOG_FILE_NAME_CONVERT

Converts the filename of a new log file on the primary database to the filename of a log file on the standby database.

Do not set this parameter. Omitting this parameter allows the database to generate valid Oracle managed online redo log file names.

To direct duplicate database online redo log files to Oracle managed storage, you can use the DB_CREATE_FILE_DEST, DB_RECOVERY_FILE_DEST or DB_CREATE_ONLINE_LOG_DEST_n initialization parameters to identify an Oracle managed location for the online logs.


Setting Initialization Parameters for ASM

The procedure for creating a duplicate database to an ASM location is similar to the procedure described in "Setting and Restrictions for OMF Initialization Parameters". The difference is that you must identify the initialization parameters that control the location where files are created and set these parameters to an ASM disk group. For example, set DB_CREATE_FILE_DEST, DB_CREATE_ONLINE_DEST_n, and CONTROL_FILES to +DISK1.

Duplicating a Database from a File System to ASM: Example

In this example, you use active database duplication. If the source database uses a server parameter file (or a backup is available), then you can create a temporary initialization parameter file on the destination host and set only the DB_NAME parameter.

Assume that the source database prod is on host1 and stores its datafiles in a non-ASM file system. The control files for prod are located in /oracle/oradata/prod/. You want to duplicate the source database to database dupdb on remote host host2. You want to store the duplicate database files in ASM disk group +DISK1.

After connecting RMAN to the target, duplicate, and recovery catalog database, run the RMAN script shown in Example 24-4 to duplicate the database.

Example 24-4 Duplicating from a File System to ASM (Active)

DUPLICATE TARGET DATABASE TO dupdb
  FROM ACTIVE DATABASE
  SPFILE 
    PARAMETER_VALUE_CONVERT '/oracle/oradata/prod/', '+DISK1'
    SET DB_CREATE_FILE_DEST +DISK1;

When the DUPLICATE command completes, the duplicate database is created, with datafiles, online redo log files, and control files in ASM disk group +DISK1.

Duplicating a Database from ASM to ASM: Example

In this example, you use active database duplication. If the source database uses a server parameter file (or a backup is available), then you can just create a temporary initialization parameter file on the destination host and set only the DB_NAME parameter.

Assume that the source database prod is on host1 and stores its datafiles in ASM disk group +DISK1. You want to duplicate the target to database dupdb on remote host host2. You want to store the datafiles for dupdb in ASM. Specifically, you want to store the datafiles and control files in disk group +DISK2.

In the DUPLICATE command, set PARAMETER_VALUE_CONVERT to convert all directory locations from +DISK1 to +DISK2. The new filenames in +DISK2 are generated by ASM and will not match the original filenames in disk group +DISK1.

After connecting to the target, duplicate, and catalog databases, run the RMAN script shown in Example 24-5 to duplicate the database.

Example 24-5 Duplicating from ASM to ASM (Active)

DUPLICATE TARGET DATABASE
  TO dupdb
  FROM ACTIVE DATABASE
  SPFILE PARAMETER_VALUE_CONVERT '+DISK1','+DISK2'
     SET DB_RECOVERY_FILE_DEST_SIZE='750G';

When the DUPLICATE command completes, the duplicate database is created, with datafiles, online redo logs, and control files in the larger ASM disk group +DISK2.

Using SET NEWNAME to Create OMF or ASM Files

To name Oracle Managed Files, you can use the same SET NEWNAME commands described in "Using SET NEWNAME to Name File System Datafiles and Tempfiles", but with TO NEW instead of TO "filename". RMAN creates the specified datafiles or tempfiles with Oracle Managed File names in the location specified by DB_CREATE_FILE_DEST.

To use SET NEWNAME to specify names for Oracle Managed Files:

  1. Set the DB_CREATE_FILE_DEST initialization parameter at the auxiliary instance to the desired location

  2. Enclose the DUPLICATE command in a RUN block and use SET NEWNAME with the TO NEW option for Oracle Managed Files.

    Example 24-6 illustrates a script that specifies literal names for datafiles 1-5. The only Oracle Managed Files in the source database are the datafiles in the users tablespace, therefore TO NEW is specified in the SET NEWNAME command for these files.

    Example 24-6 Duplicating with SET NEWNAME FOR DATAFILE and FOR TABLESPACE

    RUN
    {
      SET NEWNAME FOR TABLESPACE users TO NEW;
      SET NEWNAME FOR DATAFILE 3 TO NEW;
      SET NEWNAME FOR DATAFILE 1 TO '/oradata1/system01.dbf'; 
      SET NEWNAME FOR DATAFILE 2 TO '/oradata2/sysaux01.dbf';
      SET NEWNAME FOR TEMPFILE 1 TO '/oradatat/temp01';  
      DUPLICATE TARGET DATABASE TO dupdb
        SKIP TABLESPACE tools
        LOGFILE
          GROUP 1 ('/duplogs/redo01a.log', 
                   '/duplogs/redo01b.log') SIZE 4M REUSE, 
          GROUP 2 ('/duplogs/redo02a.log', 
                   '/duplogs/redo02b.log') SIZE 4M REUSE;
    }
    

    As shown in Example 24-7, you can also use SET NEWNAME to direct individual datafiles, tempfiles, or tablespaces to a specified ASM disk group.

    Example 24-7 Using SET NEWNAME to Create Files in an ASM Disk Group

    RUN
    {
       SET NEWNAME FOR DATAFILE 1 TO "+DGROUP1";
       SET NEWNAME FOR DATAFILE 2 TO "+DGROUP2";
       .
       .
       .
       DUPLICATE TARGET DATABASE 
         TO dupdb
         FROM ACTIVE DATABASE
         SPFILE SET DB_CREATE_FILE_DEST +DGROUP3;
    }
    

See Also:

Oracle Database Backup and Recovery Reference for details on using SET NEWNAME

Using the DB_FILE_NAME_CONVERT to Generate Names for Non-OMF or ASM Datafiles

Another technique to generate names besides using SET NEWNAME or CONFIGURE AUXNAME is to use DB_FILE_NAME_CONVERT to transform target filenames. For example, you can change the target filename from /oracle/ to /dup/oracle/. DB_FILE_NAME_CONVERT allows you to specify multiple conversion filename pairs. It can also be used to produce names for datafiles and tempfiles.

You can specify DB_FILE_NAME_CONVERT in the DUPLICATE command or you can set it in the initialization parameter of the auxiliary instance.

Restrictions of DB_FILE_NAME_CONVERT:

You cannot use the DB_FILE_NAME_CONVERT clause of the DUPLICATE command to control generation of new names for files at the duplicate instance which are Oracle Managed Files (OMF) at the source database instance. See Oracle Database Backup and Recovery Reference for details on this restriction.

Using LOG_FILE_NAME_CONVERT to Generate Names for Non-OMF or ASM Logfiles

If the LOG_FILE clause has been omitted and none of the Oracle Managed Files initialization parameters DB_CREATE_FILE_DEST, DB_CREATE_ONLINE_DEST_n, or DB_RECOVERY_FILE_DEST are specified, then LOG_FILE_NAME_CONVERT can transforms target filenames. This works in much the same way as the DB_FILE_NAME_CONVERT and can transform target filenames from log_* to duplog_*. You can specify multiple conversion filename pairs with this parameter.

When you specify LOG_FILE_NAME_CONVERT, RMAN uses the REUSE parameter when creating the online redo logs. If an online redo log file already exists at the named location and is of the correct size, then it is reused for the duplicate.

Restrictions of LOG_FILE_NAME_CONVERT:
  • Do not specify LOG_FILE_NAME_CONVERT if you set Oracle Managed Files initialization parameters.

  • LOG_FILE_NAME_CONVERT cannot be specified as a DUPLICATE clause, it can only be specified in the initialization parameter of the auxiliary instance.

  • You cannot use the LOG_FILE_NAME_CONVERT initialization parameter to control generation of new names for files at the duplicate instance which are Oracle Managed Files (OMF) at the source database instance.

Making Disk Backups Accessible Without Shared Disk

"Step 3: Making Backups Accessible to the Duplicate Instance" recommends using shared disk to make backups available to the auxiliary instance. When NFS or shared disk is not an option, then the path that stores the backups must exist on both the source and destination hosts unless BACKUP LOCATION is used for DUPLICATE without a target or recovery catalog connection.

Assume that you maintain two hosts, srchost and dsthost. The database on srchost is srcdb. The RMAN backups of srcdb reside in /dsk1/bkp on host srchost. The directory /dsk1/bkp is already in use on the destination host, so you intend to store backups in /dsk2/dup on the destination host.

To transfer the backups from the source host to the destination host:

  1. Create a new directory in the source host that has the same name as the directory on the destination host that will contain the backups.

    For example, if you intend to store the RMAN backups in /dsk2/dup on the destination host, then create /dsk2/dup on the source host.

  2. On the source host, copy the backups to the directory created in the previous step, and then catalog the backups. You can use either of the following approaches:

    • Connect RMAN to the source database as TARGET and use the BACKUP command to back up the backups, as explained in "Backing Up RMAN Backups". For example, use the BACKUP COPY OF DATABASE command to copy the backups in /dsk1/bkp on the source host to /dsk2/dup on the source host. In this case, RMAN automatically catalogs the backups in the new location.

    • Use an operating system utility to copy the backups in /dsk1/bkp on the source host to /dsk2/dup on the source host. Afterward, connect RMAN to the source database as TARGET and use the CATALOG command to update the source control file with the location of the manually transferred backups.

  3. Manually transfer the backups in the new directory on the source host to the identically named directory on the destination host.

    For example, use FTP to transfer the backups in /dsk2/dup on the source host to /dsk2/dup on the destination host.

The auxiliary channel can search for backups in /dsk2/dup on the destination host and restore them.

Duplicating a Database When No Server Parameter File Exists

The procedure in "Step 5: Creating an Initialization Parameter File and Starting the Auxiliary Instance" assumes that you use the SPFILE clause of the DUPLICATE command. If the source database does not use a server parameter file, then you must set all necessary parameters for the auxiliary instance in a text-based initialization parameter file.

Table 24-5 describes a subset of the possible initialization parameters. Refer to Table 24-1 to learn about options for naming duplicate files.

Table 24-5 Auxiliary Instance Initialization Parameters

Initialization Parameter Value Status

DB_NAME

The same name used in the DUPLICATE command. If you are using DUPLICATE to create a standby database, then the name must be the same as the primary database.

The DB_NAME setting for the duplicate database must be unique among databases in its Oracle home.

Required

CONTROL_FILES

Control file locations.

Required

DB_BLOCK_SIZE

The block size for the duplicate database.

This block size must match the block size of the source database. If the source database parameter file contains a value for the DB_BLOCK_SIZE initialization parameter, then you must specify the same value for the auxiliary instance. If no DB_BLOCK_SIZE is specified in the source database initialization parameter file, however, then do not specify DB_BLOCK_SIZE in the auxiliary instance.

Required if this initialization parameter is set in source database

DB_FILE_NAME_CONVERT

Pairs of strings for converting the names of datafiles and tempfiles. You can also specify DB_FILE_NAME_CONVERT on the DUPLICATE command itself. See "Using the DB_FILE_NAME_CONVERT to Generate Names for Non-OMF or ASM Datafiles".

Optional

LOG_FILE_NAME_CONVERT

Pairs of strings for naming online redo log files. See "Using LOG_FILE_NAME_CONVERT to Generate Names for Non-OMF or ASM Logfiles".

Optional

DB_CREATE_FILE_DEST

Location for Oracle managed datafiles.

Optional

DB_CREATE_ONLINE_LOG_DEST_n

Location for Oracle managed online redo log files.

Optional

DB_RECOVERY_FILE_DEST

Location for fast recovery area.

Optional

Oracle Real Application Cluster (RAC) parameters:

  • <INSTANCESIDn>.INSTANCE_NAME

  • <INSTANCESIDn>.INSTANCE_NUMBER

  • <INSTANCESIDn>.THREAD

  • <INSTANCESIDn.UNDO_TABLESPACE

  • <INSTANCESIDn.LOCAL_LISTENER

Set these parameters for each instance of the RAC database.

Required for RAC configuration


If necessary, set other initialization parameters, including the parameters that allow you to connect as SYSDBA through Oracle Net, as needed. Verify that all paths are accessible on the host where the database is being duplicated.

To create an initialization parameter file when not planning to use the SPFILE clause:

  1. Use an operating system utility to make a copy of the initialization parameter file of the source database in the operating system-specific default location.

  2. In the copied initialization parameter file, manually change DB_NAME to the name of the duplicate database. If you are using DUPLICATE to create a standby database, then the name must be the same as the primary database.

  3. If necessary, change other initialization parameters, including the parameters that allow you to connect as SYSDBA through Oracle Net, as needed. You must verify that all paths are accessible on the host where the database is being duplicated.

    Example 24-8 shows sample settings for a sample initialization parameter file.

    Example 24-8 Sample Initialization Parameter File for the Auxiliary Instance

    DB_NAME=dupdb
    CONTROL_FILES=(/dup/oracle/oradata/prod/control01.ctl,
                   /dup/oracle/oradata/prod/control02.ctl)
    DB_FILE_NAME_CONVERT=(/oracle/oradata/prod/,/dup/oracle/oradata/prod/)
    LOG_FILE_NAME_CONVERT=(/oracle/oradata/prod/redo,/dup/oracle/oradata/prod/redo)
    

Starting the Auxiliary Instance When No Server Parameter File Exists

"Step 5: Creating an Initialization Parameter File and Starting the Auxiliary Instance" assumes that the source database instance uses a server parameter file. This scenario assumes that the source database does not currently use a server parameter file or RMAN cannot restore a backup server parameter file. In this case, you must start the auxiliary instance with a text-based initialization parameter file.

To start the auxiliary instance in preparation for database duplication:

  1. Copy the text-based initialization parameter file to the default location on the host containing the SQL*Plus client.

  2. Start SQL*Plus and connect to the auxiliary instance with SYSOPER privileges.

  3. Start the auxiliary instance in NOMOUNT mode, using a text-based initialization parameter file:

    SQL> STARTUP NOMOUNT
    
  4. Copy the text-based initialization parameter file for the auxiliary instance to the same host as the RMAN client used to perform the duplication. You must specify the location of this text-based initialization parameter file in the PFILE clause of the DUPLICATE command.

Duplicating a Subset of the Source Database Tablespaces

It is not always necessary to duplicate all tablespaces of a database. For example, you may plan to generate reports at the duplicate that require only a subset of tablespaces from your source database.

Note:

When excluding tablespaces in backup-based duplication without a target connection or without a target and a recovery catalog connection, RMAN has special prerequisites. See the Prerequisites section of the DUPLICATE entry in Oracle Database Backup and Recovery Reference for details.

Table 24-6 explains DUPLICATE command options for specifying subsets of tablespaces for the duplicate database.

Table 24-6 Options to Specify Subsets of Tablespaces for the Duplicate Database

DUPLICATE Options Explanation

SKIP READONLY

Excludes the datafiles of read-only tablespaces from the duplicate database.

SKIP TABLESPACE 'tablespace_name ', ...

Excludes the specified tablespaces from the duplicate database. You cannot exclude the SYSTEM and SYSAUX tablespaces, tablespaces with SYS objects, undo tablespaces, tablespaces with undo segments, tablespaces with materialized views, or tablespaces in such a way that the duplicated tablespaces are not self-contained.

TABLESPACE 'tablespace_name ', ...

Automatically includes the SYSTEM, SYSAUX, and undo tablespaces. The included tablespaces must be self-contained and the resulting skipped tablespaces must not contain SYS objects or materialized views.


To specify a subset of tablespaces for a duplicate database:

  1. Ensure that you have completed steps 1 through 4 in "Basic Steps of Database Duplication".

  2. Run the DUPLICATE command with one or more of the options in Table 24-6.

Other factors that influence what tablespaces are copied include the OFFLINE NORMAL option. When tablespaces are taken offline with the OFFLINE NORMAL option before duplication, RMAN does not duplicate the associated datafiles and issues DROP TABLESPACE for these tablespaces on the duplicate database. Therefore, you do not have to specify options to exclude these tablespaces.

Note:

RMAN does duplicate tablespaces that are taken offline with any other option besides NORMAL (unless they are named in a SKIP TABLESPACE option). Only OFFLINE NORMAL tablespaces are skipped automatically. As with online tablespaces, RMAN requires a valid backup for these tablespaces when you use backup-based duplication.

Excluding Specified Tablespaces

Example 24-9 shows how to skip read-only tablespaces.

Example 24-9 Excluding Read-Only Tablespaces

DUPLICATE TARGET DATABASE TO dupdb
  FROM ACTIVE DATABASE
  SKIP READONLY
  NOFILENAMECHECK;

Example 24-10 shows how to skip a tablespace named tools.

Example 24-10 Excluding Specified Tablespaces

DUPLICATE TARGET DATABASE 
  TO dupdb
  FROM ACTIVE DATABASE
  SKIP TABLESPACE tools
  NOFILENAMECHECK;

Including Specified Tablespaces

You can use the TABLESPACE parameter to specify which tablespaces to include in the specified database. Unlike SKIP TABLESPACE, which specifies which tablespaces to exclude from the duplicate database, this option specifies which tablespaces to include and then skips the remaining tablespaces. The duplicated subset of tablespaces must be self-contained. The resulting set of skipped tablespaces must not have undo segments or materialized views.

Example 24-11 is a variation of Example 23-1 except with the users tablespace included, which is assumed to be self-contained, and all other tablespaces excluded, except for SYSTEM and SYSAUX tablespaces and tablespaces with undo segments.

Example 24-11 Including Specified Tablespaces

DUPLICATE TARGET DATABASE 
  TO dupdb
  FROM ACTIVE DATABASE
  TABLESPACE users
  NOFILENAMECHECK;

Assume that you perform backup-based duplication with a target connection, but no recovery catalog connection. Assume that you want to specify a subset of tablespaces for duplication. If the target database is not open in this scenario, then RMAN has no way to obtain the names of the tablespaces with undo segments. Thus, you must specify the UNDO TABLESPACE parameter for these tablespaces as shown in Example 24-12.

Example 24-12 Including Specified Tablespaces

DUPLICATE TARGET DATABASE TO dupdb
  TABLESPACE users
  UNDO TABLESPACE undotbs
  NOFILENAMECHECK;