快速恢复区备份集清理操作演练:
如下查询发现BACKUP PIECE使用率22.41%
SQL> select file_type,percent_space_used,percent_space_reclaimable,number_of_files from v$flash_recovery_area_usage
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
---------------------------------------- ------------------ ------------------------- ---------------
CONTROL FILE 0 0 0
REDO LOG 0 0 0
ARCHIVED LOG 0 0 0
BACKUP PIECE 22.41 0 4
IMAGE COPY 0 0 0
FLASHBACK LOG 6.51 3.26 8
FOREIGN ARCHIVED LOG 0 0 0
rman中列出备份集:
RMAN> list backup;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
35 1.15M DISK 00:00:01 23-JAN-22
BP Key: 35 Status: AVAILABLE Compressed: NO Tag: TAG20220123T003617
Piece Name: /u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_annnn_TAG20220123T003617_jyrdn1z1_.bkp
List of Archived Logs in backup set 35
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 144 2082378 23-JAN-22 2082416 23-JAN-22
1 145 2082416 23-JAN-22 2084635 23-JAN-22
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
36 Full 1.33G DISK 00:00:10 23-JAN-22
BP Key: 36 Status: AVAILABLE Compressed: NO Tag: TAG20220123T003619
Piece Name: /u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_nnndf_TAG20220123T003619_jyrdn34h_.bkp
List of Datafiles in backup set 36
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 2082416 23-JAN-22 /u01/app/oracle/oradata/orcl151/system01.dbf
2 Full 2082416 23-JAN-22 /u01/app/oracle/oradata/orcl151/sysaux01.dbf
3 Full 2082416 23-JAN-22 /u01/app/oracle/oradata/orcl151/undotbs01.dbf
4 Full 2082416 23-JAN-22 /u01/app/oracle/oradata/orcl151/users01.dbf
5 Full 2082416 23-JAN-22 /u01/app/oracle/oradata/orcl151/example01.dbf
6 Full 2082416 23-JAN-22 /u01/oracle/audit01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
37 Full 9.58M DISK 00:00:01 23-JAN-22
BP Key: 37 Status: AVAILABLE Compressed: NO Tag: TAG20220123T003619
Piece Name: /u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_ncsnf_TAG20220123T003619_jyrdnm6v_.bkp
SPFILE Included: Modification time: 22-JAN-22
SPFILE db_unique_name: ORCL151
Standby Control File Included: Ckp SCN: 2082416 Ckp time: 23-JAN-22
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
38 12.00K DISK 00:00:00 23-JAN-22
BP Key: 38 Status: AVAILABLE Compressed: NO Tag: TAG20220123T003638
Piece Name: /u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_annnn_TAG20220123T003638_jyrdnpcy_.bkp
List of Archived Logs in backup set 38
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 146 2084635 23-JAN-22 2084663 23-JAN-22
系统层面手动删除备份集:
[oracle@OEL792 2022_01_23]$ rm -rf o1_mf_annnn_TAG20220123T003617_jyrdn1z1_.bkp
[oracle@OEL792 2022_01_23]$ rm -rf o1_mf_annnn_TAG20220123T003638_jyrdnpcy_.bkp
[oracle@OEL792 2022_01_23]$ rm -rf o1_mf_ncsnf_TAG20220123T003619_jyrdnm6v_.bkp
[oracle@OEL792 2022_01_23]$ rm -rf o1_mf_nnndf_TAG20220123T003619_jyrdn34h_.bkp
[oracle@OEL792 2022_01_23]$ ll
total 0
此后再次查看快速恢复区使用率情况,备份集使用率依然是22.41%。并且list backup时,被删除的备份集也能正常显示。
SQL> select file_type,percent_space_used,percent_space_reclaimable,number_of_files from v$flash_recovery_area_usage
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
---------------------------------------- ------------------ ------------------------- ---------------
CONTROL FILE 0 0 0
REDO LOG 0 0 0
ARCHIVED LOG 0 0 0
BACKUP PIECE 22.41 0 4
IMAGE COPY 0 0 0
FLASHBACK LOG 6.51 3.26 8
FOREIGN ARCHIVED LOG 0 0 0
此处虽然备份集被删除,但空间并没有得到释放。
需要通过rman释放空间,如下所示:
RMAN> crosscheck backupset;
using channel ORA_DISK_1
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_annnn_TAG20220123T003617_jyrdn1z1_.bkp RECID=35 STAMP=1094690177
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_nnndf_TAG20220123T003619_jyrdn34h_.bkp RECID=36 STAMP=1094690179
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_ncsnf_TAG20220123T003619_jyrdnm6v_.bkp RECID=37 STAMP=1094690195
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=/u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_annnn_TAG20220123T003638_jyrdnpcy_.bkp RECID=38 STAMP=1094690198
Crosschecked 4 objects
RMAN> delete expired backupset;
using channel ORA_DISK_1
List of Backup Pieces
BP Key BS Key Pc# Cp# Status Device Type Piece Name
------- ------- --- --- ----------- ----------- ----------
35 35 1 1 EXPIRED DISK /u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_annnn_TAG20220123T003617_jyrdn1z1_.bkp
36 36 1 1 EXPIRED DISK /u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_nnndf_TAG20220123T003619_jyrdn34h_.bkp
37 37 1 1 EXPIRED DISK /u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_ncsnf_TAG20220123T003619_jyrdnm6v_.bkp
38 38 1 1 EXPIRED DISK /u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_annnn_TAG20220123T003638_jyrdnpcy_.bkp
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_annnn_TAG20220123T003617_jyrdn1z1_.bkp RECID=35 STAMP=1094690177
deleted backup piece
backup piece handle=/u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_nnndf_TAG20220123T003619_jyrdn34h_.bkp RECID=36 STAMP=1094690179
deleted backup piece
backup piece handle=/u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_ncsnf_TAG20220123T003619_jyrdnm6v_.bkp RECID=37 STAMP=1094690195
deleted backup piece
backup piece handle=/u01/app/oracle/oradata/orcl151/flashback/ORCL151/backupset/2022_01_23/o1_mf_annnn_TAG20220123T003638_jyrdnpcy_.bkp RECID=38 STAMP=1094690198
Deleted 4 EXPIRED objects
再次查询,快速恢复区备份集占用率将为0.
SQL> select file_type,percent_space_used,percent_space_reclaimable,number_of_files from v$flash_recovery_area_usage;
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
---------------------------------------- ------------------ ------------------------- ---------------
CONTROL FILE 0 0 0
REDO LOG 0 0 0
ARCHIVED LOG 0 0 0
BACKUP PIECE 0 0 0
IMAGE COPY 0 0 0
FLASHBACK LOG 6.51 3.26 8
FOREIGN ARCHIVED LOG 0 0 0
7 rows selected.