Oracle 11g RMAN恢復-場景1:所有的資料檔案損壞,資料庫CLOSE

yuntui發表於2016-11-03

--檢視當前日誌組

sys@TESTDB11>select sequence#, group#, status from v$log;

 

 SEQUENCE#     GROUP# STATUS

---------- ---------- ----------------

        22          1 INACTIVE

        23          2 INACTIVE

        24          3 CURRENT

--日誌切換5

sys@TESTDB11>alter system switch logfile;

 

System altered.

 

sys@TESTDB11>select sequence#, group#, status from v$log;

 

 SEQUENCE#     GROUP# STATUS

---------- ---------- ----------------

        28          1 INACTIVE

        29          2 CURRENT

        27          3 INACTIVE

--關庫後,所有資料丟失

sys@TESTDB11>shutdown abort;

ORACLE instance shut down.

 

sys@TESTDB11>! rm /oradata/ *.dbf

 

--RMAN恢復

--先啟動例項到mount狀態

RMAN> startup mount;

 

Oracle instance started

database mounted

 

Total System Global Area     855982080 bytes

 

Fixed Size                     2230792 bytes

Variable Size                641730040 bytes

Database Buffers             209715200 bytes

Redo Buffers                   2306048 bytes

--檢視備份集

RMAN> list backup;

 

 

List of Backup Sets

===================

 

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ ---------------

62      Full    1.25G      DISK        00:02:39     14-AUG-13     

        BP Key: 62   Status: AVAILABLE  Compressed: NO  Tag: TAG20130814T070001

        Piece Name: /pooldisk02/backup03/22oh8mbh_1_1

  List of Datafiles in backup set 62

  File LV Type Ckp SCN    Ckp Time  Name

  ---- -- ---- ---------- --------- ----

  1       Full 2647806    14-AUG-13 /oradata/system01.dbf

  2       Full 2647806    14-AUG-13 /oradata/sysaux01.dbf

  3       Full 2647806    14-AUG-13 /oradata/undotbs01.dbf

  4       Full 2647806    14-AUG-13 /oradata/users01.dbf

  5       Full 2647806    14-AUG-13 /oradata/example01.dbf

  6       Full 2647806    14-AUG-13 /oradata/newts01.dbf

  7       Full 2647806    14-AUG-13 /oradata/fbtbs01.dbf

  8       Full 2647806    14-AUG-13 /oradata/users02.dbf

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ ---------------

63      Full    9.67M      DISK        00:00:02     14-AUG-13     

        BP Key: 63   Status: AVAILABLE  Compressed: NO  Tag: TAG20130814T070246

        Piece Name: /u01/app/oracle/fast_recovery_area/TESTDB11/autobackup/2013_08_14/o1_mf_s_823417366_90pwh7q8_.bkp

  SPFILE Included: Modification time: 14-AUG-13

  SPFILE db_unique_name: TESTDB11

  Control File Included: Ckp SCN: 2648076      Ckp time: 14-AUG-13

 

--還原

RMAN> restore database;

 

Starting restore at 14-AUG-13

configuration for DISK channel 2 is ignored

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=18 device type=DISK

 

channel ORA_DISK_1: starting datafile backup set restore

channel ORA_DISK_1: specifying datafile(s) to restore from backup set

channel ORA_DISK_1: restoring datafile 00001 to /oradata/system01.dbf

channel ORA_DISK_1: restoring datafile 00002 to /oradata/sysaux01.dbf

channel ORA_DISK_1: restoring datafile 00003 to /oradata/undotbs01.dbf

channel ORA_DISK_1: restoring datafile 00004 to /oradata/users01.dbf

channel ORA_DISK_1: restoring datafile 00005 to /oradata/example01.dbf

channel ORA_DISK_1: restoring datafile 00006 to /oradata/newts01.dbf

channel ORA_DISK_1: restoring datafile 00007 to /oradata/fbtbs01.dbf

channel ORA_DISK_1: restoring datafile 00008 to /oradata/users02.dbf

channel ORA_DISK_1: reading from backup piece /pooldisk02/backup03/22oh8mbh_1_1

channel ORA_DISK_1: piece handle=/pooldisk02/backup03/22oh8mbh_1_1 tag=TAG20130814T070001

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:02:06

Finished restore at 14-AUG-13

--實地檢查

[oracle@S1011:/oradata]$ ls

example01.dbf  fbtbs01.dbf    newts01.dbf    sysaux01.dbf   system01.dbf   undotbs01.dbf  users01.dbf    users02.dbf

--恢復

RMAN> recover database;

 

Starting recover at 14-AUG-13

using channel ORA_DISK_1

 

starting media recovery

 

archived log for thread 1 with sequence 24 is already on disk as file /archive1/1_24_823328120.dbf

archived log for thread 1 with sequence 25 is already on disk as file /archive1/1_25_823328120.dbf

archived log for thread 1 with sequence 26 is already on disk as file /archive1/1_26_823328120.dbf

archived log for thread 1 with sequence 27 is already on disk as file /archive1/1_27_823328120.dbf

archived log for thread 1 with sequence 28 is already on disk as file /archive1/1_28_823328120.dbf

archived log file name=/archive1/1_24_823328120.dbf thread=1 sequence=24

archived log file name=/archive1/1_25_823328120.dbf thread=1 sequence=25

archived log file name=/archive1/1_26_823328120.dbf thread=1 sequence=26

media recovery complete, elapsed time: 00:00:05

Finished recover at 14-AUG-13

 

--開庫

RMAN> open database;

 

database opened

--確認資料

sys@TESTDB11>select * from scott.dept;

 

    DEPTNO DNAME          LOC

---------- -------------- -------------

        10 ACCOUNTING     NEW YORK

        20 RESEARCH       DALLAS

        30 SALES          CHICAGO

        40 OPERATIONS     BOSTON

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30633755/viewspace-2127657/,如需轉載,請註明出處,否則將追究法律責任。

相關文章