微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Flash_recovery_area(db_recovery_file_dest)之介绍

1. 设置闪回恢复区(认rman备份在$ORACLE_HOME/dbs下)

闪回恢复区主要通过3个初始化参数来设置和管理:

db_recovery_file_dest:指定闪回恢复区的位置
       db_recovery_file_dest_size:指定闪回恢复区的可用空间大小

db_flashback_retention_target:指定数据库可以回退的时间,单位为分钟,认1440分钟,也就是一天。当然,实际上可回退的时间还决定于闪回恢复区的大小,因为里面保存了回退所需要的flash log。所以这个参数要和db_recovery_file_dest_size配合修改

sql> ALTER SYstem SET db_recovery_file_dest_size=3g ScopE=BOTH;

System altered.

sql> ALTER SYstem SET db_recovery_file_dest=' D:\app\Administrator\flash_recovery_area ' ScopE=BOTH;

System altered.

sql> show parameter db_recovery_file_dest

2. 闪回恢复区的空间管理闪回恢复区的空间管理

闪回恢复区中添加删除文件等变化都将记录在数据库的 alert 日志中,Oracle 10g 也针对该新特性提供了一个新的视图, DBA_OUTSTANDING_ALERTS,通过该视图可以得到相关的信息

 在闪回恢复区中的空间使用超过 85% 的时候,数据库将会向 alert 文件中写入告警信息。而当超过 97% 的时候将会写入严重告警信息。当闪回恢复区空间不够的时候,Oracle将报告如下类似的错误

ORA-19809: limit exceeded for recovery files

ORA-19804: cannot reclaim 52428800 bytes disk space from 1258291200 limit

这个时候查询 dba_outstanding_alerts:

sql> select reason,object_type,suggested_action from dba_outstanding_alerts;

 

REASON                         OBJECT_TYPE          SUGGESTED_ACTION

------------------------------ -------------------- ----------------------------------------

db_recovery_file_dest_size of  RECOVERY AREA        Add disk space and increase db_recovery_

1258291200 bytes is 88.20% use                      file_dest_size,backup files to tertiary

d and has 148509184 remaining                        device,delete files from recovery area

bytes available.                                     using RMAN,consider changing RMAN rete

                                                    ntion policy or consider changing RMAN a

                                                    rchivelog deletion policy.

同时,oracle在alert中还会给出解决该问题的建议
************************************************************************
You have following choices to free up space from flash recovery area:
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,then consider changing RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMANB ACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to reflect the new space.
4. Delete unnecessary files using RMAN DELETE command. If an operating system command was used to delete files,then use RMAN CROSSCHECK and DELETE EXPIRED commands.
************************************************************************

V$RECOVERY_FILE_DEST视图 包含闪回恢复区的相关信息:

sql> select * from v$recovery_file_dest;
         NAME  SPACE_LIMIT SPACE_USED SPACE_RECLaimABLE NUMBER_OF_FILES

---------- ----------- ---------- ----------------- ---------------

    4039114752          0                 0               0

通过查询视图v$flash_recovery_area_usage,可以获得当前闪回恢复区的空间使用情况,并且可以知道是哪些文件占中了空间,据此可以做出相应的处理,或者加大闪回恢复区,或者移走相应的文件


      sql> select * from v$flash_recovery_area_usage;
         FILE_TYPE            PERCENT_SPACE_USED PERCENT_SPACE_RECLaimABLE

-------------------- ------------------ -------------------------

CONTROL FILE                          0                         0

REDO LOG                              0                         0

ARCHIVED LOG                          0                         0

BACKUP PIECE                          0                         0

IMAGE copY                            0                         0

FLASHBACK LOG                         0                         0

FOREIGN ARCHIVED LOG                  0                         0

3. 闪回恢复区的空间清理  

如果闪回恢复区空间耗尽,且归档路径设置到了闪回恢复区中,则由于日志无法归档,数据库会hang住。所以,对于生产库,如果将归档放到闪回恢复区中,需要密切关注闪回恢复区的空间使用情况,否则一旦闪回恢复区的空间用尽,将导致数据库无法提供服务

 1、archivelog清理:

      rman>DELETE ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-7';  或者

      若OS先删除文件的话:

      crosscheck archivelog all;RMAN> list expired backup;delete expired archivelog all

 2、backupset/copy清理:

       rman>delete obsolete; -- 删除陈旧备份list backup;delete backupset id;

       rman>delete backup; -- 删除所有备份delete expired copy

 3、通过转储到第三方介质清理:BACKUP RECOVERY AREA.

 4、Consider changing your RMAN retention policy

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐