In Oracle RMAN (Recovery Manager), the recovery window is a key concept used to define your backup retention policy. It specifies the period of time (in days) for which you want to be able to recover your database to any point in time. RMAN uses this window to determine which backups and archived logs to retain and which can be deleted.
What is the Recovery Window?
The recovery window is the number of days into the past that you want your database to be recoverable.
For example, if you set a recovery window of 7 days, RMAN will keep all backups and archived logs needed to restore and recover the database to any point within the last 7 days.
How Recovery Window Works?
RMAN considers a backup as obsolete if it is no longer needed to satisfy the recovery window.
When you run DELETE OBSOLETE, RMAN removes backups and archived logs that are outside the recovery window.
Setting the Recovery Window
You set the recovery window using the CONFIGURE RETENTION POLICY command:
This tells RMAN to retain all backups and archived logs required for point-in-time recovery within the last 7 days.
Example Scenario
Suppose today is May 21, and you set a recovery window of 7 days.
RMAN will keep all backups and archived logs needed to recover the database to any point between May 14 and May 21.
Any backups or logs older than May 14 that are not needed for recovery within this window are considered obsolete.
Checking the Retention Policy
You can check your current retention policy with:
RMAN> SHOW RETENTION POLICY;
Deleting Obsolete Backups
To remove backups and archived logs that are outside the recovery window, use:
RMAN> DELETE OBSOLETE;
Recovery Window vs. Redundancy
Recovery Window: Retains backups based on time (e.g., last 7 days).
Redundancy: Retains a specific number of backup copies (e.g., last 2 backups).
You can only have one retention policy active at a time (either recovery window or redundancy).
Best Practices
Set the recovery window based on your business requirements for point-in-time recovery.
Regularly run DELETE OBSOLETE to free up storage.
Monitor backup and recovery operations to ensure compliance with your retention policy.