SNAPSHOT CONTROLFILE和autobackup controlfile 的关系

 

RAC nodes: A, B
CDB name: cdb based ASM

Steps : 
1. Create and open pluggable database tmpdb, and create oe schema in it. 
2. Hot clone from tmpdb to PDB1/2/...1000, and open all pluggable database. 
3. Do full backup to whole CDB  plus archivelog 
4. Do full backup to each PDB
Hit ORA-00245 error during backup SPDB15. 
================================================== 
.. 
RMAN-08504: input archived log thread=1 sequence=35 RECID=66 STAMP=1023432574 
RMAN-08504: input archived log thread=2 sequence=33 RECID=67 STAMP=1023432577 
RMAN-08038: channel ORA_DISK_1: starting piece 1 at 04-NOV-19 
RMAN-08044: channel ORA_DISK_1: finished piece 1 at 04-NOV-19 
RMAN-08530: piece 
handle=+GDATA/CDB/BACKUPSET/2019_11_04/annnf0_spdb15_bk_arc_0.1138.1023432577 
tag=SPDB15_BK_ARC comment=NONE 
RMAN-08540: channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 
RMAN-03091: Finished backup at 04-NOV-19 

RMAN-03090: Starting Control File and SPFILE Autobackup at 04-NOV-19 
RMAN-00571: =========================================================== 
RMAN-00569: ====== ERROR MESSAGE STACK FOLLOWS ======= 
RMAN-00571: =========================================================== 
RMAN-03009: failure of Control File and SPFILE Autobackup command on 
ORA_DISK_1 channel at 11/04/2019 06:49:39 
ORA-00245: control file backup failed; in Oracle RAC, target might not be on 
shared storage 
... 
================================================== 

But backup whole CDB and the other PDBs are succeed without such ORA 
error: 
===================================== 
... 
RMAN-08504: input archived log thread=2 sequence=5 RECID=11 STAMP=1023431783 
RMAN-08038: channel ORA_DISK_1: starting piece 1 at 04-NOV-19 
RMAN-08044: channel ORA_DISK_1: finished piece 1 at 04-NOV-19 
RMAN-08530: piece 
handle=+GDATA/CDB/BACKUPSET/2019_11_04/annnf0_spdb1_bk_arc_0.1026.1023431783 
tag=SPDB1_BK_ARC comment=NONE 
RMAN-08540: channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 
RMAN-03091: Finished backup at 04-NOV-19 

RMAN-03090: Starting Control File and SPFILE Autobackup at 04-NOV-19 
RMAN-08503: piece 
handle=+GDATA/CDB/AUTOBACKUP/2019_11_04/s_1023431785.1027.1023431785 
comment=NONE 
RMAN-03091: Finished Control File and SPFILE Autobackup at 04-NOV-19 
... 
=====================================

Here is the info of RMAN configure information: 
===================== 
RMAN> show all; 
RMAN configuration parameters for database with db_unique_name CDB are: 
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default 
CONFIGURE BACKUP OPTIMIZATION OFF; # default 
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default 
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default 
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # 
default 
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default 
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default 
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default 
CONFIGURE MAXSETSIZE TO UNLIMITED; # default 
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default 
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default 
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR 
LOAD TRUE ; # default 
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default 
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default 
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 
'/home/scratch/dbs/snapcf_cdb1.f'; # defaul

Explaination:

snapshot of controlfile 放本地有可能导致 controlfile autobackup fail, 是因为当在RAC第一个节点start a RMAN session去做备份,autobackup controlfile过程中,RMAN 有可能基于第一个节点,然后飘第二个节点继续autobackup controlfile.这样如果控制文件快照不放在ASM可能会导致autobackup controlfile的失败。

不管你是手动备份还是自动备份,只要备份control file,第一步就是先做snapshot controlfile。最终用来备份的实际是这个snapshot controlfile,因为真正的control file不能锁,不然不能做checkpoint了。

 

Detailed:

在用RMAN备份是时候,系统会自动备份一份 SNAPSHOT CONTROLFILE,我们来看看这个 SNAPSHOT CONTROLFILE 到底有什么用途,有如下文档
RMAN needs to get a consistent view of the control file when it sets out to make backup of every datafile. It only needs to know the most recent checkpoint information and file schematic information at the time backup begins. After the backup starts, RMAN needs this information to stay consistent for duration of the backup operation; in other words, it needs a read consistent view of the control file. With the constant updates from the database, this is nearly impossible - unless RMAN were to lock the control file for the duration of the backup. But that would mean the database could not advance checkpoint or switch logs or produce new archive logs. Impossible.
To get around this, RMAN uses the snapshot control file, an exact copy of your control file that is only used by RMAN during backup and resync operations. At the beginning of these operations, RMAN refreshes the snapshot control file from the actual control file, thus putting a momentary lock on the control file. Then, RMAN switches to the snapshot and uses it for the duration of the backup; in this way, it has read consistency without holding up database activity.
根据我的理解:
snapshot control file只有在同步catalog的时候用到或者在控制文件备份的时候用到,主要作用是在备份控制文件是代替控制文件,使得rman在备份控制文件时能够锁定控制文件从而保证控制文件的一致性。
----------------------------------------------------------
SNAPSHOT CONTROLFILE 的用途,顾名思义,应该是用来恢复控制文件的,下面是我的测试结果:
结论是:
1.SNAPSHOT CONTROLFILE 能直接copy成control file也能通过rman恢复为control file
2.可以通过rman,将SNAPSHOT CONTROLFILE 恢复成控制文件
3.如果数据库没有shutdown,可以直接copy SNAPSHOT CONTROLFILE 成控制文件,但仍需要恢复(因为它是旧的)

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值