Oracle® Database Backup and Recovery Advanced User's Guide 10g Release 2 (10.2) Part Number B14191-02 |
|
|
View PDF |
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
Duplicating a Database on a Remote Host with a Different 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.
Follow the steps in "Preparing the RMAN DUPLICATE Auxiliary Instance: Basic Steps".
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.
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 in RMAN DUPLICATE DATABASE".
This procedure assumes that you use only initialization parameters to rename the duplicate datafiles and log files.
Follow the steps in "Preparing the RMAN DUPLICATE Auxiliary Instance: 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
.
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
.
You can also 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
patterns. As described in "Using RMAN DUPLICATE with OMF and ASM", you can also duplicate your database to an Oracle Managed Files location and let the database generate names for your files.
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.
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.
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.
The following example duplicates the database using configured channels and specifies an initialization parameter file:
DUPLICATE TARGET DATABASE TO dupdb # specify client-side parameter file for auxiliary instance 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;
This procedure assumes that you use the SET
NEWNAME
command to rename the duplicate datafiles.
Follow the steps in "Preparing the RMAN DUPLICATE Auxiliary Instance: 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.
Perform the following operations when running the duplication:
If channels are not configured for the auxiliary database, 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 configured 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.
This procedure assumes that you use the CONFIGURE
AUXNAME
command to rename the duplicate datafiles.
Follow the steps in "Preparing the RMAN DUPLICATE Auxiliary Instance: 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.
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 future operations. For example, enter the following:
# clear specified auxiliary names for the datafiles CONFIGURE AUXNAME FOR DATAFILE 1 CLEAR; CONFIGURE AUXNAME FOR DATAFILE 2 CLEAR; . . .
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 theNOFILENAMECHECK 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. |
The following sections discuss requirements when creating some or all files of the duplicate database in OMF or ASM storage:
When duplicating a database and storing the duplicate in OMF storage, you must make the following changes on the initialization parameter file for the duplicate database:
Set the DB_CREATE_FILE_DEST
initialization parameter to the desired OMF storage location. Any database files for which no other location is specified are created in DB_CREATE_FILE_DEST
during DUPLICATE
.
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.
If duplicating for standby, set the STANDBY_FILE_MANAGEMENT
initialization parameter to AUTO
.
Do not set the CONTROL_FILES
initialization parameter if you want to create the new control files as Oracle Managed Files. Oracle recommends that you use an SPFILE at the duplicate database when using OMF for the control file.
Do not set the DB_FILE_NAME_CONVERT
initialization parameter. This will allow the database to generate valid OMF filenames for the duplicate datafiles.
The default location for OMF files is DB_CREATE_FILE_DEST
. You can override the default for individual files using SET NEWNAME, as described in "Using SET NEWNAME with RMAN DUPLICATE to OMF".
Do not set the LOG_FILE_NAME_CONVERT
initialization parameter. This will allow the database to generate valid OMF redo log filenames.
To direct duplicate database online redo log files to OMF 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 OMF location for the online logs. Table 13-8, "Oracle Managed Files Initialization Parameter Settings" explains how to choose among these options.
You must also decide:
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
These 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 explains the required initialization parameter values, depending upon your requirements.
Table 13-8 Oracle Managed Files Initialization Parameter Settings
Copies of control files and online redo logs | Control file, online log, and datafile locations | Required Initialization parameters |
---|---|---|
n, where n is 3 or more |
Same or different |
|
n, where n is 1 or more |
Different |
|
2 |
Same |
|
1 |
Same |
|
The procedure for creating a duplicate database to an Automatic Storage Management (ASM) location is similar to the procedure described in "Initialization Parameters for RMAN DUPLICATE to OMF Storage". The difference is that you must edit the initialization parameter file in the auxiliary instance to set all parameters that control the location where files are created at the duplicate, such as DB_CREATE_FILE_DEST
, DB_CREATE_ONLINE_DEST_
n
, and CONTROL_FILES
, to the ASM disk group.
For example, edit the auxiliary instance parameter file as follows to create the database files in the disk group disk1
:
*.DB_CREATE_FILE_DEST = '+disk1'
If you want to store specific datafiles or tempfiles in an OMF destination, independent of the locations of the rest of the database files, then you can use the following steps:
Set the DB_CREATE_FILE_DEST
initialization parameter at the auxiliary instance to the desired location
Enclose the DUPLICATE
command in a RUN block
Use SET NEWNAME FOR DATAFILE ... TO NEW
and SET NEWNAME FOR TEMPFILE ... TO NEW
commands in the RUN block with the DUPLICATE
command
The specified files are created with OMF names in the location specified by DB_CREATE_FILE_DEST
.
This technique is similar to the scenario described in "Using RMAN DUPLICATE With SET NEWNAME: Example"
You can also use SET
NEWNAME
to direct individual datafiles or tempfiles to a specific ASM disk group. For example:
RUN { SET NEWNAME FOR DATAFILE 1 TO "+dgroup1"; SET NEWNAME FOR DATAFILE 2 TO "+dgroup2"; ... DUPLICATE TARGET DATABASE FOR STANDBY; }