Oracle® Database Recovery Manager Reference 10g Release 1 (10.1) Part Number B10770-01 |
|
|
View PDF |
restore::=
Text description of restoreObject
Text description of restoreSpecOperand
autoBackupOptList::=
Text description of autoBackupOptList
The primary use of RESTORE is to restore files from backups or image copies. Typically, you restore when a media failure has damaged a current datafile, control file, or archived log or prior to performing a point-in-time recovery.
There are two other uses of RESTORE:
RMAN chooses which backups to restore based on the criteria that you specify. For example, you can limit the restore to backups before a given point of time (within the current incarnation) with the untilClause
.
When you run RESTORE
in CATALOG
mode with a backup control file, RMAN automatically adjusts the control file to reflect the structure of the restored database.
If you restore to the default location (that is, you do not run SET
NEWNAME
), then RMAN overwrites files with the same filenames. If you restore to a new location, then issue SET
NEWNAME
commands to rename the files and issue a SWITCH
command to make the restored files current. If you do not issue SWITCH
commands, then RMAN considers the restored files as valid copies for use in future restore operations.
If you do not run SET
NEWNAME
and RMAN detects that the default filename cannot be used (for example, because the filename is in use by another database that shares the storage), and if the file is an Oracle Managed File or is on an Automatic Storage Management disk group, then RMAN attempts to create a new file in the same location or disk group.
If you do not manually allocate channels, then RMAN allocates all automatic channels possibly needed by the RESTORE
command, subject to any restrictions imposed by the use of the DEVICE
TYPE
option.
For example, assume you configure 3 separate sbt
channels (each with different PARMS
) and then configure parallelism for DISK
and sbt
as follows:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2; CONFIGURE DEVICE TYPE sbt PARALLELISM 3; CONFIGURE DEFAULT DEVICE TYPE TO sbt;
If you run RESTORE
in this configuration, then RMAN allocates three sbt
channels and the two preconfigured DISK
channels.
If a backup piece, image copy or proxy copy is inaccessible (for instance, deleted from the device) or if a block is corrupted, then the RESTORE command automatically looks for a another usable copy of this backup piece or image copy on both the same device and other devices. If no usable copies are available, then RMAN searches for prior backups. RMAN continously searches for prior usable backups until it has exhaused all possibilities.
Restore failover also occurs when restoring archivelogs for use in RECOVER, BLOCKRECOVER
and FLASHBACK
operations. RMAN records messages about failover due to block corruption in the alert log and trace files.
See Oracle Database Backup and Recovery Advanced User's Guide for details on restore failover.
In a Real Application Clusters configuration, RMAN automatically restores backups, control file copies, and datafile copies from channels that can read the files on tape or a local file system. For example, if channel 1 connected to instance 1 can read log 1000 from its tape drive, but channel 2 connected to instance 2 cannot read the same log from its tape drive, then channel 1 restores the log. Autolocation is automatically enabled when the channels meet any of the following criteria:
PARMS
settingsCONNECT
strings
See Also:
Oracle Database Backup and Recovery Basics to learn how to restore files |
SET
NEWNAME
commands to rename the datafiles and SWITCH
commands to make them the current database files. If you do not use SWITCH
, then the repository lists restored datafiles as datafile copies.FROM
DATAFILECOPY
option, then the allocated channels must be of DEVICE
TYPE
DISK
.FROM
BACKUPSET
operand, then the appropriate type of storage devices must be allocated for the backup sets that need to be restored. If the appropriate device is not allocated, then you may not be able to find a candidate backup set or copy to restore, and the RESTORE
command fails.RESTORE
command.
For example, if you made some backups of a datafile to DISK
channels and others to sbt
channels, and only a DISK
channel is allocated for the RESTORE
command, RMAN will not restore backups that were created on sbt
channels.
RESTORE
a datafile without re-creating the symbolic link, then RMAN restores the datafile to the location of the link file rather than to the location pointed to by the link.NOCATALOG
mode, then the RESTORE
SPFILE
command requires the FROM
AUTOBACKUP
clause.RESTORE
CONTROLFILE
FROM
AUTOBACKUP
, mount this control file, and then run RESTORE
SPFILE
without the FROM
AUTOBACKUP
clause.datafile 1
is both specified explicitly and implied by the SYSTEM
tablespace:
RESTORE TABLESPACE SYSTEM DATAFILE 1;
CONFIGURE
(except for DISK
, which is preconfigured) before specifying the DEVICE
TYPE
option.RECOVER
DEVICE
TYPE
.LIST
RECOVERABLE
to see valid parent incarnations.RECOVER
DATABASE
and then open the database with the RESETLOGS
option.OPEN
RESETLOGS
. If you do not, then the database can display the following error for when attempting to sort: ORA-25153:
Temporary
Tablespace
is
Empty
.Table 2-27 indicates the restrictions that apply in different situations involving the RESTORE
CONTROLFILE
command.
RESTORE CONTROLFILE; | RESTORE CONTROLFILE FROM AUTOBACKUP; | RESTORE CONTROLFILE ... TO 'filename'; | RESTORE CONTROLFILE ... FROM 'media_handle' or TAG 'user_tag'; | |
---|---|---|---|---|
No catalog, target started in NOMOUNT state |
Error. Must specify |
First run |
First run |
First run |
No catalog, target mounted or open |
Error. Must use |
Error. Must use |
Restores only to |
Restores from specified file. If |
Catalog, target started in NOMOUNT state |
Restores to |
Only use with catalog for testing purposes. |
Restores only to |
Restores from specified file. If |
Catalog, target mounted or open |
Error. Must use |
Do not use with catalog. |
Restores only to |
Restores from specified file. If |
Syntax Element | Description |
---|---|
|
Refer to the |
|
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 If the total number of physical and logical corruptions detected in a file is less than its If the initialization parameter Note: The |
|
Checks the read-only datafiles to make sure they exist, are readable, and have the appropriate checkpoint. If any of these conditions is not met, then RMAN restores the files--whether or not they are read-only. By default, RMAN does not restore read-only files when you issue the |
|
Allocates automatic channels for the specified device type only. For example, if you configure automatic disk and tape channels, and issue See Also: "deviceSpecifier" |
|
Overrides the restartable restore feature and restores all files regardless of whether they need to be restored. If you do not specify |
|
Specifies whether RMAN should restore from a |
|
Refer to the |
|
When See Also: "LIST", and specifically the |
Limits the selection to backup sets or file copies that are suitable for a point-in-time recovery to the specified time. In the absence of any other criteria, RMAN selects the most current file copy or backup set to restore. Note that the time specified in the untilClause must fall within the current incarnation. See Also: "untilClause" | |
|
Lets RMAN decide which backup sets, datafile copies, and archived logs need to be restored and then scans them to verify their contents. No files will be restored. Use this option periodically to verify that the copies and backup sets required to restore the specified files are intact and usable. |
Syntax Element | Description |
---|---|
|
Specifies the objects to be restored. The |
Restores the specified range of archived redo logs. The default restore location is Because the See Also: "archivelogRecordSpecifier" Note: The database can be started, mounted, or open for this operation. | |
|
Restores the current control file for a primary database. See Also: Table 2-27 for restrictions and usage notes. Note: You must always run the |
|
Restores all datafiles in the database except those that are offline or read-only. Unlike If you specify the Use an optional If you specify |
|
Restores the datafiles specified by filename or absolute datafile number. See Also: "datafileSpec" |
|
Restores a primary or Specify If the server parameter file is lost, connect to the target (and catalog if used) and then run See Also: "Restrictions and Usage Notes for the SET DBID Command" |
|
Restores the current control file for a standby database. See Also: Table 2-27 for restrictions and usage notes. Note: You must always run the |
|
Restores all datafiles in the specified tablespaces. The translates the tablespace name internally into a list of datafiles. If you rename a tablespace (for example, from |
Syntax Element | Description |
---|---|
|
Specifies options for the Note: These parameters override the parameters with the same name at the |
|
Specifies the case-sensitive name of a channel to use for this restore operation. If you do not specify a channel, then |
|
Restores a control file autobackup. You can only specify this option on the RMAN begins the search on the current day or on the day specified with the See Also: Table 2-27 for restrictions and usage notes. |
|
Specifies the name of the control file copy or backup piece containing a control file. The See Also: Table 2-27 for restrictions and usage notes. |
|
Overrides the default selection of the most recent backups or file copy available. The tag restricts the automatic selection to backup sets or file copies that were created with the specified tag. If multiple backup sets or file copies have a matching tag, then RMAN selects the most recent one. Note that tag names are not case sensitive. See Also: "BACKUP" for a description of how a tag can be applied to an individual copy of a duplexed backup set, and for a description of the default filename format for tags |
This example takes a tablespace offline, restores it, then performs media recovery:
SQL "ALTER TABLESPACE users OFFLINE IMMEDIATE"; RESTORE TABLESPACE users; RECOVER TABLESPACE users; SQL "ALTER TABLESPACE users ONLINE";
This example restores the control file to its default location, replicates it automatically to all CONTROL_FILES
locations, and mounts the database:
RUN { # SET DBID is not necessary when connected to a recovery catalog STARTUP FORCE NOMOUNT; RESTORE CONTROLFILE; ALTER DATABASE MOUNT; }
This NOCATALOG
example restores the control file specified by a tag, and then mounts the database:
CONNECT TARGET / STARTUP NOMOUNT; SET DBID 320066378; # required when restoring control file in NOCATALOG mode RESTORE CONTROLFILE FROM TAG 'monday_cf_backup'; ALTER DATABASE MOUNT;
This example restores the control file to a temporary location, replicates it to all control file locations specified in the CONTROL_FILES
initialization parameter, and then restores and recovers the database:
CONNECT TARGET / STARTUP NOMOUNT; SET DBID 320066378; # required when restoring control file in NOCATALOG mode RUN { ALLOCATE CHANNEL c1 DEVICE TYPE sbt; RESTORE CONTROLFILE TO '/tmp/control01.ctl' FROM AUTOBACKUP; RESTORE CONTROLFILE FROM '/tmp/control01.ctl'; # restores to all CONTROL_FILES locations ALTER DATABASE MOUNT; RESTORE DATABASE; RECOVER DATABASE; } ALTER DATABASE OPEN RESETLOGS; # if the database uses locally-managed temporary tablespaces, then add new tempfiles # to these tablespaces after the RESETLOGS SQL "ALTER TABLESPACE temp ADD TEMPFILE ''?/oradata/trgt/temp01.dbf'' REUSE";
This example restores all archived redo logs to the /oracle/temp_restore
directory:
RMAN> RUN { SET ARCHIVELOG DESTINATION TO '/oracle/temp_restore'; RESTORE ARCHIVELOG ALL; }
This example restores the latest control file autobackup made on or before June 23, 2000 with a nondefault format of PROD_CF_AUTOBACKUP_%F
. It starts searching for backups with a sequence number of 20, and searches backward for 5 months:
RMAN> SET DBID 320066378; # required when restoring control file in NOCATALOG mode RMAN> RUN { SET UNTIL TIME '23-JUN-2001 00:00:00'; SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE sbt TO 'prod_cf_autobackup_%F'; ALLOCATE CHANNEL CHANNEL_1 DEVICE TYPE sbt; RESTORE CONTROLFILE TO '/tmp/autobackup_20001002.dbf' FROM AUTOBACKUP MAXSEQ 20 MAXDAYS 150; }
The following series of commands restores the current server parameter file in NOCATALOG
mode:
rman TARGET / RMAN> SET DBID 1447326980 # set dbid to dbid of target database RMAN> STARTUP FORCE NOMOUNT; # start instance with dummy SPFILE RMAN> RUN { ALLOCATE CHANNEL c1 DEVICE TYPE sbt; RESTORE SPFILE FROM AUTOBACKUP; # FROM AUTOBACKUP needed in NOCATALOG mode } RMAN> STARTUP FORCE; # start with restored SPFILE and open database
'The following example shows the results of a RESTORE PREVIEW
, which identifies the backupsets to use in restoring datafile 1 of a database:
RMAN> restore datafile 1 preview; Starting restore at 10-OCT-03 using target database controlfile instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=18 devtype=DISK List of Backup Sets =================== BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ --------------- 25 Full 264M DISK 00:00:42 10-OCT-03 BP Key: 25 Status: AVAILABLE Compressed: NO Tag: FOURTH_INC Piece Name: /ade/banand_hosted5/oracle/work/v1/0pf3hr3o_1 List of Datafiles in backup set 25 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- --------- ---- 1 Full 228006 10-OCT-03 /disk1/oracle/dbs/tbs_01.f Finished restore at 10-OCT-03
The following example illustrates using RESTORE VALIDATE
for the restore of datafile 1, as in the previous example:
RMAN> RESTORE DATAFILE 1 VALIDATE; Starting restore at 10-OCT-03 using channel ORA_DISK_1 channel ORA_DISK_1: starting validation of datafile backupset channel ORA_DISK_1: restored backup piece 1 piece handle=/disk1/oracle/work/v1/0pf3hr3o_1 tag=FOURTH_INC channel ORA_DISK_1: validation complete Finished restore at 10-OCT-03