博客
关于我
历史备份过多使用delete obsolete方式找不到过期备份信息???
阅读量:441 次
发布时间:2019-03-06

本文共 3468 字,大约阅读时间需要 11 分钟。

一套生产环境DB,每周日进行一次0级全备,其余每周6天都是增量备份。

但是磁盘告警,备份目录使用率>90%, 检查备份脚本是定期删除8天前的过期备份信息!!!

发现的问题: 最早的备份信息是3周前的备份信息??? 删除脚本失效了???

1. 准备操作,手工执行清理8天前的rman备份信息。

run{CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 8 DAYS;delete noprompt obsolete device type disk;} 执行之后无报错! 但是未删除任何信息??? 是不是21天前的备份信息,根本不在控制文件中??? 使用catalog 注册一下备份片信息 catalog start with '/bak'; yes --发现n多备份信息,可以被注册,说明什么,说明21天前的很多备份信息,确实在控制文件中不存在了???

参数

控制文件默认保留时间7天,也就是说,当控制文件积累到一定大小的程度时,会自动清理备份记录信息(不会删除备份文件,只是删除控制文件中记录的备份信息) 以及归档信息 SQL> show parameter control_file_record_keep_timeNAME                                 TYPE                   VALUE------------------------------------ ---------------------- ------------------------------control_file_record_keep_time        integer                7

    Relation between RMAN retention period and control_file_record_keep_time (Doc ID 397269.1)

    RMAN backup keeps the backup metadata information in the reusable section of the controlfile. It depends on the parameter CONTROL_FILE_RECORD_KEEP_TIME. CONTROL_FILE_RECORD_KEEP_TIME specifies the minimum number of days before a reusable recordin the control file can be reused. In the event a new record needs to be added to a reusable section and there is not enough space then it will delete the oldest record, which are aged enough. 

    Backup retention policy is the rule to set regarding which backups must be retained (whether on disk or other backup media) to meet the recovery and other requirements.

If the CONTROL_FILE_RECORD_KEEP_TIME is less than the retention policy then it may overwrite reusable records prior to obsoleting them in the RMAN metadata. Therefor it is recommended that the CONTROL_FILE_RECORD_KEEP_TIME should set to a higher value than the retention policy.
    Please note the default control_file_record_keep_time is 7 day
NOTE: Best practice is to NOT set control_file_record_keep_time to a value greater than 10. If you need retention greater than this in the controlfile, you should use an RMAN catalog.
   Formula
    CONTROL_FILE_RECORD_KEEP_TIME = retention period + level 0 backup interval + 1
   For e.g.
    e.q. level 0 backup once a week with retention policy of a recovery windows of 14 days then in this case the CONTROL_FILE_RECORD_KEEP_TIME should be 14+7+1=22
    To be on safer side you can always add + 2 or 3 days to above formula.
Ideally its recommended to configure a recovery catalog so that information about the backups are present in recovery catalog even though the controlfile section gets reused based on the control_file_record_keep_time due to space pressure.

SQL> select * from V$CONTROLFILE_RECORD_SECTION; 有人会问?  为什么超出默认的7天? 但是备份信息还是保留呢?  空间足够没必要覆盖,备份信息过多才会自动清理。 那么如何处理???  1.不建议直接跳转加大参数,无法调整清理备份信息在进行调整; SQL> alter system set control_file_record_keep_time=31 sid='*';                  2.备份的定时任务是否有必要进行调整,及时清理多余的备份信息;                  3.可以脚本中加上RMAN> catalog start with '/bak/' noprompt;

searching for all files that match the pattern /bak/

List of Files Unknown to the Database

=====================================
File Name: /bak/0buvkgth
File Name: /bak/0cuvkgtk
cataloging files...
cataloging done

List of Cataloged Files

=======================
File Name: /bak/0buvkgth
File Name: /bak/0cuvkgtk

 

使用catalog 注册后,再次执行删除语法,可以执行,但是执行删除8天前的日志,但是却保留了2周的备份信息!!!

每周一次备份

 2.由于机制问题,按照时间窗口,清理过期的备份,清理8天前,也就是存在

上周5的增倍,上周6的全备-至今, 最初的理解是,删除8天前,应该是只保留上周5-至今的备份信息; 

但是oracle 定义的过期是,保留8天的恢复窗口内,可以使用备份恢复到任意时刻! 包括本次最早的一天,上周5,如果仅仅只保留最近8天的备份,最近的全备是上周6,无法恢复到上周5的数据。  因此保留8天恢复窗口,配合每周一次增量备份,等同于保留2次RMAN全备数据!!!

转载地址:http://itlyz.baihongyu.com/

你可能感兴趣的文章
netty--helloword程序
查看>>
netty2---服务端和客户端
查看>>
【Flink】Flink 2023 Flink易用性和稳定性在Shopee的优化-视频笔记
查看>>
Netty5.x 和3.x、4.x的区别及注意事项(官方翻译)
查看>>
netty——bytebuf的创建、内存分配与池化、组成、扩容规则、写入读取、内存回收、零拷贝
查看>>
netty——Channl的常用方法、ChannelFuture、CloseFuture
查看>>
netty——EventLoop概念、处理普通任务定时任务、处理io事件、EventLoopGroup
查看>>
netty——Future和Promise的使用 线程间的通信
查看>>
netty——Handler和pipeline
查看>>
Vue输出HTML
查看>>
netty——黏包半包的解决方案、滑动窗口的概念
查看>>
Netty中Http客户端、服务端的编解码器
查看>>
Netty中使用WebSocket实现服务端与客户端的长连接通信发送消息
查看>>
Netty中实现多客户端连接与通信-以实现聊天室群聊功能为例(附代码下载)
查看>>
Netty中的组件是怎么交互的?
查看>>
Netty中集成Protobuf实现Java对象数据传递
查看>>
netty之 定长数据流处理数据粘包问题
查看>>
Netty事件注册机制深入解析
查看>>
netty代理
查看>>
Netty入门使用
查看>>