334.What command would you use to ensure that backup records in the control file are pointing to actual
physical files on the backup media?
A. crosscheck
B. list backup
C. confirm
D. resync
E. backup validate
Answer: A
答案解析:
crosscheck使用检查rman备份集和物理磁盘的对应的备份集是否一致。如果物理磁盘上没有,而rman备份集信息中有的话(rman备份的信息记录在控制文件中)就会将这个备份片标志为失效
crosscheck backupset 是检查备份集和实际的文件
1 备份集有两种状态A(Available,RMAN认为该项存在于备份介质上)X(Expired,备份存在于控制文件或恢复目录中,但
是并没有物理存在于备份介质上)
2 crosscheck 的目的是检查RMAN 的目录以及物理文件,如果物理文件不存在于介质上,将标记为Expired。如果物理文件
存在,将维持Available。如果原先标记为Expired的备份集再次存在于备份介质上(如恢复了损坏的磁盘驱动器后),
crosscheck将把状态重新从Expired标记回Available。
3 crosscheck 输出分两部分。第一部分列出确定存在于备份介质上的所有备份集片,第二部分列出不存在于备份介质上的
备份集片,并将其标记为Expired。可以使用delete expired backupset来删除失效的备份集。
实验一把:
先备份一下一个数据文件
RMAN> backup datafile 6;
Starting backup at 08-NOV-13
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00006 name=/u01/app/oracle/oradata/test1107/test01.dbf
channel ORA_DISK_1: starting piece 1 at 08-NOV-13
channel ORA_DISK_1: finished piece 1 at 08-NOV-13
piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T092043_97swsvqb_.bkp tag=TAG20131108T092043 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-NOV-13
Starting Control File and SPFILE Autobackup at 08-NOV-13
piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/autobackup/2013_11_08/o1_mf_s_830942444_97swsyk3_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 08-NOV-13
OS上删除这个备份集
[oracle@rtest ~]$ rm -f /u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T092043_97swsvqb_.bkp
使用crosscheck backupset来校验备份集
RMAN> crosscheck backupset;
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_annnn_TAG20131108T081845_97ss5r8g_.bkp RECID=44 STAMP=830938727
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_annnn_TAG20131108T081845_97ss5qyb_.bkp RECID=45 STAMP=830938727
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T084442_97stpdxy_.bkp RECID=54 STAMP=830940284
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T084442_97stpfgk_.bkp RECID=55 STAMP=830940285
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T084442_97stpcc6_.bkp RECID=56 STAMP=830940283
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/autobackup/2013_11_08/o1_mf_s_830940663_97sv28vk_.bkp RECID=57 STAMP=830940664
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/autobackup/2013_11_08/o1_mf_s_830942444_97swsyk3_.bkp RECID=59 STAMP=830942446
Crosschecked 7 objects
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T092043_97swsvqb_.bkp RECID=58 STAMP=830942443
Crosschecked 1 objects
EXPIRED状态,说明物理磁盘上没有,而rman的备份信息里面有。
这时可以删除这个失效的备份集的记录。
RMAN> delete expired backupset;
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
58 56 1 1 EXPIRED DISK /u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T092043_97swsvqb_.bkp
Do you really want to delete the above objects (enter YES or NO)? y
deleted backup piece
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T092043_97swsvqb_.bkp RECID=58 STAMP=830942443
Deleted 1 EXPIRED objects
再次检查,没有了。
RMAN> crosscheck backupset;
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_annnn_TAG20131108T081845_97ss5r8g_.bkp RECID=44 STAMP=830938727
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_annnn_TAG20131108T081845_97ss5qyb_.bkp RECID=45 STAMP=830938727
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T084442_97stpdxy_.bkp RECID=54 STAMP=830940284
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T084442_97stpfgk_.bkp RECID=55 STAMP=830940285
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_11_08/o1_mf_nnndf_TAG20131108T084442_97stpcc6_.bkp RECID=56 STAMP=830940283
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/autobackup/2013_11_08/o1_mf_s_830940663_97sv28vk_.bkp RECID=57 STAMP=830940664
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/autobackup/2013_11_08/o1_mf_s_830942444_97swsyk3_.bkp RECID=59 STAMP=830942446
Crosschecked 7 objects