Oracle8i Backup and Recovery Guide
Release 8.1.5

A67773-01

Library

Product

Contents

Index

Prev Prev Next


recover

Syntax


Purpose

To apply redo logs or incremental backups to one or more restored datafiles in order to update them to a specified time.

RMAN uses online redo records and restores backup sets of archived redo logs as needed to perform the media recovery. If RMAN has a choice between applying an incremental backup or applying redo, then it always chooses the incremental backup. If overlapping levels of incremental backup are available, RMAN automatically chooses the one covering the longest period of time.

See Also: To learn how to recover datafiles, see Chapter 9, "Restoring and Recovering with Recovery Manager".

Requirements

Keywords and Parameters

database  

specifies that the entire database is to be recovered. You can specify an optional untilClause that causes the recovery to stop when the specified condition has been reached.  

untilClause  

specifies a non-current time, SCN, or log sequence number for the recover command. See "untilClause".  

skip [ forever ] tablespace tablespace_name  

lists tablespaces that should not be recovered, which is useful for avoiding recovery of tablespaces containing only temporary data or for postponing recovery of some tablespaces. The skip clause takes the datafiles in the specified tablespaces offline before starting media recovery. These files are left offline after the media recovery is complete.

If you perform incomplete recovery, then skip is not allowed. Instead, use skip forever, with the intention of dropping the skipped tablespaces after opening the database with the RESETLOGS option. The skip forever clause causes RMAN to take the datafiles offline using the DROP option. Only use skip forever when the specified tablespaces will be dropped after opening the database.  

tablespace tablespace_name  

specifies tablespaces by tablespace name.  

datafile datafileSpec  

specifies a list of one or more datafiles to recover. Specify datafiles by filename using a quoted string or absolute datafile number using an integer (see "datafileSpec").

If you are using the control file as the exclusive repository for RMAN metadata, then the filename must be the name of the datafile as known in the control file.

If you are using a recovery catalog, then the filename of the datafile must be the most recent name recorded in the catalog. For example, assume that a datafile was renamed in the control file. The database then crashes before you can resynchronize the catalog. Specify the old name of the datafile in the recover command, since this is the name recorded in the catalog.  

delete archivelog  

deletes restored archived logs that are no longer needed. RMAN does not delete archived logs that were already on disk before the restore command started.  

check readonly  

checks the headers of read-only files to ensure that they are current before omitting them from the recovery.  

noredo  

suppresses the application of redo logs--only incremental backups are applied. This option is intended for recovery of NOARCHIVELOG databases using incremental backups. If you do not specify noredo when recovering a NOARCHIVELOG database, Oracle aborts a recovery and issues an error.  

Examples

Recovering a Tablespace in an Open Database

The following example takes tablespace TBS_1 offline, restores and recovers it, then brings it back online:

run {  
     allocate channel dev1 type 'sbt_tape';  
     sql "ALTER TABLESPACE tbs_1 OFFLINE IMMEDIATE"; 
     restore tablespace tbs_1; 
     recover tablespace tbs_1;  
     sql "ALTER TABLESPACE tbs_1 ONLINE"; 
} 
Recovering Datafiles Restored to New Locations

The following example allocates one disk channel and one media management channel to use datafile copies on disk and backups on tape, and restores one of the datafiles in tablespace TBS_1 to a different location:

run {  
     allocate channel dev1 type disk;  
     allocate channel dev2 type 'sbt_tape';  
     sql "ALTER TABLESPACE tbs_1 OFFLINE IMMEDIATE";  
     set newname for datafile 'disk7/oracle/tbs11.f' 
       to 'disk9/oracle/tbs11.f';  
     restore tablespace tbs_1;  
     switch datafile all;  
     recover tablespace tbs_1;  
     sql "ALTER TABLESPACE tbs_1 ONLINE";  
}  
Performing Incomplete Recovery Using a Backup Control File

Assume that both the database and archived redo log 1234 were lost due to a disk crash. Because you do not have incremental backups, you need to recover the database using available archived redo logs. There is no need to restore tablespace READONLY1 because it has not changed since log 1234.

run {  
     # Recover database until log sequence 1234 
     allocate channel dev1 type disk;  
     allocate channel dev2 type 'sbt_tape';  
     set until logseq 1234 thread 1; 
     restore controlfile to '/vobs/oracle/dbs/cf1.f' ;  
     # Because you specified a restore destination, you must manually replicate the
     # control file. The restore command replicates automatically when no destination is
     # specified.
     replicate controlfile from '/vobs/oracle/dbs/cf1.f';
     alter database mount;
     restore database skip tablespace temp1, readonly1;
     recover database skip forever tablespace temp1;
     sql "ALTER DATABASE OPEN RESETLOGS";
     sql "DROP TABLESPACE temp1";
     sql "CREATE TABLESPACE temp1 DATAFILE '/vobs/oracle/dbs/temp1.f' SIZE 10M";
     release channel dev1;  
     release channel dev2;
}

Related Topics

"allocate"

"set_run_option"

"restore"

"untilClause"




Prev

Top

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index