RAC歸檔日誌還原一例

jelephant發表於2015-12-05
系統環境是10.2.0.5,RAC,歸檔日誌在node1上建立了nfs共享,而node2上沒有建立nfs共享。另有一套查詢庫,透過DSG的同步軟體將資料從生產庫上同步到查詢庫上。軟體原理是透過傳輸分析歸檔日誌然後加以應用,總體感覺有點像DG。由於生產庫上使用的是增量備份,每天都進行備份。且備份完後會自動刪除歸檔日誌。恢復生產庫的歸檔日誌的原因是,同步到查詢庫時失敗(採用DSG的備份軟體時,當遇到大量DML操作時經常遇到同步失敗的情況),需要重新同步,但歸檔日誌已經被刪除,故需要還原歸檔日誌。查詢庫昨日17:00後的資料同步失敗,故需要還原從昨日至今的歸檔日誌。系統環境交代到這,下面是具體的實施步驟。
在node1上進行操作
透過v$archived_log找到17:00以後的歸檔日誌序列號
select sequence#,completion_time from v$archived_log where completion_time > to_date('2012-02-15','hh24:mi:ss');
查詢得出從sequence#為16147開始的歸檔日誌為2012-02-17 17:00以後的歸檔日誌
執行
$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Feb 16 13:07:12 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: ZGSCDB (DBID=3629726729)
RMAN> run{
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate channel c3 type disk;
5> allocate channel c4 type disk;
6> set archivelog destination to '/arch_log/restore';
7> restore archivelog from logseq 16147;
8> release channel c1 ;
9> release channel c2;
10> release channel c3;
11> release channel c4;
12> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: sid=4834 instance=zgscdb1 devtype=DISK
allocated channel: c2
channel c2: sid=5333 instance=zgscdb1 devtype=DISK
allocated channel: c3
channel c3: sid=4879 instance=zgscdb1 devtype=DISK
allocated channel: c4
channel c4: sid=5317 instance=zgscdb1 devtype=DISK
executing command: SET ARCHIVELOG DESTINATION
Starting restore at 16-FEB-12
released channel: c1
released channel: c2
released channel: c3
released channel: c4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/16/2012 13:10:53
RMAN-20242: specification does not match any archive log in the recovery catalog
RMAN> list archivelog from logseq 16147;
沒有任何輸出,鬱悶。。。。。。。。。
RMAN> list backup of archivelog all;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5115 169.62M DISK 00:00:09 12-FEB-12
        BP Key: 12219 Status: AVAILABLE Compressed: NO Tag: TAG20120212T014331
        Piece Name: /rman_data/zgscdb_rman/ZGSCDB_arch_20120212_0tn33hqa_s5149_p1_C1
  List of Archived Logs in backup set 5115
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  1 13769 12663219622525 11-FEB-12 12663220068092 11-FEB-12
  1 13770 12663220068092 11-FEB-12 12663220426071 11-FEB-12
  1 13771 12663220426071 11-FEB-12 12663220887716 11-FEB-12
  1 13772 12663220887716 11-FEB-12 12663222831310 12-FEB-12
省略部分輸出
  List of Archived Logs in backup set 5197
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  2 16176 12670019198216 15-FEB-12 12670023192712 15-FEB-12
  2 16177 12670023192712 15-FEB-12 12670025565356 16-FEB-12
  2 16178 12670025565356 16-FEB-12 12670026143737 16-FEB-12
  2 16179 12670026143737 16-FEB-12 12670026897385 16-FEB-12
  2 16180 12670026897385 16-FEB-12 12670027305649 16-FEB-12
  2 16181 12670027305649 16-FEB-12 12670027693987 16-FEB-12
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5198 13.00G DISK 00:01:07 16-FEB-12
 List of Archived Logs in backup set 5193
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  2 16148 12670010177819 15-FEB-12 12670011207570 15-FEB-12
  2 16149 12670011207570 15-FEB-12 12670012283915 15-FEB-12
  2 16150 12670012283915 15-FEB-12 12670012754302 15-FEB-12
  2 16151 12670012754302 15-FEB-12 12670012969887 15-FEB-12
  2 16152 12670012969887 15-FEB-12 12670013212670 15-FEB-12
  2 16153 12670013212670 15-FEB-12 12670013780868 15-FEB-12
  2 16154 12670013780868 15-FEB-12 12670013976009 15-FEB-12
  2 16155 12670013976009 15-FEB-12 12670015183858 15-FEB-12
  2 16156 12670015183858 15-FEB-12 12670015441965 15-FEB-12
  2 16157 12670015441965 15-FEB-12 12670015599451 15-FEB-12
  2 16158 12670015599451 15-FEB-12 12670015722094 15-FEB-12
  2 16159 12670015722094 15-FEB-12 12670015785593 15-FEB-12
  2 16160 12670015785593 15-FEB-12 12670015847887 15-FEB-12
  2 16161 12670015847887 15-FEB-12 12670016000750 15-FEB-12
  Backup Set Copy #1 of backup set 5193
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK 00:03:55 16-FEB-12 NO TAG20120216T010430
    List of Backup Pieces for backup set 5193 Copy #1
    BP Key Pc# Status Piece Name
    ------- --- ----------- ----------
    12560 1 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p1_C1
    12561 2 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p2_C1
    12562 3 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p3_C1
  List of Archived Logs in backup set 5198
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  2 16134 12668052207072 15-FEB-12 12668052339209 15-FEB-12
  2 16135 12668052339209 15-FEB-12 12668052456743 15-FEB-12
  2 16136 12668052456743 15-FEB-12 12668052579080 15-FEB-12
  2 16137 12668052579080 15-FEB-12 12668052695760 15-FEB-12
  2 16138 12668052695760 15-FEB-12 12668056672468 15-FEB-12
  2 16139 12668056672468 15-FEB-12 12668060445745 15-FEB-12
  2 16140 12668060445745 15-FEB-12 12668062444755 15-FEB-12
  2 16141 12668062444755 15-FEB-12 12668660576479 15-FEB-12
  2 16142 12668660576479 15-FEB-12 12668660718987 15-FEB-12
  2 16143 12668660718987 15-FEB-12 12668660871830 15-FEB-12
  2 16144 12668660871830 15-FEB-12 12668661303733 15-FEB-12
  2 16145 12668661303733 15-FEB-12 12668661585953 15-FEB-12
  2 16146 12668661585953 15-FEB-12 12668662079217 15-FEB-12
  2 16147 12668662079217 15-FEB-12 12670010177819 15-FEB-12
  Backup Set Copy #1 of backup set 5198
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK 00:01:07 16-FEB-12 NO TAG20120216T010430
    List of Backup Pieces for backup set 5198 Copy #1
    BP Key Pc# Status Piece Name
    ------- --- ----------- ----------
    12573 1 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_3an3e18j_s5226_p1_C1
    12574 2 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_3an3e18j_s5226_p2_C1
    12575 3 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_3an3e18j_s5226_p3_C1
  List of Archived Logs in backup set 5195
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  2 16162 12670016000750 15-FEB-12 12670016088204 15-FEB-12
  2 16163 12670016088204 15-FEB-12 12670016308969 15-FEB-12
  2 16164 12670016308969 15-FEB-12 12670016653192 15-FEB-12
  2 16165 12670016653192 15-FEB-12 12670017027396 15-FEB-12
  2 16166 12670017027396 15-FEB-12 12670017225549 15-FEB-12
  2 16167 12670017225549 15-FEB-12 12670017317060 15-FEB-12
  2 16168 12670017317060 15-FEB-12 12670017393441 15-FEB-12
  2 16169 12670017393441 15-FEB-12 12670017462567 15-FEB-12
  2 16170 12670017462567 15-FEB-12 12670017541021 15-FEB-12
  2 16171 12670017541021 15-FEB-12 12670017654244 15-FEB-12
  2 16172 12670017654244 15-FEB-12 12670017735163 15-FEB-12
  2 16173 12670017735163 15-FEB-12 12670017811611 15-FEB-12
  2 16174 12670017811611 15-FEB-12 12670017888323 15-FEB-12
  2 16175 12670017888323 15-FEB-12 12670019198216 15-FEB-12
  Backup Set Copy #1 of backup set 5195
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK 00:03:56 16-FEB-12 NO TAG20120216T010430
    List of Backup Pieces for backup set 5195 Copy #1
    BP Key Pc# Status Piece Name
    ------- --- ----------- ----------
    12566 1 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_38n3e111_s5224_p1_C1
    12567 2 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_38n3e111_s5224_p2_C1
    12568 3 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_38n3e111_s5224_p3_C1
可以看到從日誌序列號為16147到16181的歸檔日誌備份全部存。那為什麼執行list backup of archivelog from logseq 16147;時沒有輸出呢?
查了下rman的list語法,執行如下命令
RMAN>list backup of archivelog from time "to_date('2012-02-15 17:00:00','yyyy-mm-dd hh24:mi:ss')";
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5189 287.12M DISK 00:00:04 16-FEB-12
        BP Key: 12552 Status: AVAILABLE Compressed: NO Tag: TAG20120216T010430
        Piece Name: /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_37n3e111_s5223_p1_C1
  List of Archived Logs in backup set 5189
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  1 14153 12670027303388 16-FEB-12 12670027694268 16-FEB-12
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5190 9.98G DISK 00:02:45 16-FEB-12
  List of Archived Logs in backup set 5190
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  1 14131 12668662080221 15-FEB-12 12670012207947 15-FEB-12
  1 14132 12670012207947 15-FEB-12 12670012971251 15-FEB-12
  1 14133 12670012971251 15-FEB-12 12670013978444 15-FEB-12
  1 14134 12670013978444 15-FEB-12 12670015440149 15-FEB-12
  1 14135 12670015440149 15-FEB-12 12670015722540 15-FEB-12
  1 14136 12670015722540 15-FEB-12 12670016001416 15-FEB-12
  Backup Set Copy #1 of backup set 5190
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK 00:02:45 16-FEB-12 NO TAG20120216T010430
    List of Backup Pieces for backup set 5190 Copy #1
    BP Key Pc# Status Piece Name
    ------- --- ----------- ----------
    12553 1 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_35n3e111_s5221_p1_C1
    12554 2 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_35n3e111_s5221_p2_C1
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5192 12.30G DISK 00:03:09 16-FEB-12
  List of Archived Logs in backup set 5192
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  1 14137 12670016001416 15-FEB-12 12670016653312 15-FEB-12
  1 14138 12670016653312 15-FEB-12 12670017030219 15-FEB-12
  1 14139 12670017030219 15-FEB-12 12670017394454 15-FEB-12
  1 14140 12670017394454 15-FEB-12 12670017657280 15-FEB-12
  1 14141 12670017657280 15-FEB-12 12670017890908 15-FEB-12
  1 14142 12670017890908 15-FEB-12 12670018260012 15-FEB-12
  1 14143 12670018260012 15-FEB-12 12670020257257 15-FEB-12
  1 14144 12670020257257 15-FEB-12 12670022421290 15-FEB-12
  1 14145 12670022421290 15-FEB-12 12670023190650 15-FEB-12
  1 14146 12670023190650 15-FEB-12 12670024544870 15-FEB-12
  1 14147 12670024544870 15-FEB-12 12670026609312 16-FEB-12
  1 14148 12670026609312 16-FEB-12 12670026743414 16-FEB-12
  1 14149 12670026743414 16-FEB-12 12670026894479 16-FEB-12
  1 14150 12670026894479 16-FEB-12 12670027048502 16-FEB-12
  1 14151 12670027048502 16-FEB-12 12670027176883 16-FEB-12
  1 14152 12670027176883 16-FEB-12 12670027303388 16-FEB-12
  Backup Set Copy #1 of backup set 5192
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK 00:03:09 16-FEB-12 NO TAG20120216T010430
    List of Backup Pieces for backup set 5192 Copy #1
    BP Key Pc# Status Piece Name
    ------- --- ----------- ----------
    12557 1 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_32n3e111_s5218_p1_C1
    12558 2 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_32n3e111_s5218_p2_C1
    12559 3 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_32n3e111_s5218_p3_C1
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5193 13.27G DISK 00:03:55 16-FEB-12
  List of Archived Logs in backup set 5193
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  2 16148 12670010177819 15-FEB-12 12670011207570 15-FEB-12
  2 16149 12670011207570 15-FEB-12 12670012283915 15-FEB-12
  2 16150 12670012283915 15-FEB-12 12670012754302 15-FEB-12
  2 16151 12670012754302 15-FEB-12 12670012969887 15-FEB-12
  2 16152 12670012969887 15-FEB-12 12670013212670 15-FEB-12
  2 16153 12670013212670 15-FEB-12 12670013780868 15-FEB-12
  2 16154 12670013780868 15-FEB-12 12670013976009 15-FEB-12
  2 16155 12670013976009 15-FEB-12 12670015183858 15-FEB-12
  2 16156 12670015183858 15-FEB-12 12670015441965 15-FEB-12
  2 16157 12670015441965 15-FEB-12 12670015599451 15-FEB-12
  2 16158 12670015599451 15-FEB-12 12670015722094 15-FEB-12
  2 16159 12670015722094 15-FEB-12 12670015785593 15-FEB-12
  2 16160 12670015785593 15-FEB-12 12670015847887 15-FEB-12
  2 16161 12670015847887 15-FEB-12 12670016000750 15-FEB-12
  Backup Set Copy #1 of backup set 5193
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK 00:03:55 16-FEB-12 NO TAG20120216T010430
    List of Backup Pieces for backup set 5193 Copy #1
    BP Key Pc# Status Piece Name
    ------- --- ----------- ----------
    12560 1 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p1_C1
    12561 2 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p2_C1
    12562 3 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p3_C1
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5195 13.28G DISK 00:03:56 16-FEB-12
  List of Archived Logs in backup set 5195
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  2 16162 12670016000750 15-FEB-12 12670016088204 15-FEB-12
  2 16163 12670016088204 15-FEB-12 12670016308969 15-FEB-12
  2 16164 12670016308969 15-FEB-12 12670016653192 15-FEB-12
  2 16165 12670016653192 15-FEB-12 12670017027396 15-FEB-12
  2 16166 12670017027396 15-FEB-12 12670017225549 15-FEB-12
  2 16167 12670017225549 15-FEB-12 12670017317060 15-FEB-12
  2 16168 12670017317060 15-FEB-12 12670017393441 15-FEB-12
  2 16169 12670017393441 15-FEB-12 12670017462567 15-FEB-12
  2 16170 12670017462567 15-FEB-12 12670017541021 15-FEB-12
  2 16171 12670017541021 15-FEB-12 12670017654244 15-FEB-12
  2 16172 12670017654244 15-FEB-12 12670017735163 15-FEB-12
  2 16173 12670017735163 15-FEB-12 12670017811611 15-FEB-12
  2 16174 12670017811611 15-FEB-12 12670017888323 15-FEB-12
  2 16175 12670017888323 15-FEB-12 12670019198216 15-FEB-12
  Backup Set Copy #1 of backup set 5195
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK 00:03:56 16-FEB-12 NO TAG20120216T010430
    List of Backup Pieces for backup set 5195 Copy #1
    BP Key Pc# Status Piece Name
    ------- --- ----------- ----------
    12566 1 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_38n3e111_s5224_p1_C1
    12567 2 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_38n3e111_s5224_p2_C1
    12568 3 AVAILABLE /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_38n3e111_s5224_p3_C1
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5197 3.02G DISK 00:00:26 16-FEB-12
        BP Key: 12572 Status: AVAILABLE Compressed: NO Tag: TAG20120216T010430
        Piece Name: /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_3bn3e18n_s5227_p1_C1
  List of Archived Logs in backup set 5197
  Thrd Seq Low SCN Low Time Next SCN Next Time
  ---- ------- ---------- --------- ---------- ---------
  2 16176 12670019198216 15-FEB-12 12670023192712 15-FEB-12
  2 16177 12670023192712 15-FEB-12 12670025565356 16-FEB-12
  2 16178 12670025565356 16-FEB-12 12670026143737 16-FEB-12
  2 16179 12670026143737 16-FEB-12 12670026897385 16-FEB-12
  2 16180 12670026897385 16-FEB-12 12670027305649 16-FEB-12
  2 16181 12670027305649 16-FEB-12 12670027693987 16-FEB-12
看到都需要的歸檔日誌都包含進去了,滿心歡喜的執行如下命令
RMAN> run{
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate channel c3 type disk;
5> allocate channel c4 type disk;
6> set archivelog destination to '/arch_log/restore';
7> restore archivelog from time "to_date('2012-02-15 17:00:00','yyyy-mm-dd hh24:mi:ss')";
8> release channel c1;
9> release channel c2;
10> release channel c3;
11> release channel c4;
12> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: sid=4849 instance=zgscdb1 devtype=DISK
allocated channel: c2
channel c2: sid=5326 instance=zgscdb1 devtype=DISK
allocated channel: c3
channel c3: sid=4946 instance=zgscdb1 devtype=DISK
allocated channel: c4
channel c4: sid=4879 instance=zgscdb1 devtype=DISK
executing command: SET ARCHIVELOG DESTINATION
Starting restore at 16-FEB-12
archive log thread 1 sequence 14155 is already on disk as file /arch_log/zgsc_db01_arch/1_14155_743864713.dbf
archive log thread 1 sequence 14156 is already on disk as file /arch_log/zgsc_db01_arch/1_14156_743864713.dbf
archive log thread 1 sequence 14157 is already on disk as file /arch_log/zgsc_db01_arch/1_14157_743864713.dbf
archive log thread 1 sequence 14158 is already on disk as file /arch_log/zgsc_db01_arch/1_14158_743864713.dbf
archive log thread 1 sequence 14159 is already on disk as file /arch_log/zgsc_db01_arch/1_14159_743864713.dbf
archive log thread 1 sequence 14160 is already on disk as file /arch_log/zgsc_db01_arch/1_14160_743864713.dbf
archive log thread 1 sequence 14161 is already on disk as file /arch_log/zgsc_db01_arch/1_14161_743864713.dbf
archive log thread 1 sequence 14162 is already on disk as file /arch_log/zgsc_db01_arch/1_14162_743864713.dbf
archive log thread 1 sequence 14163 is already on disk as file /arch_log/zgsc_db01_arch/1_14163_743864713.dbf
archive log thread 1 sequence 14164 is already on disk as file /arch_log/zgsc_db01_arch/1_14164_743864713.dbf
archive log thread 1 sequence 14165 is already on disk as file /arch_log/zgsc_db01_arch/1_14165_743864713.dbf
released channel: c1
released channel: c2
released channel: c3
released channel: c4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/16/2012 13:47:51
RMAN-06026: some targets not found - aborting restore
RMAN-06025: no backup of log thread 2 seq 16209 lowscn 12670043591603 found to restore
RMAN-06025: no backup of log thread 2 seq 16208 lowscn 12670043181908 found to restore
RMAN-06025: no backup of log thread 2 seq 16207 lowscn 12670043081120 found to restore
RMAN-06025: no backup of log thread 2 seq 16206 lowscn 12670042973201 found to restore
RMAN-06025: no backup of log thread 2 seq 16205 lowscn 12670042654302 found to restore
RMAN-06025: no backup of log thread 2 seq 16204 lowscn 12670041610965 found to restore
RMAN-06025: no backup of log thread 2 seq 16203 lowscn 12670040751853 found to restore
RMAN-06025: no backup of log thread 2 seq 16202 lowscn 12670040584982 found to restore
RMAN-06025: no backup of log thread 2 seq 16201 lowscn 12670040305341 found to restore
RMAN-06025: no backup of log thread 2 seq 16200 lowscn 12670039987074 found to restore
RMAN-06025: no backup of log thread 2 seq 16199 lowscn 12670039745774 found to restore
RMAN-06025: no backup of log thread 2 seq 16198 lowscn 12670039250107 found to restore
RMAN-06025: no backup of log thread 2 seq 16197 lowscn 12670038751777 found to restore
RMAN-06025: no backup of log thread 2 seq 16196 lowscn 12670038122926 found to restore
RMAN-06025: no backup of log thread 2 seq 16195 lowscn 12670037110291 found to restore
RMAN-06025: no backup of log thread 2 seq 16194 lowscn 12670036384317 found to restore
RMAN-06025: no backup of log thread 2 seq 16193 lowscn 12670036130529 found to restore
RMAN-06025: no backup of log thread 2 seq 16192 lowscn 12670035930022 found to restore
RMAN-06025: no backup of log thread 2 seq 16191 lowscn 12670035736951 found to restore
RMAN-06025: no backup of log thread 2 seq 16190 lowscn 12670034378583 found to restore
RMAN-06025: no backup of log thread 2 seq 16189 lowscn 12670033507562 found to restore
RMAN-06025: no backup of log thread 2 seq 16188 lowscn 12670032888750 found to restore
RMAN-06025: no backup of log thread 2 seq 16187 lowscn 12670031934562 found to restore
RMAN-06025: no backup of log thread 2 seq 16186 lowscn 12670031295273 found to restore
RMAN-06025: no backup of log thread 2 seq 16185 lowscn 12670029669200 found to restore
RMAN-06025: no backup of log thread 2 seq 16184 lowscn 12670029122812 found to restore
RMAN-06025: no backup of log thread 2 seq 16183 lowscn 12670027774997 found to restore
RMAN-06025: no backup of log thread 2 seq 16182 lowscn 12670027693987 found to restore
報錯,鬱悶,超級鬱悶
$ ls /arch_log/zgsc_01_arch
1_14155_743864713.dbf 1_14158_743864713.dbf 1_14161_743864713.dbf 1_14164_743864713.dbf 1_14167_743864713.dbf
1_14156_743864713.dbf 1_14159_743864713.dbf 1_14162_743864713.dbf 1_14165_743864713.dbf
1_14157_743864713.dbf 1_14160_743864713.dbf 1_14163_743864713.dbf 1_14166_743864713.dbf
觀察報錯發現沒有找到的備份資訊主要都是thread 2的備份資訊,結合上面ls命令的輸出分析得出,執行緒為1日誌序列號從14155至14166的歸檔日誌雖然為2012-02-15 17:00之後的歸檔日誌,但卻仍再使用。使用restore archivelog from time "to_date('2012-02-15 17:00:00','yyyy-mm-dd hh24:mi:ss')";命令恢復時會提示already on disk。結合list backup of archivelog from time "to_date('2012-02-15 17:00:00','yyyy-mm-dd hh24:mi:ss')";和
node1
$ ls /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p1_C1
ls: 0653-341 The file /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p1_C1 does not exist
node2
$ ls /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_35n3e111_s5221_p1_C1
ls: 0653-341 The file /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_35n3e111_s5221_p1_C1 does not exist.
發現雙節點都只有各自的備份檔案,備份檔案沒有進行儲存共享的配置(出於安全考慮,確實不應該把備份配置成共享的,不過設定成nfs掛載應該是沒問題)。呵呵,犯了個低階錯誤。
經過以上分析得出,restore archivelog from time "to_date('2012-02-15 17:00:00','yyyy-mm-dd hh24:mi:ss')";命令會自動查詢所需的備份檔案進行還原,但是由於雙節點無法同時訪問所有需要備份檔案,故需在特定節點還原指定的日誌序列號,進行逐個還原,即 需要在相應的例項上還原相應thread對應的歸檔日誌。
thread的意義: RAC環境下,多臺主機同時訪問位於共有的磁碟陣列的共同的資料庫結構。每臺主機上的資料庫例程分別寫自己的日誌檔案,不同的例程透過thread來區分。
於是根據list backup of archivelog from time "to_date('2012-02-15 17:00:00','yyyy-mm-dd hh24:mi:ss')"
命令得出的歸檔日誌和備份資訊,執行如下命令恢復
在RAC節點node 1上執行
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
set archivelog destination to '/arch_log/restore';
restore archivelog from logseq 14131 until logseq 14153 thread 1;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
在RAC節點node 2上執行
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
set archivelog destination to '/arch_log/restore';
restore archivelog from logseq 16148 until logseq 16181 thread 2;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
}
還原成功。
這裡順帶說一句,如果需要進行資料庫恢復,那麼必須在能夠訪問所有歸檔日誌的節點上進行,這裡是node1

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

相關文章