ORA-19606 Cannot copy or restore to snapshot control file错误解决方法
今天早上来,收到邮件报警,有几个数据库RMAN备份失败,分析备份日志发现遇到ORA-19606 Cannot copy or restore to snapshot control file错误:
RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03009: failure of delete command on ORA_DISK_1 channel at 10/13/2015 03:00:02 ORA-19606: Cannot copy or restore to snapshot control file
在MOS上有这个错误的相关文章,以下是MOS对该错误的描述。
SYMPTOMS
=== ODM Issue Clarification ===
Receiving error on ‘delete obsolete’:
delete noprompt obsolete device type disk;
RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 5 days
Deleting the following obsolete backups and copies:
Type Key Completion Time Filename/Handle
——————– —— —————— ——————–
Control File Copy 3 01-SEP-10 C:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFAXMPRD.ORA
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of delete command on ORA_MAINT_DISK_1 channel at 09/09/2010 02:04:24
ORA-19606: Cannot copy or restore to snapshot control file
CAUSE
=== ODM Cause Determination ===
The snapshot controlfile is cataloged as a controlfile copy and is now obsolete. RMAN cannot delete this file as it is used by rman.
=== ODM Cause Justification ===
Error and information supplied justifies cause.
SOLUTION
=== ODM Solution / Action Plan ===
Since RMAN will continue to use that file as it’s snapshot copy, you must change the location/name that RMAN is using before it will allow you to delete the file.
1. Set new name (or location) for RMAN to use for snapshot controlfile:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘C:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCF_temp.ORA’;
2.Remove the snapshot controlfile from the RMAN information as a controlfile copy.
delete ‘C:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFAXMPRD.ORA’ on operating system.
3.Crosscheck and delete the file from RMAN:
crosscheck controlfilecopy ‘C:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFAXMPRD.ORA’;
delete expired controlfilecopy ‘C:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFAXMPRD.ORA’;
4.Set the snapshot controlfile name (or location) to original:
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘C:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\SNCFAXMPRD.ORA’;
- Or to set the snapshot controlfile name back to default value:
CONFIGURE SNAPSHOT CONTROLFILE NAME clear;
下面根据MOS上面的方法,解决这个问题。
RMAN> show SNAPSHOT CONTROLFILE NAME; using target database control file instead of recovery catalog RMAN configuration parameters for database with db_unique_name USER1 are: CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1.f'; # default
将SNAPSHOT CONTROLFILE NAME修改为新的名字。
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1-temp.f'; new RMAN configuration parameters: CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1-temp.f'; new RMAN configuration parameters are successfully stored
然后在操作系统上将原有的控制文件镜像删除,我这里使用改名的方式,没有直接删除,这也是一种习惯。
[oracle@SL010M6-DB-USER1 ~]$ cd $ORACLE_HOME/dbs [oracle@SL010M6-DB-USER1 dbs]$ mv snapcf_user1.f snapcf_user1.f.bak
然后在通过RMAN校验下控制文件的镜像,由于改了名字,将找不到控制文件的镜像,然后删除掉控制文件中的镜像信息。
RMAN> crosscheck controlfilecopy '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1.f'; using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=389 device type=DISK validation failed for control file copy control file copy file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1.f RECID=1 STAMP=890930134 Crosschecked 1 objects RMAN> delete expired controlfilecopy '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1.f'; released channel: ORA_DISK_1 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=389 device type=DISK List of Control File Copies =========================== Key S Completion Time Ckp SCN Ckp Time ------- - --------------- ---------- --------------- 1 X 20-SEP-15 2124556 20-SEP-15 Name: /u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1.f Tag: TAG20150920T163533 Do you really want to delete the above objects (enter YES or NO)? yes deleted control file copy control file copy file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1.f RECID=1 STAMP=890930134 Deleted 1 EXPIRED objects
再将控制文件的镜像备份还原成原来的名字,这有两种方法,一种是直接以全路径的方式修改,一种是以clear的方式修改,两种方法任选其一即可。
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1.f'; old RMAN configuration parameters: CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1-temp.f'; new RMAN configuration parameters: CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1.f'; new RMAN configuration parameters are successfully stored
或者clear这个参数,将直接还原到默认值,结果和上面以直接路径修改的方式一样,因为上述修改的就是默认值。
RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME clear; old RMAN configuration parameters: CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user2-temp.f'; RMAN configuration parameters are successfully reset to default value RMAN> show SNAPSHOT CONTROLFILE NAME; using target database control file instead of recovery catalog RMAN configuration parameters for database with db_unique_name USER1 are: CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_user1.f'; # default
最后,通过crontab找到备份的脚本,运行后,备份成功。
[oracle@SL010M6-DB-USER1 dbs]$ crontab -l 00 03 * * 0 /u01/backup/rman_scripts/rman_db.sh >> /dev/null 2>&1 00 03 * * 1,2,3,4,5,6 /u01/backup/rman_scripts/rman_arc.sh >> /dev/null 2>&1 [oracle@SL010M6-DB-USER1 dbs]$ /u01/backup/rman_scripts/rman_arc.sh RMAN> RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14> 15> 16> 17> 18> 19> 20> 21> 22> 23> [oracle@SL010M6-DB-USER1 data]$ cd arc_20151013/ [oracle@SL010M6-DB-USER1 arc_20151013]$ ll 总用量 60952 -rw-r----- 1 oracle oinstall 52526080 10月 13 09:26 arch_3hqjjgps_113_1 -rw-r----- 1 oracle oinstall 3072 10月 13 09:26 arch_3iqjjgps_114_1 -rw-r--r-- 1 oracle oinstall 5007 10月 13 03:00 rman_bk_arc_20151013030001.log -rw-r--r-- 1 oracle oinstall 8233 10月 13 09:26 rman_bk_arc_20151013092618.log -rw-r----- 1 oracle oinstall 9863168 10月 13 09:26 spfile_c-3329044944-20151013-00
查看rman_bk_arc_20151013092618.log,备份成功,日志太长就不贴了。
最后,删除之前备份的镜像和中转产生的控制文件镜像。
[oracle@SL010M6-DB-USER1 arc_20151013]$ cd $ORACLE_HOME/dbs [oracle@SL010M6-DB-USER1 dbs]$ rm snapcf_user1.f.bak snapcf_user1-temp.f