【现象】
ORA-19815: WARNING: db_recovery_file_dest_size of 214748364800 bytes is 85.22% used, and has 31746169856 remaining bytes available
【分析处理思路】
1、查询相关参数和视图
(1)查询db_recovery_file_dest_size和db_recovery_file_dest参数闪回区存储空间确定位置和大小。
(2)查询v$recovery_file_dest视图确定db_recovery_file_dest_size的使用情况。
(3)查询v$flash_recovery_area_usage视图确定那种文件占用空间。
2、解决方法主要考虑以下三个方面:
(1)如果db_recovery_file_dest_size 较小,修改db_recovery_file_dest_size 为更大的值。
(2)如果db_recovery_file_dest指定的目录空间不足,解决办法:
A、可另指定空间,将源db_recovery_file_dest中的文件拷贝到该空间下;
B、为该目录新增磁盘空间;
C、将该目录空间中的文件备份到其他目录,并进行压缩。
(3)通过RMAN删除已经失效的文件。
【实际操作】
1、查看db_recovery_file相关参数
SQL> show parameter db_recovery NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ db_recovery_file_dest string /home/erp_db_rec/db_recovery_d est db_recovery_file_dest_size big integer 200G
[oraprod@erpdb erp_db_rec]$ pwd /home/erp_db_rec [oraprod@erpdb erp_db_rec]$ du -sh db_recovery_dest/ 17G db_recovery_dest/
根据参数可以判断db_recovery_file_dest 指定的目录足够大。
2、查看recovery file的使用率
SQL> set linesize 2000 SQL> col name form a40 SQL> col SPACE_LIMIT form 99999999999999 SQL> col SPACE_USED form 99999999999999 SQL> col NUMBER_OF_FILES form 9999 SQL> select rfd.NAME,rfd.SPACE_LIMIT,rfd.SPACE_USED,rfd.SPACE_USED/rfd.SPACE_LIMIT*100 as "Rate(%)",rfd.NUMBER_OF_FILES from v$recovery_file_dest rfd; NAME SPACE_LIMIT SPACE_USED Rate(%) NUMBER_OF_FILES ---------------------------------------- --------------- --------------- ---------- --------------- /home/erp_db_rec/db_recovery_dest 214748364800 183002194944 85.2170377 736
查询发现已经使用了85.21%了。
3、查询是哪类文件占用空间
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 0 0 0 BACKUP PIECE 85.22 0 736 IMAGE COPY 0 0 0 FLASHBACK LOG 0 0 0 FOREIGN ARCHIVED LOG 0 0 0 AUXILIARY DATAFILE COPY 0 0 0
8 rows selected.
通过查询可知是BACKUP PIECE使用了recovery_file_dest统计的空间。
由上述查询可知:对db_recovery_file_dest和备份空间中的文件定期进行删除,但是在数据库层面为进行清理,导致v$recovery_file_dest视图将已删除的文件统计在内导致,判断通过RMAN删除无效的备份集可解决。
4、解决此问题的方法
(1)对backupset进行交叉检查。
RMAN> crosscheck backupset; using channel ORA_DISK_1 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/home/erp_db_rec/db_recovery_dest/PROD/backupset/2017_11_07/o1_mf_annnn_TAG20171107T230006_f03lmq9w_.bkp RECID=1405 STAMP=959468407 crosschecked backup piece: found to be 'EXPIRED' ...... ...... backup piece handle=/home/erp_db_rec/db_recovery_dest/PROD/backupset/2017_11_09/o1_mf_annnn_TAG20171109T230007_f08vcrc8_.bkp RECID=1420 STAMP=959641208 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/home/erp_db_rec/db_recovery_dest/PROD/backupset/2017_11_09/o1_mf_annnn_TAG20171109T230007_f08vcrf1_.bkp RECID=1421 STAMP=959641208 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/home/erp_db_rec/db_recovery_dest/PROD/backupset/2017_11_09/o1_mf_annnn_TAG20171109T230007_f08vcrhd_.bkp RECID=1422 STAMP=959641208 crosschecked backup piece: found to be 'EXPIRED' backup piece handle=/home/erp_db_rec/db_recovery_dest/PROD/backupset/2017_11_09/o1_mf_annnn_TAG20171109T230932_f08vxdxq_.bkp RECID=1426 STAMP=959641772 ....... backup piece handle=/home/erp_db_rec/db_recovery_dest/PROD/backupset/2018_03_22/o1_mf_annnn_TAG20180322T231231_fc7kz019_.bkp RECID=2963 STAMP=971478752 crosschecked backup piece: found to be 'AVAILABLE' backup piece handle=/home/erp_db_rec/db_recovery_dest/PROD/autobackup/2018_03_22/o1_mf_s_971478753_fc7kz217_.bkp RECID=2964 STAMP=971478754 Crosschecked 1510 objects
(2)删除无效的备份集
RMAN> delete noprompt expired backupset; using channel ORA_DISK_1 ...... backup piece handle=/backup/rman_backup/20180219/level1backup/PROD_2218_1_5asrlg89.20180219 RECID=2573 STAMP=968540425 deleted backup piece backup piece handle=/backup/rman_backup/20180219/level1backup/PROD_2217_1_59srlg89.20180219 RECID=2574 STAMP=968540425 deleted backup piece backup piece handle=/backup/rman_backup/20180219/level1backup/PROD_2219_1_5bsrlg89.20180219 RECID=2575 STAMP=968540426 Deleted 1125 EXPIRED objects
(3)使用v$recovery_file_dest验证使用率
SQL> select rfd.NAME,rfd.SPACE_LIMIT,rfd.SPACE_USED,rfd.SPACE_USED/rfd.SPACE_LIMIT*100 as "Rate(%)",rfd.NUMBER_OF_FILES from v$recovery_file_dest rfd; NAME SPACE_LIMIT SPACE_USED Rate(%) NUMBER_OF_FILES ---------------------------------------- --------------- --------------- ---------- --------------- /home/erp_db_rec/db_recovery_dest 214748364800 18025081856 8.39358282 162
删除无效的备份集后,空间使用率变成8.39%。
(4)查询BACKUP PIECE 的使用情况
SQL> select file_type, 2 percent_space_used as used, 3 percent_space_reclaimable as reclaimable, 4 number_of_files as "number" 5 from v$flash_recovery_area_usage; FILE_TYPE USED RECLAIMABLE number ----------------------- ---------- ----------- ---------- CONTROL FILE 0 0 0 REDO LOG 0 0 0 ARCHIVED LOG 0 0 0 BACKUP PIECE 8.39 0 162 IMAGE COPY 0 0 0 FLASHBACK LOG 0 0 0 FOREIGN ARCHIVED LOG 0 0 0 AUXILIARY DATAFILE COPY0 0 0
8 rows selected.
完整解决ORA-19815问题。
原文地址:http://blog.51cto.com/peenboo/2090171