Oracle® Database Backup and Recovery Advanced User's Guide 10g Release 2 (10.2) Part Number B14191-01 |
|
|
View PDF |
When duplicating a database, RMAN creates the required database files. This section describes the different stages of file creation:
The rules of precedence for determining the names for the duplicate database control files are the same used by the SQL statement CREATE CONTROLFILE
. When choosing names for the duplicate control files, make sure you set the parameters in the initialization parameter file of the auxiliary database correctly; otherwise, you could overwrite the control files of the target database.
One of the principal tasks when duplicating a database is choosing how to name the duplicate database files. Table 13-1 lists the options for creating the names of the online redo logs in the duplicate database. The options appear in the order of precedence.
Table 13-1 Order of Precedence for Online Redo Log Filename Creation
Order | Method | Result |
---|---|---|
1 | Specify the LOGFILE clause of DUPLICATE command. |
Creates online redo logs as specified. |
2 | Set LOG_FILE_NAME_CONVERT initialization parameter. |
Transforms target filenames, for example, from log_* to duplog_* . Note that you can specify multiple conversion pairs.
This parameter allows the redo log to exist as long as the size matches because it uses the |
3 | Set one of the Oracle Managed Files initialization parameters. | Transforms target filenames based on the parameters DB_CREATE_FILE_DEST , DB_CREATE_ONLINE_DEST_ n , or DB_RECOVERY_FILE_DEST . The rules of precedence are the same used by the SQL statement ALTER DATABASE ADD LOGFILE . |
4 | Do none of the preceding steps. | Makes the duplicate filenames the same as the target filenames. You must specify the NOFILENAMECHECK option when using this method and the duplicate database should be in a different host. |
The order of precedence determines how RMAN renames the online redo logs. For example, if you specify both the LOGFILE
clause and the LOG_FILE_NAME_CONVERT
parameter, then RMAN uses the LOGFILE
clause. If you specify none of the first three options, then RMAN uses the original target redo log filenames for the duplicate database files.
Caution: If the target and duplicate databases are in the same host, then do not use the name of an online redo log currently in use by the target database. Also, do not use the name of an online log currently in use by the target database if the duplicate database is in a different host andNOFILENAMECHECK is not used. |
There are several means of specifying new names to be used for the datafiles of your duplicate database. Listed in order of precedence, they are:
Use the RMAN command SET NEWNAME FOR DATAFILE
within a RUN
block that encloses both the SET NEWNAME
commands and the DUPLICATE
command.
Use the RMAN command CONFIGURE AUXNAME
to specify new names for existing datafiles. Run the CONFIGURE AUXNAME
command before the DUPLICATE
command.
Specify the DB_FILE_NAME_CONVERT
parameter on the DUPLICATE
command to specify a rule for converting filenames for any datafiles not renamed with SET NEWNAME
or CONFIGURE AUXNAME
. Note that you can specify multiple conversion pairs and use ASM disk groups.
Set the DB_FILE_NAME_CONVERT
initialization parameter, which is subject to the same semantics and limitations as the DB_FILE_NAME_CONVERT
parameter to the DUPLICATE
command.
Set the DB_CREATE_FILE_DEST
initialization parameter to create Oracle Managed Files datafiles.
If you do not use any of the preceding options, then the duplicate database reuses the original datafile filenames from the target database.
RMAN re-creates datafiles for temporary tablespaces as part of the process of duplicating a database. There are several means of specifying tempfiles in your duplicate database. Listed in order of precedence, they are:
Use the SET NEWNAME FOR TEMPFILE
command within a RUN
block that encloses both the SET NEWNAME
commands and the DUPLICATE
command.
Specify the DB_FILE_NAME_CONVERT
parameter to the DUPLICATE
command to specify a rule for converting tempfiles not renamed with SET NEWNAME
or CONFIGURE AUXNAME
. Note that you can specify multiple conversion pairs and use ASM disk groups.
Set the DB_FILE_NAME_CONVERT
initialization parameter, which is subject to the same semantics and limitations as the DB_FILE_NAME_CONVERT
parameter to the DUPLICATE
command.
Set the DB_CREATE_FILE_DEST
initialization parameter to create Oracle Managed Files tempfiles.
It is possible for CONFIGURE
AUXNAME
, SET
NEWNAME
, or DB_FILE_NAME_CONVERT
to generate a name that is already in use in the target database. In this case, specify NOFILENAMECHECK
on the DUPLICATE
command to avoid an error message.
For example, assume that the host A database has two files: datafile 1
is named /oracle/data/file1.f
and datafile 2
is named /oracle/data/file2.f
. When duplicating to host B, you use a configured channel to duplicate as follows:
RUN { SET NEWNAME FOR DATAFILE 1 TO /oracle/data/file2.f; # rename df 1 as file2.f SET NEWNAME FOR DATAFILE 2 TO /oracle/data/file1.f; # rename df 2 as file1.f DUPLICATE TARGET DATABASE TO newdb; }
Even though you issued SET
NEWNAME
commands for all the datafiles, the DUPLICATE
command fails because the duplicate filenames are still in use in the target database. Although datafile 1
in the target is not using /oracle/data/file2.f
, and datafile 2
in the target is not using /oracle/data/file1.f
, the target filename is used by one of the duplicate datafiles. Thus, you must specify DUPLICATE ... NOFILENAMECHECK
to avoid an error.
When you specify SKIP
READONLY
, RMAN does not duplicate the datafiles of read-only tablespaces. After duplication is complete, you can query the views in the duplicate database described in Table 13-2 and Table 13-3 to determine which datafiles were skipped. The STATUS
and ENABLED
columns are the key to determining the current status of the duplicate datafile.
When tablespaces are taken offline with the OFFLINE
NORMAL
option before a DUPLICATE
operation, RMAN does not duplicate the datafiles of these tablespaces. After duplication, you can manually add or drop these tablespaces. Query the views in the duplicate database described in Table 13-4 and Table 13-5 to determine which datafiles are offline, based on the STATUS
and ENABLED
columns.
Table 13-4 Offline Tablespaces in V$ Views on Duplicate Database
In the column ... | The value is ... |
---|---|
STATUS |
OFFLINE |
ENABLED |
DISABLED |
NAME |
MISSINGxxx |
Table 13-5 Offline Tablespaces in Data Dictionary Views on Duplicate Database
View | In the column ... | The value is ... |
---|---|---|
DBA_DATA_FILES |
STATUS |
AVAILABLE |
DBA_TABLESPACES |
STATUS |
OFFLINE |
When you take a tablespace offline with the IMMEDIATE
option, RMAN duplicates rather than skips the tablespace because this tablespace requires recovery. As with online tablespaces, RMAN requires a valid backup for duplication.