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才会被清理