Skip Headers
Oracle® Database Backup and Recovery Reference
11g Release 1 (11.1)

Part Number B28273-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

untilClause

Purpose

Use the untilClause subclause to specify an upper limit by time, SCN, restore point or log sequence number for various RMAN operations.

Syntax

untilClause::=

untilClause syntax diagram
Description of the illustration untilclause.gif

Semantics

Syntax Element Description
UNTIL SCN integer Specifies an SCN as an upper, noninclusive limit.

RMAN selects only files that can be used to restore or recover up to but not including the specified SCN (see Example 3-35). For example, RESTORE DATABASE UNTIL SCN 1000 chooses only backups that could be used to recover to SCN 1000.

UNTIL SEQUENCE integer Specifies a redo log sequence number and thread as an upper, noninclusive limit.

RMAN selects only files that can be used to restore or recover up to but not including the specified sequence number. For example, REPORT OBSOLETE UNTIL SEQUENCE 8000 reports only backups that could be used to recover through log sequence 7999.

   THREAD integer Specifies the number of the redo thread.
UNTIL TIME 'date_string' Specifies a time as an upper, noninclusive limit (see Example 3-36).

RMAN selects only files that can be used to restore and recover up to but not including the specified time. For example, LIST BACKUP UNTIL TIME 'SYSDATE-7' lists all backups that could be used to recover to a point one week ago.

When specifying dates in RMAN commands, the date string must be either:

  • A literal string whose format matches the NLS_DATE_FORMAT setting.

  • A SQL expression of type DATE, for example, 'SYSDATE-10' or "TO_DATE('01/30/2007', '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/06','MM/DD/YY')";

Examples

Example 3-35 Performing Incomplete Recovery to a Specified SCN

This example, which assumes a mounted database, recovers the database up to (but not including) the specified SCN:

STARTUP FORCE MOUNT
RUN
{
  SET UNTIL SCN 1418901;  # set to 1418901 to recover database through SCN 1418900
  RESTORE DATABASE;
  RECOVER DATABASE;
}
ALTER DATABASE OPEN RESETLOGS;

Example 3-36 Reporting Obsolete Backups

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';