因为之前为了搭建dataguard物理备库,在sqlplus中创建了一个控制文件:
alter database create standby controlfile as '/home/oracle/control01.ctl';
今天发现一个严重的问题,每次我想用duplicate命令(duplicate target database for standby nofilenamecheck dorecover;)创建一个备库的时候,复制过去的备份文件(包括了使用backup current controlfile for standby format '/home/oracle/rmanbak/cntrl_%d_%T_%U.bak';)
rman一直报错找不到/home/oracle/control01.ctl';。我就郁闷了,我不想让他找这个文件啊,我是想让他找'/home/oracle/rmanbak/cntrl_%d_%T_%U.bak';这个文件啊!!
于是,我考虑到,在控制文件里,一定还记录了这个原来的/home/oracle/control01.ctl';条目,遂决定先从控制文件里删除这个条目:
在运行 delete obsolete报错了
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
using channel ORA_DISK_2
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Controlfile Copy 15 23-SEP-09 /opt/oracle/control01.ctl
Do you really want to delete the above objects (enter YES or NO)? yes
RMAN-06207: WARNING: 1 objects could not be deleted for DISK channel(s) due
RMAN-06208: to mismatched status. Use CROSSCHECK command to fix status
List of Mismatched objects
==========================
Object Type Filename/Handle
--------------- ---------------------------------------------------
Datafile Copy /opt/oracle/control01.ctl
RMAN> crosscheck backup;
using channel ORA_DISK_1
using channel ORA_DISK_2
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/opt/rman_bak/ESCALADE/2009-09-23/TTL_ESCALADE_20090923_92 recid=86 stamp=698329633
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/opt/rman_bak/ESCALADE/2009-09-23/TTL_ESCALADE_20090923_93 recid=87 stamp=698329633
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/opt/rman_bak/ESCALADE/2009-09-23/arch_ESCALADE_20090923_97 recid=91 stamp=698329715
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/opt/rman_bak/ESCALADE/2009-09-23/ctl_c-2788940106-20090923-04 recid=92 stamp=698329717
Crosschecked 4 objects
发现crosscheck backup 和crosscheck backupset发现不了该文件
要用 CROSSCHECK CONTROLFILECOPY 语句
RMAN> CROSSCHECK CONTROLFILECOPY '/opt/oracle/control01.ctl';
released channel: ORA_DISK_1
released channel: ORA_DISK_2
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=32 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=35 devtype=DISK
validation failed for controlfile copy
controlfile copy filename=/opt/oracle/control01.ctl recid=15 stamp=698319446
Crosschecked 1 objects
RMAN> delete obsolete;
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Control File Copy 2 06-MAY-14 /home/oracle/control01.ctl
Do you really want to delete the above objects (enter YES or NO)? y
deleted control file copy
control file copy filename=/home/oracle/control01.ctl recid=2 stamp=846885313
Deleted 1 objects
删除成功
再次检查看,已经没有此条目了。
RMAN> CROSSCHECK CONTROLFILECOPY '/home/oracle/control01.ctl';
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=151 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of crosscheck command at 05/08/2014 11:22:29
RMAN-20220: control file copy not found in the recovery catalog
RMAN-06090: error while looking up control file copy: /home/oracle/control01.ctl