All technological notes.
| Command | Description |
|---|---|
SHOW RETENTION POLICY; |
Show the current retention policy |
CONFIGURE RETENTION POLICY CLEAR; |
To revert to the default value |
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; |
Default, Enable Redundancy Retention Policy |
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF <days> DAYS; |
Enable Recovery Window Retention Policy |
CONFIGURE RETENTION POLICY TO NONE; |
Disable Retention Policy |
REPORT OBSOLETE; |
Report obsolete backup |
DELETE OBSOLETE; |
Delete obsolete backup |
retention policy
RMAN CONFIGURE command or Enterprise Manager.There are two types of retention policies:
Recovery window: Establishes a period of time within which point-in-time recovery must be possibleRedundancy: Establishes a fixed number of backups that must be keptRetention policies are mutually exclusive.

Recovery Window
point-in-time recovery to just before the error occurred.Recovery Window Retention Policy
If configure the RECOVERY WINDOW OF <days> DAYS, the window stretches
SYSDATEpoint of recoverability, which is the earliest date to which you want to recover.point of recoverability: SYSDATE - <days>data file, there must always exist at least one backup that satisfies the following condition:
SYSDATE - backup_checkpoint_time >= recovery_windowTo prevent the record of older backups from being overwritten in the control file.
recovery catalog |
CONTROL_FILE_RECORD_KEEP_TIME parameter |
|---|---|
| not using | >=recovery window |
| using | >=the time period between catalog resynchronizations |
Resynchronizations happen when:
RESYNC CATALOG command.Command:
-- where <days> is the size of the recovery window.
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF <days> DAYS;
recovery window is the best practice for specifying a retention policy, it can complicate disk space usage planning because the number of backups that must be kept by the recovery window is not constant and depends on the backup schedule. 原因在于恢复窗口期内备份的个数受到备份日程的影响, 从而造成磁盘空间难以计划.Example:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
Q: for point-in-time recovery, which file is needed?
Take away
recovery window, along with all subsequent logs, is necessary for complete recovery.
SYSDATE - backup_checkpoint_time >= recovery_window 恢复窗口外Redundancy-based retention policy
1Command:
-- Replace <copies> with the desired number of copies to meet your policy requirements.
CONFIGURE RETENTION POLICY TO REDUNDANCY <copies>;
Disabling the Retention Policy if:
Consequences of disabling the retention policy:
CONTROL_FILE_RECORD_KEEP_TIME initialization parameter.Exceptions:
retention policy by creating an archival backup.Command:
CONFIGURE RETENTION POLICY TO NONE;
Backup files can be marked as expired or obsolete. 备份文件标记
Expired:
Obsolete
The backup retention policy only applies to
full or level 0datafile and control file.The retention policy does not directly affect archived redo logs and incremental level 1 backups.
full backups exist that need them. 当其需要的父备份不存在时Datafile backup sets cannot be deleted until all datafile backups within the backup set are obsolete. 整体性
-- identify which backups are obsolete
REPORT OBSOLETE;
-- Deletes obsolete data file backups, copies, archived redo log files and log backups.
DELETE OBSOLETE;
DELETE OBSOLETE periodically to minimize space wasted by storing obsolete backups.
DELETE OBSOLETE in a weekly script.