Oracle® Database Recovery Manager Reference 10g Release 1 (10.1) Part Number B10770-01 |
|
|
View PDF |
untilClause::=
Text description of untilClause
A subclause that specifies an upper limit by time, SCN, or log sequence number for various RMAN operations.
See Also:
Oracle Database Backup and Recovery Basics to learn how to set the date format used by RMAN |
When specifying dates in RMAN commands, the date string must be either:
NLS_DATE_FORMAT
setting.DATE
, for example, 'SYSDATE-10'
or "TO_DATE('01/30/1997',
'MM/DD/YYYY')"
. Note that the second example includes its own date format mask and so is independent of the current NLS_DATE_FORMAT
setting.Following are examples of typical date settings in RMAN commands:
BACKUP ARCHIVELOG FROM TIME 'SYSDATE-31' UNTIL TIME 'SYSDATE-14'; RESTORE DATABASE UNTIL TIME "TO_DATE('09/20/00','MM/DD/YY')";
This example assumes that log sequence 1234 was lost due to a disk failure and the database needs to be recovered by using available archived redo logs.
RUN { SET UNTIL SEQUENCE 1234 THREAD 1; RESTORE CONTROLFILE TO '?/oradata/cf.tmp'; RESTORE CONTROLFILE FROM '?/oradata/cf.tmp'; # restores to all CONTROL_FILES locations ALTER DATABASE MOUNT; RESTORE DATABASE; RECOVER DATABASE; # recovers through log 1233 ALTER DATABASE OPEN RESETLOGS; # you must add new tempfiles to locally-managed temporary tablespaces after restoring # a backup control file SQL "ALTER TABLESPACE temp ADD TEMPFILE ''?/oradata/trgt/temp01.dbf'' REUSE"; }
This example (which assumes a mounted database) recovers the database until a specified SCN:
RUN { ALLOCATE CHANNEL ch1 TYPE sbt; RESTORE DATABASE; RECOVER DATABASE UNTIL SCN 1000; # recovers through SCN 999 ALTER DATABASE OPEN RESETLOGS; }
This example assumes that you want to be able to recover to any point within the last week. It considers as obsolete all backups that could be used to recover the database to a point one week ago:
REPORT OBSOLETE UNTIL TIME 'SYSDATE-7';