rman還原歸檔時報RMAN-20242錯誤分析和處理

531968912發表於2017-05-19

一.問題描述:
由於生產庫的歸檔備份由原來的檔案copy方式改成用rman來備份檔檔,需要驗證用rman能否正常還原出歸檔,所以在一個正在執行的庫上來用rman還原歸檔。
在測試庫主機上執行如下操作:
connect target /
connect catalog xxx/xxx@rman_11g;
run {
allocate channel c1 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
allocate channel c2 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
allocate channel c3 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
allocate channel c4 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
set archivelog destination to '/pdm/pdmsitdata/arch';
restore archivelog sequence between 126720 and 126723;
RELEASE CHANNEL c1;
RELEASE CHANNEL c2;
RELEASE CHANNEL c3;
RELEASE CHANNEL c4;
}
報RMAN-20242錯誤:
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 09/22/2016 10:55:10
RMAN-06004:  error from recovery catalog database: RMAN-20242: specification does not match any archived log in the repository

二.問題分析
在生產庫上檢視歸檔備份情況:
再在生產庫執行:list backup of archivelog sequence between 126720 and 126740;
能正常查出需要恢復的歸檔,如下:

List of Archived Logs in backup set 106409
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 126720 13264625429179 19-SEP-16 13264630177490 19-SEP-16
1 126721 13264630177490 19-SEP-16 13264633856924 19-SEP-16
1 126722 13264633856924 19-SEP-16 13264635340090 19-SEP-16
1 126723 13264635340090 19-SEP-16 13264636569222 19-SEP-16
1 126724 13264636569222 19-SEP-16 13264641943880 19-SEP-16
1 126725 13264641943880 19-SEP-16 13264650066165 19-SEP-16
1 126726 13264650066165 19-SEP-16 13264651755964 19-SEP-16
1 126727 13264651755964 19-SEP-16 13264653095621 19-SEP-16
1 126728 13264653095621 19-SEP-16 13264659008880 19-SEP-16
1 126729 13264659008880 19-SEP-16 13264659625618 19-SEP-16
1 126730 13264659625618 19-SEP-16 13264670245642 19-SEP-16
1 126731 13264670245642 19-SEP-16 13264676059672 19-SEP-16
1 126732 13264676059672 19-SEP-16 13264682985578 19-SEP-16
1 126733 13264682985578 19-SEP-16 13264683740014 19-SEP-16
1 126734 13264683740014 19-SEP-16 13264692162926 19-SEP-16
1 126735 13264692162926 19-SEP-16 13264696780989 19-SEP-16
1 126736 13264696780989 19-SEP-16 13264697482819 19-SEP-16
1 126737 13264697482819 19-SEP-16 13264702234852 19-SEP-16
1 126738 13264702234852 19-SEP-16 13264706967875 19-SEP-16
1 126739 13264706967875 19-SEP-16 13264711260507 19-SEP-16
1 126740 13264711260507 19-SEP-16 13264716460619 20-SEP-16
說明備份是存在的。
用下面指令碼按時間是可以正常還原歸檔,卻用sequence方式報錯。
connect target /
connect catalog xxx/xxx@rman_11g;
run {
allocate channel c1 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
allocate channel c2 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
allocate channel c3 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
allocate channel c4 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
set archivelog destination to '/pdm/pdmsitdata/arch';
restore archivelog from time 'sysdate-1'; 
RELEASE CHANNEL c1;
RELEASE CHANNEL c2;
RELEASE CHANNEL c3;
RELEASE CHANNEL c4;
}

resetlogs 後資料檔案中RESETLOGS SCN 和 time stamps 發生變化,與之前的備份出來的archivelog 的SCN\time stamps 不一致。不能進行恢復。

三.解決方法

在restore命令後加上incaration all後,可以正常還原。實際上在我們正常對測試環境進行覆蓋時,不會遇到問題。
RMAN> connect target /

connect catalog xxx/xxx@rman_11g;
run {
allocate channel c1 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
allocate channel c2 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
allocate channel c3 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
allocate channel c4 TYPE 'SBT_TAPE' parms 'ENV=(NSR_SERVER=mhpl800, NSR_CLIENT=msuu206)';
set archivelog destination to '/pdm/pdmsitdata/arch';
restore archivelog sequence between 126720 and 126723 INCARNATION ALL;
RELEASE CHANNEL c1;
RELEASE CHANNEL c2;
RELEASE CHANNEL c3;
RELEASE CHANNEL c4;
}
connected to target database: PDMSIT (DBID=3424929568)

RMAN> 
connected to recovery catalog database

RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 
allocated channel: c1
channel c1: SID=913 device type=SBT_TAPE
channel c1: NMDA Oracle v8.2.0

allocated channel: c2
channel c2: SID=937 device type=SBT_TAPE
channel c2: NMDA Oracle v8.2.0

allocated channel: c3
channel c3: SID=961 device type=SBT_TAPE
channel c3: NMDA Oracle v8.2.0

allocated channel: c4
channel c4: SID=985 device type=SBT_TAPE
channel c4: NMDA Oracle v8.2.0

executing command: SET ARCHIVELOG DESTINATION

Starting restore at 22-SEP-16

channel c1: starting archived log restore to user-specified destination
archived log destination=/pdm/pdmsitdata/arch
channel c1: restoring archived log
archived log thread=1 sequence=126720
channel c1: restoring archived log
archived log thread=1 sequence=126721
channel c1: restoring archived log
archived log thread=1 sequence=126722
channel c1: restoring archived log
archived log thread=1 sequence=126723
channel c1: reading from backup piece archlog_PDMDB_2krgboqv_1_1
channel c1: piece handle=archlog_PDMDB_2krgboqv_1_1 tag=TAG20160921T094602
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:08:25
Finished restore at 22-SEP-16

released channel: c1

released channel: c2

released channel: c3

released channel: c4

RMAN> exit
Recovery Manager complete.
l-bash-4.1$ ls -ltr
total 3927666
-rw-r----- 1 pdmsit dba 542332416 Sep 22 19:32 1_126722_814035104.dbf
-rw-r----- 1 pdmsit dba 490157568 Sep 22 19:35 1_126721_814035104.dbf
-rw-r----- 1 pdmsit dba 488429568 Sep 22 19:38 1_126723_814035104.dbf
-rw-r----- 1 pdmsit dba 488354816 Sep 22 19:38 1_126720_814035104.dbf

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

相關文章