标签:
如果用操作系统的rm命令去删除过期的备份文件,会显得有些业余。其实可以通过RMAN中的备份保留策略来完成前述的所有操作,既方便又省事,同时还减少了出错的可能性。
RMAN中的备份保留策略决定了哪些数据文件需要被备份及哪些备份文件可以被删除,该策略由configure retention policy命令配置,持久保存于控制文件和recovery catalog(如果启用)。备份保留策略分为两种:备份冗余度保留策略和恢复窗口保留策略,无论采用哪种策略,如果RMAN认为某个备份需要保留,那么该备份之后产生的归档也必须保留。
备份冗余度是指同一文件(数据文件,控制文件)的备份数量,比如将冗余度设置为1,表示控制文件和所有数据文件需要且仅需要保留一份全备份以及其后产生的所有归档日志。下面的实验说明如何利用备份冗余度策略管理备份:
# 设置备份冗余度 RMAN> configure retention policy to redundancy 2; //设置备份冗余度为2 new RMAN configuration parameters: CONFIGURE RETENTION POLICY TO REDUNDANCY 2; new RMAN configuration parameters are successfully stored # 查看需要备份的数据文件 RMAN> report need backup; 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 ---- ----- ----------------------------------------------------- 1 1 /u01/app/oracle/oradata/prac/system01.dbf 2 1 /u01/app/oracle/oradata/prac/sysaux01.dbf 3 1 /u01/app/oracle/oradata/prac/undotbs01.dbf ..... # 查看可废弃的备份文件 RMAN> report obsolete; RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 Report of obsolete backups and copies Type Key Completion Time Filename/Handle -------------------- ------ ------------------ -------------------- Backup Set 15 25-MAR-14 Backup Piece 15 25-MAR-14 /u01/app/oracle/flash_recovery_area/PRAC/backupset/2014_03_25/o1_mf_nnndf_TAG20140325T113452_9m1ybxk2_.bkp Backup Set 16 25-MAR-14 Backup Piece 16 25-MAR-14 /u01/app/oracle/flash_recovery_area/PRAC/backupset/2014_03_25/o1_mf_ncsnf_TAG20140325T113452_9m1ydzfw_.bkp # 删除可废弃的文件 RMAN> delete obsolete; //或者使用delete noprompt obsolete,将不会出现删除确认提示 RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 1 using channel ORA_DISK_1 Deleting the following obsolete backups and copies: Type Key Completion Time Filename/Handle -------------------- ------ ------------------ -------------------- Backup Set 15 25-MAR-14 Backup Piece 15 25-MAR-14 /u01/app/oracle/flash_recovery_area/PRAC/backupset/2014_03_25/o1_mf_nnndf_TAG20140325T113452_9m1ybxk2_.bkp Backup Set 16 25-MAR-14 Backup Piece 16 25-MAR-14 /u01/app/oracle/flash_recovery_area/PRAC/backupset/2014_03_25/o1_mf_ncsnf_TAG20140325T113452_9m1ydzfw_.bkp Do you really want to delete the above objects (enter YES or NO)? y deleted backup piece backup piece handle=/u01/app/oracle/flash_recovery_area/PRAC/backupset/2014_03_25/o1_mf_nnndf_TAG20140325T113452_9m1ybxk2_.bkp RECID=15 STAMP=843132893 deleted backup piece backup piece handle=/u01/app/oracle/flash_recovery_area/PRAC/backupset/2014_03_25/o1_mf_ncsnf_TAG20140325T113452_9m1ydzfw_.bkp RECID=16 STAMP=843132959 Deleted 2 objects
标签:
原文地址:http://www.cnblogs.com/magnes/p/5613995.html