(1)问题描述
在进行数据库归档备份时(备份归档日志文件和控制文件),有时成功,有时失败,失败报错如下:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on dev_0 channel at 06/21/2017 17:05:20
ORA-00245: control file backup failed; target is likely on a local file system
(2)环境
操作系统:redhat 6.7
数据库版本:11.2.0.4 + RAC(2个节点)
(3)原因分析
引用文档[1472171.1]:
Oracle Database - Enterprise Edition - Version 11.2.0.1.0 and later
Information in this document applies to any platform.
This issue is only applicable to RAC database.
From 11gR2 onwards, the controlfile backup happens without holding the controlfile enqueue. For non-RAC database, this doesn't change anything. But for RAC database, due to the changes made to the controlfile backup mechanism in 11gR2, any instance in the cluster may write to the snapshot controlfile. Due to this snapshot controlfile need to be visible to all instances.
[从11gR2开始,备份控制文件时,不再需要锁住controlfile enqueue,对于非RAC数据库,没有任何改变。但是对于RAC数据库,由于备份机制的变化,任何实例都可以去写快照控制文件。因此,这个快照文件需要可以被集群中的任何实例访问]
The snapshot controlfile MUST be accessible by all nodes of a RAC database, if the snapshot controlfile does not reside on a shared device error will be raised at the time of RMAN backup while taking snapshot of controlfile.
[快照控制文件必须可以被RAC集群中的所有节点访问,如果快照不在共享的位置,那么在RMAN备份控制文件快照的时候,出错率将会上升]
ORA-245 error message description
----------------------------------------
00245, 00000, "control file backup operation failed"
*Cause: Failed to create a control file backup because some process
signaled an error during backup creation.
*Action: Check alert files for further information. This usually happens
because some process could not access the backup file during
backup creation. Any process of any instance that starts a
read/write control file transaction must have an access to the
backup control file during backup creation.
关于snapshot controlfile的介绍,如下:
快照控制文件是由RMAN恢复管理器在系统指定位置生成的当前控制文件的一个副本。
我们知道控制文件在整个数据库生命期中在不断的时时刻刻发生变化,RMAN备份需要依赖于控制文件或恢复目录,也就是说需要知道备份开始时的检查点SCN以及所有文件结构信息并且在整个备份期间这些信息需要保持一致,但又不能锁定控制文件(锁定操作无法执行检查点,切换日志等)。因此既要保持一致性,又不影响数据库的正常操作。快照控制文件就应运而生了。RMAN只在备份或同步操作期间对实际控制文件进行一个短暂的锁定,并根据其内容来生成或刷新快照控制文件。一旦该动作完成之后,RMAN将切换到使用快照控制文件进行备份及同步操作。从而保证备份期间控制文件,数据文件等等的一致性。综上所述,其主要作用是使用RMAN同步恢复目录或备份时能得到一个一致性的控制文件。
(4)解决方案
把快照控制文件放到RAC中所有节点共享的位置。
1.检查快照控制文件的位置
RMAN > show snapshot controlfile name;
2.重新设置快照控制文件到一个共享位置
RMAN > CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘<shared_disk>/snapcf_<DBNAME>.f’;
如果使用了ASM存储,则;
RMAN > CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘+<DiskGroup>/snapcf_<DBNAME>.f’;
参考:
1. ORA-245: In RAC environment from 11.2 onwards Backup Or Snapshot controlfile needs to be in shared location (文档 ID 1472171.1) [ https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=513457442255652&id=1472171.1&_afrWindowMode=0&_adf.ctrl-state=c9lauf3k_97 ]
2. Oracle 快照控制文件(snapshot control file) [ http://blog.csdn.net/leshami/article/details/12754339 ]