SQL*Plus User's Guide and Reference
Release 8.1.5

A66736-01

Library

Product

Contents

Index

Prev Up Next

Command Reference, 34 of 52


RECOVER

Purpose

Performs media recovery on one or more tablespaces, one or more datafiles, or the entire database.

Syntax

RECOVER [AUTOMATIC][FROM location]
   {[STANDBY] DATABASE [UNTIL options][USING BACKUP CONTROLFILE] 
    |TABLESPACE {tablespace [, tablespace ...]}  
    |DATAFILE {datafilename [, datafilename ...]} 
    |STANDBY {TABLESPACE tablespace [,tablespace ...]
      |DATAFILE datafilename [, datafilename ...]} UNTIL CONTROLFILE
    |LOGFILE filename
    |CONTINUE [DEFAULT]
    |CANCEL}
   [PARALLEL clause]

where options requires the following syntax:

{CANCEL|CHANGE integer|TIME date}

and where clause requires the following syntax:

{PARALLEL ([DEGREE {integer|DEFAULT}|INSTANCES {integer|DEFAULT}]...)
|NOPARALLEL}

Terms and Clauses

Refer to the following list for a description of each term and clause:

AUTOMATIC

      Automatically generates the name of the next archived redo log file needed to continue the recovery operation. Oracle uses the LOG_ARCHIVE_DEST (or LOG_ARCHIVE_DEST_1) and LOG_ARCHIVE_FORMAT parameters (or their defaults) to generate the target redo log filename. If the file is found, the redo contained in that file is applied. If the file is not found, Oracle prompts you for a filename, displaying the generated filename as a suggestion.

      If you specify neither AUTOMATIC nor LOGFILE, Oracle prompts you for a filename, displaying the generated filename as a suggestion. You can then accept the generated filename or replace it with a fully qualified filename. If you know the archived filename differs from what Oracle would generate, you can save time by using the LOGFILE clause.

FROM location

      Specifies the location from which the archived redo log file group is read. The value of location must be a fully specified file location following the conventions of your operating system. If you omit this parameter, Oracle assumes the archived redo log file group is in the location specified by the initialization parameter LOG_ARCHIVE_DEST or LOG_ARCHIVE_DEST_1.

STANDBY

      Recovers the standby database using the control file and archived redo log files copied from the primary database. The standby database must be mounted but not open.

DATABASE

      Recovers the entire database.

UNTIL CANCEL

      Specifies an incomplete, cancel-based recovery. Recovery proceeds by prompting you with the suggested filenames of archived redo log files, and recovery completes when you specify CANCEL instead of a filename.

UNTIL CHANGE integer

      Specifies an incomplete, change-based recovery. integer is the number of the System Change Number (SCN) following the last change you wish to recover. For example, if you want to restore your database up to the transaction with an SCN of 9, you would specify UNTIL CHANGE 10.

UNTIL TIME date

      Specifies an incomplete, time-based recovery. Use single quotes, and the following format:

      'YYYY-MM-DD:HH24:MI:SS'
      
USING BACKUP CONTROLFILE

      Specifies that a backup of the control file be used instead of the current control file.

TABLESPACE tablespace

      Recovers a particular tablespace. tablespace is the name of a tablespace in the current database. You may recover up to 16 tablespaces in one statement.

DATAFILE datafilename

      Recovers a particular datafile. You can specify any number of datafiles.

STANDBY {TABLESPACE tablespace [, tablespace ...]

[DATAFILE datafilename [, datafilename ...]}

UNTIL CONTROLFILE

      Specifies that the recovery of an old standby datafile or tablespace uses the current standby database control file.

LOGFILE filename

      Continues media recovery by applying the specified redo log file.

CONTINUE [DEFAULT]

      Continues multi-instance recovery after it has been interrupted to disable a thread.

      Continues recovery using the redo log file that Oracle would automatically generate if no other logfile were specified. This option is equivalent to specifying AUTOMATIC, except that Oracle does not prompt for a filename.

CANCEL

      Terminates cancel-based recovery.

PARALLEL DEGREE integer

      Specifies the number of recovery processes used to apply redo entries to datafiles on each instance. An integer specified for DEGREE overrides the initialization parameter RECOVERY_PARALLELISM.

PARALLEL DEGREE DEFAULT

      Indicates that twice the number of datafiles being recovered is the number of recovery processes to use.

PARALLEL INSTANCES integer

      Specifies the number of instances to use for parallel recovery.

      The number of recovery processes specified with DEGREE is used on each instance. Thus, the total number of recovery processes is the integer specified with DEGREE multiplied by the integer specified with INSTANCES. INSTANCES is only pertinent for the Oracle Parallel Server.

PARALLEL INSTANCES DEFAULT

      INSTANCES DEFAULT or not including the INSTANCES keyword causes has operating system-specific consequences. For more information about the default behavior of the INSTANCES DEFAULT specification, see the Oracle8i Parallel Server Concepts and Administration manual.

NOPARALLEL

      Specifies that recovery is to proceed serially. Note that a specification of PARALLEL(DEGREE 1 INSTANCES 1) is equivalent to specifying the NOPARALLEL keyword.

The PARALLEL keyword overrides the RECOVERY_PARALLELISM initialization parameter. The number specified with the PARALLEL keyword is the number of recovery processes used to apply redo entries to datafiles. For more information about the PARALLEL keyword see the Oracle8i Parallel Server Concepts and Administration manual.

Usage Notes

Note, you must be connected to Oracle as SYSOPER, or SYSDBA. You cannot use the RECOVER command when connected via the multi-threaded server.

To perform media recovery on an entire database (all tablespaces), the database must be mounted EXCLUSIVE and closed.

To perform media recovery on a tablespace, the database must be mounted and open, and the tablespace must be offline.

To perform media recovery on a datafile, the database can remain open and mounted with the damaged datafiles offline (unless the file is part of the SYSTEM tablespace).

Before using the RECOVER command you must have restored copies of the damaged datafile(s) from a previous backup. Be sure you can access all archived and online redo log files dating back to when that backup was made.

When another log file is required during recovery, a prompt suggests the names of files that are needed. The name is derived from the values specified in the initialization parameters LOG_ARCHIVE_DEST and LOG_ARCHIVE_FORMAT. You should restore copies of the archived redo log files needed for recovery to the destination specified in LOG_ARCHIVE_DEST, if necessary. You can override the initialization parameters by setting the LOGSOURCE variable with the SET LOGSOURCE command.

During recovery you can accept the suggested log name by pressing return, cancel recovery by entering CANCEL instead of a log name, or enter AUTO at the prompt for automatic file selection without further prompting.

If you have enabled autorecovery (that is, SET AUTORECOVERY ON), recovery proceeds without prompting you with filenames. Status messages are displayed when each log file is applied.

When normal media recovery is done, a completion status is returned.

For more information on recovery and the RECOVER command, see the Oracle8i Administrator's Guide, and the Oracle8i Backup and Recovery guide.

Examples

To recover the entire database, enter

SQL> RECOVER DATABASE 

To recover the database until a specified time, enter

SQL> RECOVER DATABASE UNTIL TIME 23-NOV-98:04:32:00 

To recover the two tablespaces ts_one and ts_two from the database, enter

SQL> RECOVER TABLESPACE ts_one, ts_two 

To recover the datafile data1.db from the database, enter

SQL> RECOVER DATAFILE 'data1.db' 

Prev Up Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index