Performing a Point-in-Time Restore of the Entire Database
This section resembles the previous example with the exception that you must restore all data files, then perform a point-in-time restore of the entire database.
RMAN> host 'ls -ltr /ora1/app/oracle/oradata/orcl/*dbf';
-rw-r----- 1 oracle oinstall 37756928 Oct 24 08:41 /ora1/app/oracle/oradata/orcl/temp01.dbf
-rw-r----- 1 oracle oinstall 5251072 Oct 24 14:39 /ora1/app/oracle/oradata/orcl/users01.dbf
-rw-r----- 1 oracle oinstall 262152192 Oct 24 14:39 /ora1/app/oracle/oradata/orcl/undotbs01.dbf
-rw-r----- 1 oracle oinstall 734011392 Oct 24 14:39 /ora1/app/oracle/oradata/orcl/system01.dbf
-rw-r----- 1 oracle oinstall 870391808 Oct 24 14:39 /ora1/app/oracle/oradata/orcl/sysaux01.dbf
-rw-r----- 1 oracle oinstall 104865792 Oct 24 14:39 /ora1/app/oracle/oradata/orcl/example01.dbf
RMAN> host 'rm /ora1/app/oracle/oradata/orcl/*dbf';
host command complete
RMAN> host 'ls -ltr /ora1/app/oracle/oradata/orcl/*dbf';
ls: /ora1/app/oracle/oradata/orcl/*dbf: No such file or directory
At this point, all data files are deleted to simulate the problem. Perform a Quick Restore of the latest backup so that the paths cataloged in RMAN become valid and accessible.
RMAN> restore database device type disk;
Starting restore at 24-OCT-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=153 device type=DISK
channel ORA_DISK_1: restoring datafile 00001
input datafile copy RECID=156 STAMP=668953032 file name=/tmp/bexoracle_orcl_1224864495/akash/_ora1/app/oracle/oradata/orcl/system01.dbf
destination for restore of datafile 00001: /ora1/app/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00001
output file name=/ora1/app/oracle/oradata/orcl/system01.dbf RECID=0 STAMP=0
channel ORA_DISK_1: restoring datafile 00002
input datafile copy RECID=157 STAMP=668953034 file name=/tmp/bexoracle_orcl_1224864495/akash/_ora1/app/oracle/oradata/orcl/sysaux01.dbf
destination for restore of datafile 00002: /ora1/app/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00002
output file name=/ora1/app/oracle/oradata/orcl/sysaux01.dbf RECID=0 STAMP=0
channel ORA_DISK\_1: restoring datafile 00003
input datafile copy RECID=154 STAMP=668953029 file name=/tmp/bexoracle_orcl_1224864495/akash/_ora1/app/oracle/oradata/orcl/undotbs01.dbf
destination for restore of datafile 00003: /ora1/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00003
output file name=/ora1/app/oracle/oradata/orcl/undotbs01.dbf RECID=0 STAMP=0
channel ORA_DISK_1: restoring datafile 00004
input datafile copy RECID=155 STAMP=668953031 file name=/tmp/bexoracle_orcl_1224864495/akash/_ora1/app/oracle/oradata/orcl/users01.dbf
destination for restore of datafile 00004: /ora1/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK\_1: copied datafile copy of datafile 00004
output file name=/ora1/app/oracle/oradata/orcl/users01.dbf RECID=0 STAMP=0
channel ORA_DISK_1: restoring datafile 00005
input datafile copy RECID=158 STAMP=668953035 file name=/tmp/bexoracle_orcl_1224864495/akash/_ora1/app/oracle/oradata/orcl/example01.dbf
destination for restore of datafile 00005: /ora1/app/oracle/oradata/orcl/example01.dbf
channel ORA_DISK_1: copied datafile copy of datafile 00005
output file name=/ora1/app/oracle/oradata/orcl/example01.dbf RECID=0 STAMP=0
Finished restore at 24-OCT-08
RMAN> list copy of archivelog like '%1224864495%';
List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================
Key Thrd Seq S Low Time
------- ---- ------- - ---------
205 1 30 A 24-OCT-08
Name: /tmp/bexoracle_orcl_1224864495/akash/LOGS/1_30_668010235.dbf
In this example, recover the database up to the point-in-time when the last backup was performed. There is only one archive log that is necessary to recover from this backup. Find the target SCN number by entering the following:
alter system dump logfile '/tmp/bexoracle_orcl_1224864495/akash/LOGS/1_30_668010235.dbf';
Then check the Next scn value in the header of the dumped file. In this example, the value is 3806925.
RMAN> recover database until scn 3806925;
Starting recover at 24-OCT-08
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:02
Finished recover at 24-OCT-08
RMAN> sql 'alter database open resetlogs';