Oracle8i Backup and Recovery Guide Release 8.1.5 A67773-01 |
|
This chapter describes how to use Recovery Manager (RMAN) to perform tablespace point-in-time recovery (TSPITR), and includes the following topics:
Recovery Manager (RMAN) automated tablespace point-in-time recovery (TSPITR) enables you to quickly recover one or more tablespaces to a time that is different from that of the rest of the database.
RMAN TSPITR is most useful for recovering:
Like a table export, RMAN TSPITR enables you to recover a consistent data set; however, the data set is the entire tablespace rather than one object. As Figure 16-4 illustrates, Recovery Manager does the following:
Familiarize yourself with the following terms and abbreviations, which are used throughout this chapter:
Tablespace point-in-time recovery
The auxiliary instance used to recover the backup tablespaces. The database created by TSPITR never has independent existence: it is only an intermediate work area.
Tablespaces requiring TSPITR to be performed on them.
Any other items required for TSPITR, including:
Recovery Manager TSPITR requires careful planning. Before proceeding, read this chapter thoroughly.
This section covers the following topics:
Many of the limitations and planning steps in this chapter can also be found in Chapter B, "Performing Operating System Tablespace Point-in-Time Recovery"; however, differences in limitations and planning exist. These differences are explicitly called to your attention in this chapter.
Note:
You can perform RMAN TSPITR either with or without a recovery catalog. If you do not use a recovery catalog, note these restrictions:
When performing RMAN TSPITR, you cannot:
The primary issue for RMAN TSPITR is the possibility of application-level inconsistencies between tables in recovered and unrecovered tablespaces due to implicit rather than explicit referential dependencies. Note the following issues and have the means to resolve possible inconsistencies before proceeding:
RMAN TSPITR only supports recovery sets that contain whole tables. For example, if you perform RMAN TSPITR on partitioned tables and spread partitions across multiple tables, RMAN returns an error message during the export phase. Recovery sets that contain either tables without their constraints or the constraints without the table also result in errors.
If you are performing O/S TSPITR, you can take rollback segments in the recovery set offline--thus preventing changes being made to the recovery set before recovery is complete. RMAN TSPITR does not support recovery of tablespaces containing rollback segments. For more information about TSPITR and rollback segments, see "Step 3: Prepare the Primary Database".
The TS_PITR_CHECK view provides information on dependencies and restrictions that can prevent TSPITR from proceeding. TS_PITR_CHECK does not provide information, however, about dependencies and restrictions for objects owned by SYS.
If any objects--including rollback segments--owned by SYS are in the recovery set, then there is no guarantee that you can successfully recover these objects. TSPITR utilizes the Export and Import utilities, which do not support objects owned by SYS. To find out which recovery set objects are owned by SYS, issue the following statement:
SELECT object_name, object_type FROM sys.dba_objects WHERE tablespace_name IN ('tablespace_name_1','tablespace_name_2', 'tablespace_name_n') AND owner = 'SYS';
See Also: For more details about the TS_PITR_CHECK view, see "Step 2: Research and Resolve Dependencies on the Primary Database".
TSPITR provides views that can detect any data relationships between objects in the recovery set and objects in the rest of the database. TSPITR will not successfully complete unless these relationships are managed, either by removing or suspending the relationship or by including the related object within the recovery set.
See Also: For more information see "Step 2: Research and Resolve Dependencies on the Primary Database".
Satisfy the following requirements before performing RMAN TSPITR:
For information about creating and maintaining Oracle password files, see the Oracle8i Administrator's Guide.
Create an init.ora
file for the auxiliary instance and set the following required parameters:
Set other parameters as needed, including the parameters that allow you to connect as SYSDBA through Net8.
Following are examples of the init.ora
parameter settings for the auxiliary instance.
DB_NAME=prod1 LOCK_NAME_SPACE=_prod1 CONTROL_FILES=/oracle/aux/cf/aux_prod_cf.f DB_FILE_NAME_CONVERT=("/oracle/prod/datafile","/oracle/aux/datafile") LOG_FILE_NAME_CONVERT=("/oracle/prod/redo_log","/oracle/aux/redo_log")
See Also: For details about DB_FILE_NAME_CONVERT, see "Tuning TSPITR Performance". For more information about Net8, see the Net8 Administrator's Guide.
Before beginning RMAN TSPITR, use SQL*Plus to connect to the auxiliary instance and start it in NOMOUNT mode (specifying a parameter file if necessary):
SQL> connect sys/aux_pwd@aux_str; SQL> startup nomount pfile='/oracle/aux/dbs/initAUX.ora';
Because the auxiliary instance does not yet have a control file, you can only start the instance in NOMOUNT mode. Do not create a control file or try to mount or open the auxiliary instance for TSPITR.
The auxiliary instance must have a valid net service name. Before proceeding, use SQL*Plus to ensure that you can establish a connection to the auxiliary instance.
Use one of the following methods to start the RMAN command line interface:
To connect to the auxiliary instance, target instance, and optional recovery catalog, supply the following information when starting Recovery Manager:
% rman target sys/target_pwd@target_str catalog rman/cat_pwd@cat_str auxiliary \ > sys/aux_pwd@aux_str
Where:
You can start the RMAN command line interface without a connection to the auxiliary instance, and then use the connect command at the RMAN prompt:
% rman RMAN> connect auxiliary sys/aux_pwd@aux_str RMAN> connect target target sys/target_pwd@target_str RMAN> connect catalog rman/cat_pwd@cat_str
After you have completed all planning requirements, perform RMAN TSPITR. Issue the following commands within run, where tablespace_list is the list of tablespace names in the recovery set and recovery_end_time is the point to which you want to recover:
allocate auxiliary channel . . . recover tablespace tablespace_list until recovery_end_time;
You must allocate at least one auxiliary channel with the allocate auxiliary channel command.
The following example statement performs RMAN TSPITR on tablespaces TBS_2 and TBS_3 to 8 p.m. on January 10, 1999:
run { allocate auxiliary channel dev1 type 'sbt_tape'; recover tablespace tbs_2, tbs_3 until time 'Jan 10 1999 20:00:00'; }
Recovery Manager automatically performs the following steps during TSPITR:
The tablespaces in the recovery set remain offline until after RMAN TSPITR completes successfully.
run { allocate channel ch1 type disk; backup tablespace tbs_4; }
sql "ALTER TABLESPACE TBS_4 ONLINE";
shutdown abort;
A variety of problems can cause TSPITR to abort. For example, if there is a conflict between the target database and the converted filename, you will have to shut down the auxiliary instance, correct the converted datafile name, issue a startup nomount, and then run RMAN TSPITR again.
Another possible cause for failure is a lack of sufficient sort space for the Export utility. In this case, you will need to edit the recover.txt
file (in UNIX, it is located in $ORACLE_HOME/admin
). This file contains the following:
# # tsiptr_7: do the incomplete recovery and resetlogs. This member is used once. # define tspitr_7 <<< # make the controlfile point at the restored datafiles, then recover them recover clone database tablespace &1&; sql clone "alter database open resetlogs"; # PLUG HERE the creation of a temporary tablespace if export fails due to lack of # temporary space. # For example in Unix these two lines would do that: #sql clone "create tablespace aux_tspitr_tmp # datafile ''/tmp/aux_tspitr_tmp.dbf'' size 500K"; } >>>
Remove the '#' symbols from the last two lines of comments and modify the statement to create a temporary tablespace. Retry the TSPITR operation, increasing the size of the tablespace until the export operation succeeds.
If TSPITR is unsuccessful for some reason, follow the procedure below.
shutdown abort;
startup nomount pfile=initAUX.ora;
This section describes steps you can take to tune the performance of RMAN TSPITR:
Recovery Manager restores and recovers all datafiles belonging to the tablespaces in the recovery set and auxiliary set at the auxiliary instance. Note that the auxiliary set includes the SYSTEM tablespace plus all the tablespaces with rollback segments.
Specify a new name for any datafiles in the auxiliary set tablespace using the set newname Recovery Manager command. RMAN uses this new name as the temporary location in which to restore and recover the datafile. This new name will also override the setting in the DB_FILE_NAME_CONVERT parameter in the init.ora
file. For example, to rename datafile 2
to new_df_name.f
enter:
set newname for datafile 2 to '/oracle/dbs/new_df_name.f';
You can specify a new name for any datafiles in recovery set tablespaces. If you specify a new name, the datafiles will replace the original datafiles in the target control file--so the new filenames replace the existing filenames.
When setting new filenames, RMAN does not check for conflicts between datafile names at the auxiliary and target databases. Any conflicts will result in an RMAN error during TSPITR.
Using a datafile copy on disk is much faster than restoring a datafile. Hence, you may wish to use an appropriate copy of a datafile in the recovery or auxiliary set instead of restoring and recovering a datafile.
Recovery Manager uses a datafile copy if the following conditions are met:
set auxname for datafile filename to auxiliary_datafile_name;
run { copy datafile 'filename' to auxname; ... }
The following commands are examples of the conditions required by Recovery Manager:
set auxname for datafile '/oracle/prod/datafile_1_1.dbf' to '/oracle/prod_copy/datafile_1_1.dbf'; run { allocate channel ch1 type disk; copy datafile '/oracle/prod/datafile_1_1.dbf' to auxname; }
Recovery Manager will not use a datafile copy if you use set newname for the same datafile.
If Recovery Manager uses a datafile copy and TSPITR completes successfully, the auxiliary_datafile_name will be marked deleted in the recovery catalog. The original datafile at the target will be replaced by this datafile copy after RMAN TSPITR completes.
If neither a new name nor auxiliary name is set for a datafile in an auxiliary set tablespace, Recovery Manager can use the converted filename specified in the auxiliary database control file to perform the restore and recovery. Recovery Manager checks for conflicts between datafile names at the auxiliary and target databases. Any conflicts result in an error.
If neither a new name or auxiliary name is set for a datafile in a recovery set tablespace, or the file at the auxiliary name is unusable, Recovery Manager uses the original location of the datafile.
The following commands and parameters are used to name datafiles in the auxiliary and recovery sets during TSPITR. The order of precedence in the table goes top to bottom, so set newname takes precedence over set auxname and DB_FILE_NAME_CONVERT:
Command/Parameter | Auxiliary Set | Recovery Set | |
---|---|---|---|
1 |
set newname |
X |
X |
2 |
set auxname |
X |
X |
3 |
DB_FILE_NAME_CONVERT |
X |
|
If filenames are not converted in the auxiliary set, RMAN signals an error during TSPITR.