Skip Headers

Oracle9i Recovery Manager Reference
Release 2 (9.2)

Part Number A96565-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to beginning of chapter Go to next page

RMAN Commands , 39 of 59


RECOVER

Syntax

Text description of recover.gif follows
Text description of the illustration recover.gif


recoverObject::=
Text description of recoverObject.gif follows
Text description of the illustration recoverObject.gif


recoverOptionList::=
Text description of recoverOptionList.gif follows
Text description of the illustration recoverOptionList.gif


Purpose

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

RMAN first looks for archived logs or image copies on disk, and if none are available, then it restores logs from backups as needed for the recovery. If you specify DELETE ARCHIVELOG, then RMAN deletes the logs after restoring them.

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, then RMAN automatically chooses the one covering the longest period of time. Note that RMAN can apply incremental backups to restored files that were not created as part of an incremental backup.


Note:

When RMAN applies incremental backups, it recovers changes to objects created with the NOLOGGING option. Applying archived redo logs to datafiles does not recover these changes.


See Also:

Oracle9i Recovery Manager User's Guide to learn how to recover datafiles

Restrictions and Usage Notes

Keywords and Parameters

Syntax Element Description

DEVICE TYPE deviceSpecifier

Allocates automatic channels for the specified device type only. For example, if you configure automatic disk and tape channels, and issue RECOVER ... DEVICE TYPE DISK, then RMAN allocates only disk channels.

See Also: "deviceSpecifier"

DATABASE

Specifies that the entire database is to be recovered. Unless you specify an untilClause, RMAN performs complete recovery.

Specifies a noncurrent time, SCN, or log sequence number for termination of the RECOVER command. You must open the database with the RESETLOGS option after incomplete recovery.

See Also: "untilClause"

SKIP [FOREVER] TABLESPACE

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 with 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.

Specifies a noncurrent time, SCN, or log sequence number for termination of the RECOVER command in TSPITR.

See Also: "untilClause"

DATAFILE datafileSpec

Specifies a list of one or more datafiles to recover. Specify datafiles by either filename (by using a quoted string) or absolute datafile number (by using an integer).

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 instance then fails before you can resynchronize the catalog. Specify the old name of the datafile in the RECOVER command, because this is the name recorded in the catalog.

See Also: "datafileSpec"

recoverOptionList

Specifies various recovery options.

DELETE ARCHIVELOG [MAXSIZE integer [K|M|G]]

Deletes archived logs restored from backups or copies that are no longer needed. RMAN does not delete archived logs that were already on disk before the RESTORE command started.

If you do not specify MAXSIZE, then RMAN deletes restored archived logs as they are applied. If you specify MAXSIZE, then RMAN will not use more than integer amount of disk space for restored archived logs. If recovery requires the restore of a log larger than the MAXSIZE value, then RMAN reports an error indicating that you should increase the MAXSIZE value. If MAXSIZE is smaller than the backup set containing the logs, then RMAN must read the backup set more than once. Hence, RMAN issues a warning that MAXSIZE should be increased.

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 by using incremental backups. If you do not specify NOREDO when recovering a NOARCHIVELOG database, then Oracle terminates recovery and issues an error.

Note: Incremental backups of NOARCHIVELOG databases must be taken after a consistent shutdown.

CHECK LOGICAL

Tests data and index blocks that pass physical corruption checks for logical corruption, for example, corruption of a row piece or index entry. If RMAN finds logical corruption, it logs the block in the alert.log and server session trace file.

Provided the sum of physical and logical corruptions detected for a file remain below its MAXCORRUPT setting, the RMAN command completes and Oracle populates V$DATABASE_BLOCK_CORRUPTION with corrupt block ranges. If MAXCORRUPT is exceeded, then the command terminates without populating the views.

Note: The MAXCORRUPT setting represents the total number of physical and logical corruptions permitted on a file.

FROM TAG = tag_name

Specifies the tag for an incremental backup to be used during recovery. If the tagged backup does not contain all the necessary incrementals for recovery, then RMAN uses logs or incremental backups as needed from whatever is available. Note that tag names are not case sensitive and display in all uppercase.

See Also: "BACKUP" to learn how a tag can be applied to an individual copy of a duplexed backup set, and to learn about the default filename format for backup tags

ARCHIVELOG TAG = tag_name

Specifies the tag for an archived log backup to be used during recovery. If the tagged backup does not contain all the necessary logs for recovery, RMAN uses logs or incremental backups as needed from whatever is available. Note that tag names are not case sensitive and display in all uppercase.

Examples

Recovering a Tablespace in an Open Database: Example

The following example takes tablespace tools offline, uses automatic channels to restore and recover it (deleting the logs that it restored from tape), then brings it back online:

SQL "ALTER TABLESPACE tools OFFLINE IMMEDIATE";
RESTORE TABLESPACE tools;
# restore only 2M of logs at a time, then delete them
RECOVER TABLESPACE tools DELETE ARCHIVELOG MAXSIZE 2M;
SQL "ALTER TABLESPACE tools ONLINE";
Recovering Datafiles Restored to New Locations: Example

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

RUN
{  
  ALLOCATE CHANNEL dev2 DEVICE TYPE sbt;  
  SQL "ALTER TABLESPACE users OFFLINE IMMEDIATE";  
  SET NEWNAME FOR DATAFILE '?/oradata/trgt/users01.dbf' 
    TO '/tmp/users01.dbf';
  RESTORE TABLESPACE users;
  SWITCH DATAFILE ALL;
  RECOVER TABLESPACE users;  
  SQL "ALTER TABLESPACE users ONLINE";  
}
Performing DBPITR with a Backup Control File and Recovery Catalog: Example

Assume that all datafiles and control files as well as archived redo log 40 were lost due to a disk failure. Because you do not have incremental backups, you need to recover the database with available archived redo logs. You do not need to restore tablespace history because it has not changed since log 40. After connecting to the target and recovery catalog, you do:

STARTUP FORCE NOMOUNT;
RUN
{  
  SET UNTIL SEQUENCE 530 THREAD 1;      # Recover database until log sequence 40 
  RESTORE CONTROLFILE TO '/tmp/control01.ctl';
  RESTORE CONTROLFILE FROM '/tmp/control01.ctl'; # Replicates to CONTROL_FILES locations
  ALTER DATABASE MOUNT;
  RESTORE DATABASE SKIP TABLESPACE temp, history;
  RECOVER DATABASE SKIP FOREVER TABLESPACE temp;
}
ALTER DATABASE OPEN RESETLOGS;
# if the database uses locally-managed temporary tablespaces, then you must add 
# tempfiles to these tablespaces after restoring a backup control file
SQL "ALTER TABLESPACE temp ADD TEMPFILE ''?/oradata/trgt/temp01.dbf'' REUSE";

Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback