博客
关于我
历史备份过多使用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/

你可能感兴趣的文章
NET3.0+中使软件发出声音[整理篇]<转>
查看>>
net::err_aborted 错误码 404
查看>>
NetApp凭借领先的混合云数据与服务把握数字化转型机遇
查看>>
NetAssist网络调试工具使用指南 (附NetAssist工具包)
查看>>
Netbeans 8.1启动参数配置
查看>>
NetBeans IDE8.0需要JDK1.7及以上版本
查看>>
NetBeans之JSP开发环境的搭建...
查看>>
NetBeans之改变难看的JSP脚本标签的背景色...
查看>>
netbeans生成的maven工程没有web.xml文件 如何新建
查看>>
netcat的端口转发功能的实现
查看>>
NetCore 上传,断点续传,可支持流上传
查看>>
Netcraft报告: let's encrypt和Comodo发布成千上万的网络钓鱼证书
查看>>
Netem功能
查看>>
netfilter应用场景
查看>>
Netflix:当你按下“播放”的时候发生了什么?
查看>>
Netflix推荐系统:从评分预测到消费者法则
查看>>
netframework 4.0内置处理JSON对象
查看>>
Netgear WN604 downloadFile.php 信息泄露漏洞复现(CVE-2024-6646)
查看>>
Netgear wndr3700v2 路由器刷OpenWrt打造全能服务器(十一)备份
查看>>
netlink2.6.32内核实现源码
查看>>