RMAN还原归档时报RMAN

一.问题描述:
由于生产库的归档备份由原来的文件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: Oracle 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

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/22c41bc36f8050e1ca343a33ace3597d.html