Configuring a Redundancy-Based Retention Policy
The REDUNDANCY parameter of the CONFIGURE RETENTION POLICY command
specifies how many full or level 0 backups of each datafile and control file
that RMAN should keep.
In other words, if the number of full or level 0 backups for a specific datafile or control file exceeds the REDUNDANCY setting, then RMAN considers the extra backups as obsolete. The default retention policy is REDUNDANCY 1.
RMAN> show RETENTION POLICY;
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
Now take full backup or 0 level backup two times.
RMAN> backup database;
Starting backup at 26-FEB-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/sample01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 26-FEB-15
channel ORA_DISK_1: finished piece 1 at 26-FEB-15
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2015_02_26/o1_mf_nnndf_TAG20150226T083509_bgx3c816_.bkp tag=TAG20150226T083509 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:08:11
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 26-FEB-15
channel ORA_DISK_1: finished piece 1 at 26-FEB-15
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2015_02_26/o1_mf_ncsnf_TAG20150226T083509_bgx3tlr4_.bkp tag=TAG20150226T083509 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 26-FEB-15.
-------------------------------------------
RMAN> backup database;
Starting backup at 26-FEB-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/sysaux01
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/example0
input datafile file number=00006 name=/u01/app/oracle/oradata/sample01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/users01.
channel ORA_DISK_1: starting piece 1 at 26-FEB-15
channel ORA_DISK_1: finished piece 1 at 26-FEB-15
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2015_02_26/
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:15
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 26-FEB-15
channel ORA_DISK_1: finished piece 1 at 26-FEB-15
piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2015_02_26/
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 26-FEB-15
Check the backups by listing
RMAN> list backup summary;
List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
10 B F A DISK 26-FEB-15 1 1 NO TAG2
11 B F A DISK 26-FEB-15 1 1 NO TAG2
12 B F A DISK 26-FEB-15 1 1 NO TAG2
13 B F A DISK 26-FEB-15 1 1 NO TAG2
Now we have two full backups, due to retention policy is one backup(which is taken first) will become obsolete. We can check as bellow.
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 10 26-FEB-15
Backup Piece 10 26-FEB-15 /u01/app/oracle/flash_recove
Backup Set 11 26-FEB-15
Backup Piece 11 26-FEB-15 /u01/app/oracle/flash_recove
About listed backup is not required for restore and RMAN will not using for any future restore.
If we need to release the space in mount point. We can delete backups by using RMAN command as bellow.
RMAN> delete 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 10 26-FEB-15
Backup Piece 10 26-FEB-15 /u01/app/oracle/flash_recovery_area/ORCL/backupset/2015_02_26/o1_mf_nnndf_TAG20150226T083509_bgx3c816_.bkp
Backup Set 11 26-FEB-15
Backup Piece 11 26-FEB-15 /u01/app/oracle/flash_recovery_area/ORCL/backupset/2015_02_26/o1_mf_ncsnf_TAG20150226T083509_bgx3tlr4_.bkp
Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2015_02_26/o1_mf_nnndf_TAG20150226T083509_bgx3c816_.bkp RECID=10 STAMP=872670912
deleted backup piece
backup piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/2015_02_26/o1_mf_ncsnf_TAG20150226T083509_bgx3tlr4_.bkp RECID=11 STAMP=872671402
Deleted 2 objects
If we need to change the retention policy, we can do as follow.
RMAN>CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
Configuring a Recovery Window-Based Retention Policy
The RECOVERY WINDOW parameter
of the CONFIGURE command specifies the number of days between the
current time and the earliest point of recoverability.
No comments:
Post a Comment