Performing Time/ Sequence Based
Problem
You want to restore your database to a previous date and time.
Solution
You can restore your database to a previous time in one of two ways:
• Specify the time as part of the restore and recover commands. (until time)
• Use the set until time command, and then issue unqualified restore and recover
commands. (set until time)
RMAN> connect target /
RMAN> startup mount;
RMAN> restore database until time [until sequence 50;]
2> "to_date('05-oct-2006 14:00:00', 'dd-mon-rrrr hh24:mi:ss')";
RMAN> recover database until time
2> "to_date('05-oct-2006 14:00:00', 'dd-mon-rrrr hh24:mi:ss')";
RMAN> alter database open resetlogs;
Database altered
NOTE :
You can also specify the time by using the set until time command. This command and
the subsequent restore and recover must be executed from within a run{} block:
RMAN> connect target /
RMAN> startup mount;
RMAN> run{ [set until sequence 125;]
RMAN> set until time "to_date('05-oct-2006 14:00:00', 'dd-mon-rrrr hh24:mi:ss')";
RMAN> restore database;
RMAN> recover database;
RMAN> }
RMAN> alter database open resetlogs;
Database altered
Problem
You want to restore your database to a previous date and time.
Solution
You can restore your database to a previous time in one of two ways:
• Specify the time as part of the restore and recover commands. (until time)
• Use the set until time command, and then issue unqualified restore and recover
commands. (set until time)
RMAN> connect target /
RMAN> startup mount;
RMAN> restore database until time [until sequence 50;]
2> "to_date('05-oct-2006 14:00:00', 'dd-mon-rrrr hh24:mi:ss')";
RMAN> recover database until time
2> "to_date('05-oct-2006 14:00:00', 'dd-mon-rrrr hh24:mi:ss')";
RMAN> alter database open resetlogs;
Database altered
NOTE :
You can also specify the time by using the set until time command. This command and
the subsequent restore and recover must be executed from within a run{} block:
RMAN> connect target /
RMAN> startup mount;
RMAN> run{ [set until sequence 125;]
RMAN> set until time "to_date('05-oct-2006 14:00:00', 'dd-mon-rrrr hh24:mi:ss')";
RMAN> restore database;
RMAN> recover database;
RMAN> }
RMAN> alter database open resetlogs;
Database altered