首页 » ORACLE 9i-23ai » What is backup retention policy?

What is backup retention policy?

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.

The retention policy is continuous. As the data file, control file, and archived redo log backups are produced over time, RMAN keeps track of them and decides which to retain and which to mark as obsolete. RMAN does not automatically delete the backups or copies.

The term obsolete does not mean the same as expired. A backup or copy is obsolete when the REPORT OBSOLETE or DELETE OBSOLETE command determines, based on the user-defined retention policy, that the backup or copy is not needed for media recovery. However, a backup or copy expires only when RMAN performs a crosscheck and finds that the file is missing from the hard disk or the media manager has returned “not found” for the file. In brief, obsolete means “not needed,” whereas expired means “not found.”

Besides affecting the data file and control file backups, the retention policy affects archived redo logs and archived redo log backups. First, RMAN decides which data file and control file backups are obsolete. Then, RMAN considers the archived redo log backups (that are older than the oldest data file or control file backup that must be retained) as obsolete.

There are two mutually exclusive options for implementing a backup retention policy.

  1. Specifying a recovery window by using the CONFIGURE RETENTION POLICY TO RECOVERY WINDOW command: A recovery window is a period of time that begins with the current time and extends backward in time to the point of recoverability. The point of recoverability is the earliest time for a hypothetical point-in-time recovery (the earliest point to which a database can be recovered following a media failure).For example, 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.

  2. Specifying redundancy by using the CONFIGURE RETENTION POLICY TO REDUNDANCY command: The REDUNDANCY parameter specifies that any number of backups or copies beyond a specified number does not need to be retained. For example, the CONFIGURE RETENTION POLICY TO REDUNDANCY 3; command specifies that a maximum of three backups or copies of a data file or control file can be retained. Redundancy is the default type of retention policy.By default, the retention policy is configured to REDUNDANCY = 1 to maintain compatibility with the behavior of the REPORT OBSOLETE command in earlier RMAN releases. The CONFIGURE RETENTION POLICY CLEAR; command can be executed to return the retention policy to the default value of one.

The retention policy can be configured to NONE by executing the CONFIGURE RETENTION POLICY TO NONE; command. It disables the retention policy altogether. If the retention policy is configured to NONE, the REPORT OBSOLETE and DELETE OBSOLETE commands do not consider any backup or copy as obsolete.

打赏

目前这篇文章有1条评论(Rss)评论关闭。

  1. Dorothy Congrove | #1
    2011-12-21 at 07:20

    I am glad to be a visitant of this stark site, appreciate it for this rare info!