list backup of database by summary; RMAN> list backup of database summary;
List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ----------------- ------- ------- ---------- --- 23 B F A DISK 20150506 15:10:28 1 1 NO TAG20150506T150958 25 B F A DISK 20150506 15:11:29 1 1 NO TAG20150506T151059 27 B F A DISK 20150506 15:13:24 1 1 NO TAG20150506T151252
SYS@tstdb1-SQL> select * from v$recovery_area_usage;
alter system set db_recovery_file_dest_size=10G scope=memory;
create table t0506_3 tablespace TS0422_1 as select * from dba_objects; insert into t0506_3 select * from t0506_3; ---執行若干次 commit; create table t0506_tpl as select * from t0506_3;
---循環delete->insert生成Archivelog填充FRA declare begin while ( true ) loop delete t0506_3; commit; insert into t0506_3 select * from t0506_tpl; commit; end loop; end; /
---不久FRA達到100%使用率: SYS@tstdb1-SQL> select * from v$recovery_area_usage;
---alert.log里不斷有提示FRA滿的信息輸出 ************************************************************************ ARC3: Error 19809 Creating archive log file to '/oradata06/fra/TSTDB1/archivelog/2015_05_06/o1_mf_1_63_%u_.arc' Errors in file /oracle/app/oracle/diag/rdbms/tstdb1/tstdb1/trace/tstdb1_arc0_42205562.trc: ORA-19815: WARNING: db_recovery_file_dest_size of 10737418240 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.
###1、測試超出retention policy規定的backup是否在空間用滿的時候會被刪除 RMAN> list backup of database summary;
List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ----------------- ------- ------- ---------- --- 23 B F A DISK 20150506 15:10:28 1 1 NO TAG20150506T150958 25 B F A DISK 20150506 15:11:29 1 1 NO TAG20150506T151059 27 B F A DISK 20150506 15:13:24 1 1 NO TAG20150506T151252
RMAN> show RETENTION POLICY;
RMAN configuration parameters for database with db_unique_name TSTDB1 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
---將redundancy 3改成redundancy 2,看下有否一個版本的backup會被刪除 CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
ARC3: Error 19809 Creating archive log file to '/oradata06/fra/TSTDB1/archivelog/2015_05_06/o1_mf_1_14_%u_.arc' Deleted Oracle managed file /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_3_1jQKKtsWK_.arc Deleted Oracle managed file /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_2_1jQKKtmNK_.arc Deleted Oracle managed file /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_1_1jQKKtU5p_.arc Deleted Oracle managed file /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_1_1jQIqfg-3_.arc Deleted Oracle managed file /oradata06/fra/TSTDB1/archivelog/2015_05_02/o1_mf_1_2_1jQIqfl7C_.arc Deleted Oracle managed file /oradata06/fra/TSTDB1/backupset/2015_05_06/o1_mf_nnndf_TAG20150506T150958_1jVEZMOAo_.bkp <---果然被刪除 Archived Log entry 67 added for thread 1 sequence 14 ID 0x79f955eb dest 1: Archiver process freed from errors. No longer stopped Archived Log entry 68 added for thread 1 sequence 13 ID 0x79f955eb dest 1: Wed May 06 15:32:11 2015 Thread 1 advanced to log sequence 16 (LGWR switch) Current log# 1 seq# 16 mem# 0: /oradata06/testaaaaa/redo01a.log Current log# 1 seq# 16 mem# 1: /oradata06/testaaaaa/redo01b.log Archived Log entry 69 added for thread 1 sequence 15 ID 0x79f955eb dest 1:
RMAN> list backup of database summary;
List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ----------------- ------- ------- ---------- --- 25 B F A DISK 20150506 15:11:29 1 1 NO TAG20150506T151059 27 B F A DISK 20150506 15:13:24 1 1 NO TAG20150506T151252
RMAN> list backup of database summary; List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ----------------- ------- ------- ---------- --- 25 B F A DISK 20150506 15:11:29 1 1 NO TAG20150506T151059 27 B F A DISK 20150506 15:13:24 1 1 NO TAG20150506T151252
RMAN> list backup of database;
List of Backup Sets ===================
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ----------------- 25 Full 2.57G DISK 00:00:30 20150506 15:11:29 BP Key: 29 Status: AVAILABLE Compressed: NO Tag: TAG20150506T151059 Piece Name: /oradata06/vlib/03q69083_1_2 <----指向了FRA以外的路徑 List of Datafiles in backup set 25 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ----------------- ---- 1 Full 12723362275569 20150506 15:11:00 /oradata06/testaaaaa/system01.dbf 2 Full 12723362275569 20150506 15:11:00 /oradata06/testaaaaa/sysaux01.dbf 3 Full 12723362275569 20150506 15:11:00 /oradata06/testaaaaa/undotbs01.dbf 4 Full 12723362275569 20150506 15:11:00 /oradata06/testaaaaa/users01.dbf 5 Full 12723362275569 20150506 15:11:00 /oradata06/testaaaaa/ts0329_1.dbf 6 Full 12723362275569 20150506 15:11:00 /oradata06/testaaaaa/xdbts1.dbf 7 Full 12723361999437 20150503 15:11:55 /oradata06/testaaaaa/ts0212.dbf 8 Full 12723361999437 20150503 15:11:55 /oradata06/testaaaaa/ts0212_1.dbf 9 Full 12723362275569 20150506 15:11:00 /oradata06/testaaaaa/ts0422_1.dbf 10 Full 12723362275569 20150506 15:11:00 /oradata06/testaaaaa/ts0505_1.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time ------- ---- -- ---------- ----------- ------------ ----------------- 27 Full 2.57G DISK 00:00:32 20150506 15:13:24 BP Key: 27 Status: AVAILABLE Compressed: NO Tag: TAG20150506T151252 Piece Name: /oradata06/fra/TSTDB1/backupset/2015_05_06/o1_mf_nnndf_TAG20150506T151252_1jVEjjcey_.bkp List of Datafiles in backup set 27 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- ----------------- ---- 1 Full 12723362275665 20150506 15:12:52 /oradata06/testaaaaa/system01.dbf 2 Full 12723362275665 20150506 15:12:52 /oradata06/testaaaaa/sysaux01.dbf 3 Full 12723362275665 20150506 15:12:52 /oradata06/testaaaaa/undotbs01.dbf 4 Full 12723362275665 20150506 15:12:52 /oradata06/testaaaaa/users01.dbf 5 Full 12723362275665 20150506 15:12:52 /oradata06/testaaaaa/ts0329_1.dbf 6 Full 12723362275665 20150506 15:12:52 /oradata06/testaaaaa/xdbts1.dbf 7 Full 12723361999437 20150503 15:11:55 /oradata06/testaaaaa/ts0212.dbf 8 Full 12723361999437 20150503 15:11:55 /oradata06/testaaaaa/ts0212_1.dbf 9 Full 12723362275665 20150506 15:12:52 /oradata06/testaaaaa/ts0422_1.dbf 10 Full 12723362275665 20150506 15:12:52 /oradata06/testaaaaa/ts0505_1.dbf
RMAN configuration parameters for database with db_unique_name TSTDB1 are: CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
RMAN> report need backup; <---沒有輸出表示REDUNDANCY 2的條件依然滿足
RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 2 Report of files with less than 2 redundant backups File #bkps Name ---- ----- -----------------------------------------------------
RMAN> list backup of datafile 2 summary;
List of Backups =============== Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag ------- -- -- - ----------- ----------------- ------- ------- ---------- --- 25 B F A DISK 20150506 15:11:29 1 1 NO TAG20150506T151059 27 B F A DISK 20150506 15:13:24 1 1 NO TAG20150506T151252
###4、測試ARCHIVELOG DELETION POLICY TO backed up X times 的情況下FRA里的archivelog在何種條件下才會被刪除 CONFIGURE ARCHIVELOG DELETION POLICY TO backed up 2 times to device type disk;
RMAN> show ARCHIVELOG DELETION POLICY;
RMAN configuration parameters for database with db_unique_name TSTDB1 are: CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 2 TIMES TO DISK;
---先備份一次sequence: 11~20的archivelog到/oradata06/vlib/,看這些archivelog會否直接被刪除 backup archivelog sequence between 11 and 20 format '/oradata06/vlib/arc_%U';
以上測試驗證了在FRA滿的情況下: 對于超出retention policy的backup會被自動清理; 把backupset備份到FRA以外的區域時,FRA里的backupset會被自動清理; 對于ARCHIVELOG DELETION POLICY設置為none的情況,只要FRA里的archivelog已經進行過了備份,FRA里的archivelog就會被清理 對于ARCHIVELOG DELETION POLICY設置為BACKED UP N TIMES TO DISK的情況,"至少備份N次到disk"這個前提必須被滿足,FRA里的archivelog才會被清理