處理歸檔滿了fast_recovery_area無剩餘空間的案例

pxbibm發表於2015-07-28
今天早晨收到手機簡訊系統預警資訊,登陸公司系統後檢查發現是一臺資料庫系統。
檢視系統alter日誌發現如下資訊:
************************************************************************
ARC1: Error 19809 Creating archive log file to '/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_189_%u_.arc'
Errors in file /app/oracle/diag/rdbms/ats/ats/trace/ats_arc0_29634.trc:
ORA-19815: WARNING: db_recovery_file_dest_size of 5218762752 bytes is 100.00% used, and has 0 remaining bytes available.
Errors in file /app/oracle/diag/rdbms/ats/ats/trace/ats_arc3_29640.trc:
ORA-19815: WARNING: db_recovery_file_dest_size of 5218762752 bytes is 100.00% used, and has 0 remaining bytes available.
************************************************************************
************************************************************************
You have following choices to free up space from recovery area:
You have following choices to free up space from recovery area:
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
1. Consider changing RMAN RETENTION POLICY. If you are using Data Guard,
   then consider changing RMAN ARCHIVELOG DELETION POLICY.
   then consider changing RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMAN
2. Back up files to tertiary device such as tape using RMAN
   BACKUP RECOVERY AREA command.
   BACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to
3. Add disk space and increase db_recovery_file_dest_size parameter to
   reflect the new space.
   reflect the new space.
4. Delete unnecessary files using RMAN DELETE command. If an operating
4. Delete unnecessary files using RMAN DELETE command. If an operating
   system command was used to delete files, then use RMAN CROSSCHECK and
   system command was used to delete files, then use RMAN CROSSCHECK and
   DELETE EXPIRED commands.
************************************************************************
   DELETE EXPIRED commands.
ARC0: Error 19809 Creating archive log file to '/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_188_%u_.arc'
************************************************************************
ARC3: Error 19809 Creating archive log file to '/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_187_%u_.arc'
Errors in file /app/oracle/diag/rdbms/ats/ats/trace/ats_arc1_29636.trc:
ORA-19815: WARNING: db_recovery_file_dest_size of 5218762752 bytes is 100.00% used, and has 0 remaining bytes available.
************************************************************************
You have following choices to free up space from 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 RMAN
   BACKUP 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.
************************************************************************
ARC1: Error 19809 Creating archive log file to '/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_189_%u_.arc'


原來是系統歸檔滿了,我們從預警資訊中已經看到,oracle給出了4種處理方案。現在oracle是越來越智慧了。
我採用的是第3種方案,修改歸檔日誌區的大小。
先看看目前的大小

SQL> show parameter db_reco    

NAME         TYPE  VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest       string  /app/oracle/fast_recovery_area
db_recovery_file_dest_size      big integer 4G

SQL> Alter system set db_recovery_file_dest_size=20G scope=both;

System altered.

SQL> show parameter db_reco    

NAME         TYPE  VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest       string  /app/oracle/fast_recovery_area
db_recovery_file_dest_size      big integer 20G

SQL> select file_type, percent_space_used as used,percent_space_reclaimable as reclaimable,      number_of_files as "number" from v$flash_recovery_area_usage;

FILE_TYPE     USED RECLAIMABLE number
-------------------- ---------- ----------- ----------
CONTROL FILE        0    0      0
REDO LOG        0    0      0
ARCHIVED LOG    40.47    0     32
BACKUP PIECE        0    0      0
IMAGE COPY        0    0      0
FLASHBACK LOG        0    0      0
FOREIGN ARCHIVED LOG       0    0      0

7 rows selected.

我們也可以手工刪除歸檔日誌資訊。
cd /app/oracle/fast_recovery_area
rm -rf *
登陸到rman 進行處理。

RMAN> crosscheck archivelog all;
  
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=68 device type=DISK
validation failed for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/mf_1_5_7bxbhkof_.arc RECID=1 STAMP=766015219
validation failed for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/f_1_6_7bxw2gpo_.arc RECID=2 STAMP=766033231
……………………………………
validation failed for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_105_7gc3co97_.arc RECID=132 STAMP=770306728
validation failed for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_106_7gc3cv1w_.arc RECID=123 STAMP=770306728
validation failed for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_107_7gc3mbpr_.arc RECID=127 STAMP=770306728
validation succeeded for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_1_7gxtrlnq_.arc RECID=134 STAMP=770312597
validation succeeded for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_2_7gxtrloz_.arc RECID=135 STAMP=770312597
validation succeeded for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_3_7gxtrodg_.arc RECID=136 STAMP=770312599
validation failed for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_1_7gc3ojqw_.arc RECID=126 STAMP=770306728
……………………………………
validation succeeded for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_20_7gxlq29k_.arc RECID=113 STAMP=770306728
validation succeeded for archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_21_7gxl3zdm_.arc RECID=114 STAMP=770306728
Crosschecked 136 objects
  
RMAN> DELETE EXPIRED  archivelog all;
  
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=68 device type=DISK
List of Archived Log Copies for database with db_unique_name ORA11G
……………………………………
Do you really want to delete the above objects (enter YES or NO)? yes
deleted archived log
……………………………………
deleted archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_14_7gpood3n_.arc RECID=115 STAMP=770306728
deleted archived log
archived log file name=/app/oracle/fast_recovery_area/ATS/archivelog/2015_07_28/o1_mf_1_15_7gqhvvhh_.arc RECID=106 STAMP=770306727
Deleted 124 EXPIRED objects
總結:
1.使用os命令刪除fast_recovery_area內容後,需要使用crosscheck檢測(如:archivelog all,backup等)。
2.然後使用 DELETE EXPIRED命令刪除(archivelog all,backup等)
3.指定備份策略,fast_recovery_area設定合適大小+合適的策略
4.resetlogs開啟資料庫後,做好備份
5.fast_recovery_area無剩餘空間處理思路
   5.1)如果資料庫不能登入:重啟至mount,增大fast_recovery_area,open資料庫,然後使用rman刪除歷史垃圾資料(備份集,日誌,閃回日誌等)
   5.2)如果資料庫可以使用sys登入,增大fast_recovery_area(使其資料庫可以正常工作),然後使用rman處理垃圾資料。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12798004/viewspace-1753761/,如需轉載,請註明出處,否則將追究法律責任。

相關文章