This content has been marked as final. Show 6 replies
Have a look at
The Recovery Manager (RMAN) provides the CONFIGURE RETENTION POLICY command to create a persistent and automatic backup retention policy for controlling how long backups and copies should be retained. When a backup retention policy is in effect, RMAN considers the backups and copies of data files and control files as obsolete (i.e., the backups and copies are no longer needed for media recovery), according to the criteria specified in the CONFIGURE RETENTION POLICY command. The REPORT OBSOLETE and DELETE OBSOLETE commands can be executed periodically or regularly to view obsolete files and to delete them, respectively
when a recovery window of five days is implemented, the window of time must extend back exactly five days from the present, so that a backup can be restored and recovered to this point. This retention policy can be implemented by executing the following RMAN command:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 5 DAYS;
Executing the above command ensures that for each data file, one backup that is older than the point of recoverability must be retained. For example, if the recovery window is five, there must always exist one backup of each data file that satisfies the following condition:
SYSDATE – (SELECT CHECKPOINT_TIME FROM V$DATAFILE) >= 5
All backups older than the most recent backup that satisfies the above condition are obsolete. The recovery window always keeps pace with the current time. For example, if the current day is March 12 and the recovery window is five days, then the recovery window stretches between March 7 and March 12.
see this blog
There are 2 types of RMAN retention policies:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
A redundancy-based retention policy specifies how many backups of each datafile must be retained.
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
A recovery window is a period of time that begins with the current time and extends backward in time to the point of recoverability, that is, the earliest point to which you can recover following a media failure.
A backupset or other backup parts that have fallen behind the retention policy are marked obsolete.
If backupsets and other RMAN backups are removed from disk not by using RMAN then these will be marked expired after running RMAN crosscheck.
If you store backup in the Flash/Fast Recovery Area than obsolete backups are automatically deleted if there are space constrains. To reclaim space manually you can use RMAN delete obsolete. As with other forms of the DELETE command, the files deleted are removed from backup media, deleted from the recovery catalog, and marked as DELETED in the control file
You can remove backup entries that are marked as expired using the RMAN command delete expired.
Edited by: Markus Waldorf on Sep 9, 2010 1:46 PM
Did you read this note from Khurram?
You've gotten some pretty good comment already, but I didn't see any of the previous posters point out a vital detail.
Let's say you specify a recovery window of 7 days. That means rman will not obsolete any backup needed for recovery to any point in the last seven days. Check. But what's the subtle detail?
Suppose you take a full backup on 1 Sep, then start taking incremental backups going forward. Now we're down to 10 Sep which puts that full backup 3 days earlier than the recovery window. However, it is still the most recent full backup and so is needed to recover into any time during the 7 day recovery window. Therefore, it will NOT be marked obsolete.
Think about what this does in the textbook backup routine of a full backup every 7 days, with incremental backups the other 6 days. We take a full backup on day 1. We take incremental backups on days 2 - 7. We take a full backup again on Day 8, and incrementals on days 9 - 14.
On day 14, our recovery window reaches back to day 7, and the only way to recover to day 7 is to use the full backup from day 1 and the incrementals from 2 through 7. So even though we have a 7 day recovery window, we actually have 14 days worth of backups that are yet to go obsolete. On day 15, we can obsolete and drop everything prior to the full backup on Day 8.
Day = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Bkup = F I I I I I I F I I I I I I
Ed- Thanks for the posting it answered a question I had been researching.