RMAN> run{
debug on;
set until time "to_date('2013-08-08 19:12:03','yyyy-mm-dd hh24:mi:ss')";
restore database ;
debug off;
}
2> 3> 4> 5> 6>
RMAN-03036: Debugging set to level=9, types=ALL
RMAN-03023: executing command: SET until clause
RMAN-03090: Starting restore at 2013-08-15 10:19:14
RMAN-06009: using target database control file instead of recovery catalog
RMAN-08030: allocated channel: ORA_DISK_1
RMAN-08605: channel ORA_DISK_1: SID=661 instance=PTRDDB1 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/15/2013 10:19:18
RMAN-06026: some targets not found - aborting restore
RMAN-06100: no channel to restore a backup or copy of datafile 7
RMAN-06100: no channel to restore a backup or copy of datafile 4
RMAN-06100: no channel to restore a backup or copy of datafile 3
RMAN-06100: no channel to restore a backup or copy of datafile 2
RMAN-06100: no channel to restore a backup or copy of datafile 1
RMAN>
RMAN>
RMAN>
RMAN>
RMAN>
RMAN> run{
debug on;
set until time "to_date('2013-08-08 19:12:03','yyyy-mm-dd hh24:mi:ss')";
restore database preview;
debug off;
}2> 3> 4> 5> 6>
RMAN-03036: Debugging set to level=9, types=ALL
RMAN-03023: executing command: SET until clause
RMAN-03090: Starting restore at 2013-08-15 10:19:48
RMAN-12016: using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/15/2013 10:19:54
RMAN-06026: some targets not found - aborting restore
RMAN-06100: no channel to restore a backup or copy of datafile 7
RMAN-06100: no channel to restore a backup or copy of datafile 4
RMAN-06100: no channel to restore a backup or copy of datafile 3
RMAN-06100: no channel to restore a backup or copy of datafile 2
RMAN-06100: no channel to restore a backup or copy of datafile 1
检查数据文件的ABSOLUTE_FUZZY_CHANGE#,发现 出现问题的数据文件 1、2、3、4、7 有较大的ABSOLUTE_FUZZY_CHANGE#。
recid file# checkpoint_time checkpoint_change# ABSOLUTE_FUZZY_CHANGE#
3934 3 2013-08-08 19:00:50 424443795 424454469
3935 4 2013-08-08 19:00:50 424443795 424454521
3936 7 2013-08-08 19:00:50 424443795 424456295
3937 8 2013-08-08 19:00:50 424443795 0
3938 9 2013-08-08 19:00:50 424443795 0
3939 2 2013-08-08 19:00:50 424443795 424452449
3940 5 2013-08-08 19:00:50 424443795 0
3941 1 2013-08-08 19:00:50 424443795 424453386
3942 10 2013-08-08 19:00:50 424443795 0
3943 6 2013-08-08 19:00:50 424443795 0
3944 11 2013-08-08 19:00:50 424443795 0
3945 0 2013-08-08 19:00:50 424443795 0
3946 0 2013-08-08 19:00:50 424443795 0
3948 0 2013-08-08 19:00:50 424443795 0
3949 0 2013-08-08 19:27:03 424492130 0
对于restore until time而言要求数据文件备份的ABSOLUTE_FUZZY_CHANGE#对应的时间点要小于指定的until time 时间点,rman才认为该数据文件备份是有效的,否则将跳过该备份。
ABSOLUTE_FUZZY_CHANGE#是rman备份中服务进程读取到数据块中的High Scn,为了维护一致性要求 restore时恢复到的时间点 要 大约备份点对应的checkpoint_change#和ABSOLUTE_FUZZY_CHANGE#。
详见文档Common Causes for RMAN-06023 and RMAN-06026 (Doc ID 1366610.1)
Backup start on T1 (SCN=1000) and ends on T2 (SCN=1050), than the backup can ONLY be used if the UNTIL SCN is 1050 or higher.
So if the ‘UNTIL TIME T2′ is converted to SCN 1045, than this backup will NOT be used.
V$BACKUP_DATAFILE / RC_BACKUP_DATAFILE is giving more info on this.
CHECKPOINT_CHANGE# corresponds with T1
ABSOLUTE_FUZZY_CHANGE# corresponds with T2. When ABSOLUTE_FUZZY_CHANGE# is NULL, than it is the same as the CHECKPOINT_CHANGE#
我们测试使用restore until scn并指定大于ABSOLUTE_FUZZY_CHANGE#的一个SCN,可以绕过该问题:
RMAN> run
{
set until scn 424456295;
restore database preview;
}2> 3> 4> 5>
executing command: SET until clause
Starting restore at 2013-08-15 13:30:39
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=649 instance=PTRDDB1 device type=DISK
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
6719 Full 554.91M DISK 00:02:38 2013-08-08 19:07:21
BP Key: 6719 Status: AVAILABLE Compressed: YES Tag: TAG20130808T190511
Piece Name: /export/home/oracle/rman/ptddb_before_3nogq6j8
List of Datafiles in backup set 6719
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- ------------------- ----
但是使用该scn对应的时间点则失败:
通过dump logfile 获得scn对应的时间点:
scn 424456290 194CB062 194cb062 08/08/2013 19:07:00
scn 424464586 194CD0CA 194cd0ca 08/08/2013 19:12:03
scn 424456295 194CB067 194cb067 08/08/2013 19:07:00 ==>之前使用成功的SCN号对应的时间点
之前我们测试成功的scn 424456295 对应时间点08/08/2013 19:07:00, 但使用set until time该时间点仍报错
RMAN> run{
set until time "to_date('2013-08-08 19:07:20','yyyy-mm-dd hh24:mi:ss')";
restore database preview;
}2> 3> 4>
executing command: SET until clause
Starting restore at 2013-08-15 13:28:41
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 08/15/2013 13:28:42
RMAN-06026: some targets not found - aborting restore
RMAN-06100: no channel to restore a backup or copy of datafile 7
RMAN-06100: no channel to restore a backup or copy of datafile 4
RMAN-06100: no channel to restore a backup or copy of datafile 3
RMAN-06100: no channel to restore a backup or copy of datafile 2
RMAN-06100: no channel to restore a backup or copy of datafile 1
由于在数据库open之前没有严格的scn和时间的对照表,所以set until time时通过评估将时间转换为scn的, rman在这里只能做评估(estimate)。 特别是某个十分接近于备份结束的时间点的时间戳时,若该时间戳被转换为scn,且该scn小于对应备份的数据文件的ABSOLUTE_FUZZY_CHANGE#,则会造成该备份不可用。
该问题详见Common Causes for RMAN-06023 and RMAN-06026 (Doc ID 1366610.1)中的描述:
When an SET UNTIL TIME is being used, RMAN will convert it to an UNTIL SCN. This is an estimate as there is NO hard relation between a timestamp and an SCN.
RMAN is making an estimate. Especially when a timestamp is used which is close to the end-time of the backup, than this might be an issue. If the conversion to an SCN is generating an SCN which is BEFORE the end fuzziness of the datafiles in the backup, than the backup can NOT be used.
建议:
Restore database/datafile 建议优先使用set until scn 指定scn号,该scn号应当大于checkpoint_change#和ABSOLUTE_FUZZY_CHANGE#。
ABSOLUTE_FUZZY_CHANGE#信息可以通过V$BACKUP_DATAFILE视图获得。
--转自