Friday, September 18, 2009

RMAN: Restore database preview

Sample output for RESTORE DATABASE PREVIEW


RMAN> restore database preview;

Starting restore at 2009-MAY-22 11:24:50
using channel ORA_DISK_1


List of Backup Sets
===================


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------------
1 Full 209.16M DISK 00:01:50 2009-MAY-22 11:21:04
BP Key: 1 Status: AVAILABLE Compressed: YES Tag: TAG20090522T111914
Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2009_05_22/o1_mf_nnndf_TAG20090522T111914_51d6fm3b_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- -------------------- ----
1 Full 1621673 2009-MAY-22 11:19:15 /u01/app/oracle/oradata/ORCL/system01.dbf
2 Full 1621673 2009-MAY-22 11:19:15 /u01/app/oracle/oradata/ORCL/sysaux01.dbf
3 Full 1621673 2009-MAY-22 11:19:15 /u01/app/oracle/oradata/ORCL/undotbs01.dbf
4 Full 1621673 2009-MAY-22 11:19:15 /u01/app/oracle/oradata/ORCL/users01.dbf

List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key Thrd Seq S Low Time
------- ---- ------- - --------------------
30 1 97 A 2009-MAY-22 11:11:24
Name: /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2009_05_22/o1_mf_1_97_51d6kvcr_.arc

Media recovery start SCN is 1621093
Recovery must be done beyond SCN 1621673 to clear datafile fuzziness
Finished restore at 2009-MAY-22 11:24:51

RMAN> exit


Recovery Manager complete.


How to find log sequences used during the recovery

From above restore preview, we confirm that all redo logs generated from SCN 1621093 and 1621673 will be used.


SQL> select thread#,sequence# from v$archived_log
2 where --cross begin backup only (sample SEQ# 90)
3 (first_change#<=1621093 and next_change#>=1621093 and next_change#<=1621673)
4 or --within begin backup and end backup (sample SEQ# 91,92)
5 (first_change#>=1621093 and next_change#<=1621673)
6 or --cross end backup only (sample SEQ# 93)
7 (first_change#>=1621093 and first_change#<=1621673 and next_change#>=1621673)
8 or --cross begin backup and end backup (sample SEQ# 150)
9 (first_change#<=1621093 and next_change#>=1621673)
10 ;

THREAD# SEQUENCE#
---------- ----------
1 97