Oracle闪回区管理


  1. Errors in file /home/Oracle/diag/rdbms/orarpt/orarpt/trace/orarpt_mmon_22508.trc:  
  2. ORA-19815: WARNING: db_recovery_file_dest_size of 2147483648 bytes is 98.55% used, and has 31102976 remaining bytes available.  
  3. ************************************************************************  
  4. You have following choices to free up space from flash recovery area:  
  5. 1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,  
  6.    then consider changing RMAN ARCHIVELOG DELETION POLICY.  
  7. 2. Back up files to tertiary device such as tape using RMAN  
  8.    BACKUP RECOVERY AREA command.  
  9. 3. Add disk space and increase db_recovery_file_dest_size parameter to  
  10.    reflect the new space.  
  11. 4. Delete unnecessary files using RMAN DELETE command. If an operating  
  12.    system command was used to delete files, then use RMAN CROSSCHECK and  
  13.    DELETE EXPIRED commands.  
  14. ************************************************************************  

今天数据库重启时,查看alert日志发现上面的错误,虽然现在数据库可以正常启动运行,但当这个db_recovery_file_dest_size使用100%的时候,
将会报错ORA-19809: limit exceeded for recovery files,数据库将会因无法归档而挂起。

查看闪回区的信息

  1. select * from v$recovery_file_dest;  
  2.   
  3. NAME              /home/oracle/flash_recovery_area  
  4. SPACE_LIMIT       2147483648  
  5. SPACE_USED        2116380672  
  6. SPACE_RECLAIMABLE 0  
  7. NUMBER_OF_FILES   1  

查看alert告警,以及oracle给出的处理建议。

  1. select reason,object_type,suggested_action  from dba_outstanding_alerts;  
  2.   
  3. REASON            db_recovery_file_dest_size 字节 (共 2147483648 字节) 已使用 98.55%, 尚有 31102976 字节可用。  
  4. OBJECT_TYPE        RECOVERY AREA  
  5. SUGGESTED_ACTION "可以选择以下操作之一从快速恢复区释放空间:  
  6.                   1. 考虑更改 RMAN RETENTION POLICY。如果使用的是 Data Guard,  
  7.                   则考虑更改 RMAN ARCHIVELOG DELETION POLICY。  
  8.                      2. 使用 RMAN  
  9.                   BACKUP RECOVERY AREA 命令将文件备份到磁带之类的三级存储。  
  10.                      3. 添加磁盘空间并增大 db_recovery_file_dest_size 参数以反映  
  11.                      这个新空间。  
  12.                      4. 使用 RMAN DELETE 命令删除不需要的文件。如果使用了操作系统  
  13.                      命令来删除文件, 则使用 RMAN CROSSCHECK 和  
  14.                      DELETE EXPIRED 命令。"  

这里我只试了第3、4种方法

第3种修改方法,扩展闪回区

  1. SQL> show parameter db_recovery_file_dest_size;  
  2.   
  3. NAME                                 TYPE        VALUE  
  4. ------------------------------------ ----------- ------------------------------   
  5. db_recovery_file_dest_size           big integer 2G  
  6.   
  7. SQL> alter system set db_recovery_file_dest_size=4G scope=both;  
  8.   
  9. 系统已更改。  
  10.   
  11. SQL> show parameter db_recovery_file_dest_size;  
  12.   
  13. NAME                                 TYPE        VALUE  
  14. ------------------------------------ ----------- ------------------------------   
  15. db_recovery_file_dest_size           big integer 4G  

现在已经将闪回区空间扩充到了4G,也就是新增了2G。

第4种修改方法,清空闪回区
注意,刚才直接将db_recovery_file_dest目���下的文件删除,SPACE_USED也不会释放。

  1. oracle@linux-35:~> rman target /  
  2.   
  3. Recovery Manager: Release 11.1.0.6.0 - Production on Wed Oct 12 12:35:09 2011  
  4.   
  5. Copyright (c) 1982, 2007, Oracle.  All rights reserved.  
  6.   
  7. connected to target database: ORARPT (DBID=2356255833)  
  8.   
  9. RMAN> crosscheck archivelog all;  
  10.   
  11. using target database control file instead of recovery catalog  
  12. allocated channel: ORA_DISK_1  
  13. channel ORA_DISK_1: SID=1138 device type=DISK  
  14. validation failed for archived log  
  15. archived log file name=/home/oracle/flash_recovery_area/ORARPT/archivelog/2011_06_08/o1_mf_1_11_6yz1mw4l_.arc RECID=2 STAMP=753316072  
  16. validation failed for archived log  
  17. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_12_750871897.dbf RECID=3 STAMP=753397594  
  18. validation failed for archived log  
  19. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_13_750871897.dbf RECID=4 STAMP=753404604  
  20. validation failed for archived log  
  21. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_14_750871897.dbf RECID=5 STAMP=753490060  
  22. validation failed for archived log  
  23. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_15_750871897.dbf RECID=6 STAMP=753530695  
  24. validation failed for archived log  
  25. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_16_750871897.dbf RECID=7 STAMP=753599698  
  26. validation failed for archived log  
  27. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_17_750871897.dbf RECID=8 STAMP=753646377  
  28. validation failed for archived log  
  29. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_18_750871897.dbf RECID=9 STAMP=753747854  
  30. validation failed for archived log  
  31. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_19_750871897.dbf RECID=10 STAMP=753809369  
  32. validation failed for archived log  
  33. ……  
  1. RMAN> delete expired archivelog all;  
  2.   
  3. released channel: ORA_DISK_1  
  4. allocated channel: ORA_DISK_1  
  5. channel ORA_DISK_1: SID=1138 device type=DISK  
  6. List of Archived Log Copies for database with db_unique_name ORARPT  
  7. =====================================================================  
  8.   
  9. Key     Thrd Seq     S Low Time   
  10. ------- ---- ------- - ---------   
  11. 2       1    11      X 07-JUN-11  
  12.         Name: /home/oracle/flash_recovery_area/ORARPT/archivelog/2011_06_08/o1_mf_1_11_6yz1mw4l_.arc  
  13.   
  14. 3       1    12      X 08-JUN-11  
  15.         Name: /home/oracle/product/11.1.0/db_1/dbs/arch1_12_750871897.dbf  
  16.   
  17. 4       1    13      X 09-JUN-11  
  18.         Name: /home/oracle/product/11.1.0/db_1/dbs/arch1_13_750871897.dbf  
  19.   
  20. 5       1    14      X 09-JUN-11  
  21.         Name: /home/oracle/product/11.1.0/db_1/dbs/arch1_14_750871897.dbf  
  22.   
  23. 6       1    15      X 10-JUN-11  
  24.         Name: /home/oracle/product/11.1.0/db_1/dbs/arch1_15_750871897.dbf  
  25.   
  26. 7       1    16      X 11-JUN-11  
  27.         Name: /home/oracle/product/11.1.0/db_1/dbs/arch1_16_750871897.dbf  
  28.   
  29. 8       1    17      X 12-JUN-11  
  30.         Name: /home/oracle/product/11.1.0/db_1/dbs/arch1_17_750871897.dbf  
  31.         ……  
  32. Do you really want to delete the above objects (enter YES or NO)? yes  
  33. deleted archived log  
  34. archived log file name=/home/oracle/flash_recovery_area/ORARPT/archivelog/2011_06_08/o1_mf_1_11_6yz1mw4l_.arc RECID=2 STAMP=753316072  
  35. deleted archived log  
  36. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_12_750871897.dbf RECID=3 STAMP=753397594  
  37. deleted archived log  
  38. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_13_750871897.dbf RECID=4 STAMP=753404604  
  39. deleted archived log  
  40. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_14_750871897.dbf RECID=5 STAMP=753490060  
  41. deleted archived log  
  42. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_15_750871897.dbf RECID=6 STAMP=753530695  
  43. deleted archived log  
  44. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_16_750871897.dbf RECID=7 STAMP=753599698  
  45. deleted archived log  
  46. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_17_750871897.dbf RECID=8 STAMP=753646377  
  47. deleted archived log  
  48. archived log file name=/home/oracle/product/11.1.0/db_1/dbs/arch1_18_750871897.dbf RECID=9 STAMP=753747854  
  49.   
  50.   
  51. RMAN> exit  
  52.   
  53.   
  54. Recovery Manager complete.  

再查看闪回区的信息,SPACE_USED已经释放。

  1. select * from v$recovery_file_dest;  
  2.   
  3. NAME                /home/oracle/flash_recovery_area  
  4. SPACE_LIMIT    2147483648  
  5. SPACE_USED     0  
  6. SPACE_RECLAIMABLE      0  
  7. NUMBER_OF_FILES    0  

相关内容