① 脚本
RMAN> run { 2> recover copy of database with tag 'ICIU1'; 3> backup 4> incremental level 1 tag 'ICIU1' 5> for recover of copy with tag 'ICIU1' 6> database plus archivelog delete input; 7> }
其中、for recover of copy with tag、这告诉 RMAN、所创建的增量备份集将用于镜像拷贝
② 注释
该脚本可以每天运行、每一天运行:
Ⅰ recover copy 命令用前一天的 1 级增量备份更新每个数据文件的镜像拷贝
如果找不到镜像拷贝去更新或者 1 级增量备份去运用
recover copy 命令只是简单地发出一条消息、但不报错
Ⅱ backup 命令创建一个 1 级增量备份集、然而、
如果一个 0 级镜像拷贝不存在、那么、首先、backup 命令会先创建一个 0 级镜像
因此、在任何时候、你有可用于恢复的:
⑴ 最多 48 小时的镜像拷贝
⑵ 最多 24 小时的 1 级增量备份集
⑶ 在线和归档日志去支持完全恢复或者基于时间点的恢复
使用这个策略、去做一次完全恢复、你将不会运用超过 24 小时的归档日志
recover copy 命令会运用所有 1 级增量备份集到带有'ICIU1'标签的镜像拷贝上
注意、2 条命令里的 tag 是必须的
③ 第一次运行【创建 0 级镜像拷贝】
第一次运行 ICIU 脚本:
● recover copy 找不到可更新的镜像拷贝、所以、RMAN 返回了"no copy of datafile 1 found to recover"
● backup 命令意识到这里没有 0 级镜像拷贝(参阅返回消息"no parent backup or copy of datafile 1 found")
因此、RMAN 会为每个数据文件创建一份 0 级镜像拷贝
RMAN> run{ 2> recover copy of database with tag 'ICIU007'; 3> backup 4> incremental level 1 tag 'ICIU007' 5> for recover of copy with tag 'ICIU007' 6> database plus archivelog delete input; 7> } Starting recover at 06-APR-13 using channel ORA_DISK_1 no copy of datafile 1 found to recover no copy of datafile 2 found to recover no copy of datafile 3 found to recover no copy of datafile 4 found to recover Finished recover at 06-APR-13 ...... ...... 此处省略 N 个字 ...... Starting backup at 06-APR-13 using channel ORA_DISK_1 no parent backup or copy of datafile 1 found no parent backup or copy of datafile 3 found no parent backup or copy of datafile 2 found no parent backup or copy of datafile 4 found channel ORA_DISK_1: starting datafile copy input datafile fno=00001 name=/u01/app/oracle/oradata/oracle10/system01.dbf output filename=/u01/app/oracle/flash_recovery_area/ORACLE10G/datafile/o1_mf_system_8p06t0nt_.dbf tag=ICIU007 recid=3 stamp=812062572 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:46 channel ORA_DISK_1: starting datafile copy input datafile fno=00003 name=/u01/app/oracle/oradata/oracle10/sysaux01.dbf output filename=/u01/app/oracle/flash_recovery_area/ORACLE10G/datafile/o1_mf_sysaux_8p06vgsb_.dbf tag=ICIU007 recid=4 stamp=812062601 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:27 channel ORA_DISK_1: starting datafile copy input datafile fno=00002 name=/u01/app/oracle/oradata/oracle10/undotbs01.dbf output filename=/u01/app/oracle/flash_recovery_area/ORACLE10G/datafile/o1_mf_undotbs1_8p06wb6c_.dbf tag=ICIU007 recid=5 stamp=812062604 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03 channel ORA_DISK_1: starting datafile copy input datafile fno=00004 name=/u01/app/oracle/oradata/oracle10/users01.dbf output filename=/u01/app/oracle/flash_recovery_area/ORACLE10G/datafile/o1_mf_users_8p06wffr_.dbf tag=ICIU007 recid=6 stamp=812062605 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 channel ORA_DISK_1: starting incremental level 1 datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current control file in backupset ...... ......
④ 第二次运行【创建 1 级增量备份集】
第二次运行 ICIU 脚本:
● backup 命令创建 1 级增量备份
● recover copy 命令依然没有起作用、因为、虽然第一次运行时已经创建了 0 级镜像拷贝
但、仍然没有 1 级增量备份
然而、"no copy of datafile 1 found to recover"这消息提示多少有些误导人了
RMAN> run{ 2> recover copy of database with tag 'ICIU007'; 3> backup 4> incremental level 1 tag 'ICIU007' 5> for recover of copy with tag 'ICIU007' 6> database plus archivelog delete input; 7> } Starting recover at 07-APR-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=139 devtype=DISK no copy of datafile 1 found to recover no copy of datafile 2 found to recover no copy of datafile 3 found to recover no copy of datafile 4 found to recover Finished recover at 07-APR-13 Starting backup at 07-APR-13 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=11 recid=9 stamp=812149977 channel ORA_DISK_1: starting piece 1 at 07-APR-13 channel ORA_DISK_1: finished piece 1 at 07-APR-13 piece handle=/u01/app/oracle/flash_recovery_area/ORACLE10G/backupset/2013_04_07/o1_mf_annnn_ICIU007_8p2w6tv2_.bkp tag=ICIU007 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 channel ORA_DISK_1: deleting archive log(s) archive log filename=/u01/app/oracle/flash_recovery_area/ORACLE10G/archivelog/2013_04_07/o1_mf_1_11_8p2w6sbt_.arc recid=9 stamp=812149977 Finished backup at 07-APR-13 Starting backup at 07-APR-13 using channel ORA_DISK_1 channel ORA_DISK_1: starting incremental level 1 datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00001 name=/u01/app/oracle/oradata/oracle10/system01.dbf input datafile fno=00003 name=/u01/app/oracle/oradata/oracle10/sysaux01.dbf input datafile fno=00002 name=/u01/app/oracle/oradata/oracle10/undotbs01.dbf input datafile fno=00004 name=/u01/app/oracle/oradata/oracle10/users01.dbf channel ORA_DISK_1: starting piece 1 at 07-APR-13 channel ORA_DISK_1: finished piece 1 at 07-APR-13 piece handle=/u01/app/oracle/flash_recovery_area/ORACLE10G/backupset/2013_04_07/o1_mf_nnnd1_ICIU007_8p2w6y6y_.bkp tag=ICIU007 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 channel ORA_DISK_1: starting incremental level 1 datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current control file in backupset ...... ......
⑤ 第三次运行
第三次运行 ICIU 脚本:
● recover copy 命令运用前一天创建的增量 1 集备份集到数据文件镜像拷贝
● backup 命令创建一个新的 1 级增量备份集
RMAN> run{ 2> recover copy of database with tag 'ICIU007'; 3> backup 4> incremental level 1 tag 'ICIU007' 5> for recover of copy with tag 'ICIU007' 6> database plus archivelog delete input; 7> } Starting recover at 08-APR-13 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=139 devtype=DISK channel ORA_DISK_1: starting incremental datafile backupset restore channel ORA_DISK_1: specifying datafile copies to recover recovering datafile copy fno=00001 name=/u01/app/oracle/flash_recovery_area/ORACLE10G/datafile/o1_mf_system_8p06t0nt_.dbf recovering datafile copy fno=00002 name=/u01/app/oracle/flash_recovery_area/ORACLE10G/datafile/o1_mf_undotbs1_8p06wb6c_.dbf recovering datafile copy fno=00003 name=/u01/app/oracle/flash_recovery_area/ORACLE10G/datafile/o1_mf_sysaux_8p06vgsb_.dbf recovering datafile copy fno=00004 name=/u01/app/oracle/flash_recovery_area/ORACLE10G/datafile/o1_mf_users_8p06wffr_.dbf channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/ORACLE10G/backupset/2013_04_07/o1_mf_nnnd1_ICIU007_8p2w6y6y_.bkp channel ORA_DISK_1: restored backup piece 1 piece handle=/u01/app/oracle/flash_recovery_area/ORACLE10G/backupset/2013_04_07/o1_mf_nnnd1_ICIU007_8p2w6y6y_.bkp tag=ICIU007 channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 Finished recover at 08-APR-13 Starting backup at 08-APR-13 current log archived using channel ORA_DISK_1 channel ORA_DISK_1: starting archive log backupset channel ORA_DISK_1: specifying archive log(s) in backup set input archive log thread=1 sequence=13 recid=11 stamp=812239310 channel ORA_DISK_1: starting piece 1 at 08-APR-13 channel ORA_DISK_1: finished piece 1 at 08-APR-13 piece handle=/u01/app/oracle/flash_recovery_area/ORACLE10G/backupset/2013_04_08/o1_mf_annnn_ICIU007_8p5mgj9t_.bkp tag=ICIU007 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 channel ORA_DISK_1: deleting archive log(s) archive log filename=/u01/app/oracle/flash_recovery_area/ORACLE10G/archivelog/2013_04_08/o1_mf_1_13_8p5mggh0_.arc recid=11 stamp=812239310 Finished backup at 08-APR-13 Starting backup at 08-APR-13 using channel ORA_DISK_1 channel ORA_DISK_1: starting incremental level 1 datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset input datafile fno=00001 name=/u01/app/oracle/oradata/oracle10/system01.dbf input datafile fno=00003 name=/u01/app/oracle/oradata/oracle10/sysaux01.dbf input datafile fno=00002 name=/u01/app/oracle/oradata/oracle10/undotbs01.dbf input datafile fno=00004 name=/u01/app/oracle/oradata/oracle10/users01.dbf channel ORA_DISK_1: starting piece 1 at 08-APR-13 channel ORA_DISK_1: finished piece 1 at 08-APR-13 piece handle=/u01/app/oracle/flash_recovery_area/ORACLE10G/backupset/2013_04_08/o1_mf_nnnd1_ICIU007_8p5mgofk_.bkp tag=ICIU007 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08 channel ORA_DISK_1: starting incremental level 1 datafile backupset channel ORA_DISK_1: specifying datafile(s) in backupset including current control file in backupset including current SPFILE in backupset channel ORA_DISK_1: starting piece 1 at 08-APR-13 channel ORA_DISK_1: finished piece 1 at 08-APR-13 piece handle=/u01/app/oracle/flash_recovery_area/ORACLE10G/backupset/2013_04_08/o1_mf_ncsn1_ICIU007_8p5mgskg_.bkp tag=ICIU007 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 08-APR-13 ..... .....