当前位置:网站首页>RMAN backup concept_ About backup retention policy

RMAN backup concept_ About backup retention policy

2022-06-09 08:43:00 Count words and lines

have access to CONFIGURE RETENTION POLICY Command to create a continuous and automatic backup retention policy .

When the backup retention policy takes effect ,RMAN according to CONFIGURE The criteria specified by the command treat a backup of a data file or control file as an expired backup , in other words , Backups that are no longer needed for recovery . have access to REPORT OBSOLETE Command to view expired files and DELETE OBSOLETE Command to delete them .

When backups are generated over time , Old backups will become out of date , Because they are no longer needed to meet retention policies .RMAN Can identify expired files , But it doesn't automatically delete them . You have to use DELETE OBSOLETE Command to delete files that are no longer required to meet the retention policy .

If a quick recovery zone is configured , So when you need to prepare more recovery area space for new files , The database automatically deletes expired files or files that have been backed up to tape . Disk quota rules are different from retention policy rules , But the database will not violate the retention policy to delete files to meet the disk quota .

REPORT OBSOLETE or DELETE OBSOLETE Based on user-defined retention policies , That is, it does not need to be used for recovery to determine that the backup is expired . Only when RMAN When a cross check is performed and a file cannot be found , The backup is considered invalid (expired) Backup . In short , Be overdue (obsolete) Means that the file does not need , And it doesn't work (expired) Means it can't be found .

Backup retention policies only apply to full or level 0 Data file and control file backup . For data file copy and proxy copy , If RMAN Decide that a copy or proxy copy does not need , Then the copy or proxy copy can be deleted . For backup sets of data files ,RMAN You cannot delete a backup set until all data file backups in the backup set have expired .

Retention policies are not responsible for deleting or archiving redo Logs and levels 1 Incremental backup of is out of date . It is , When no full backup exists that requires them , These files become out of date . In addition to affecting the full or level 0 Data file and control file backup , Backup retention policies also affect archiving redo Logs and levels 1 Incremental backup of . First ,RMAN Decide which data and control file backups are out of date . then ,RMAN Archive logs and levels that are not needed to restore the oldest data files or control files that must be retained 1 Incremental backups of are considered expired .

notes : If the backup is not RMAN Technology deletion for ,RMAN Cannot execute automatic retention policy , for example , Tape retention policy via media manager . The media manager must never fail a tape until all... On the tape RMAN Backup directories that have been removed from the media manager (catalog) Delete in .

There are two mutually exclusive options when implementing a retention policy : Redundancy and recovery windows .


1. About the recovery window

The recovery window is a period of time that starts at the current time and extends back to the recoverable point . A recoverable point is a hypothetical point in time recovery (TIPR) The earliest time , This is the earliest point in time that a media failure can be recovered .

for example , If the execute recovery window is 1 Zhou , that RMAN Keep full backups and required incremental backups and archive logs , In this way, the database can be restored to the past 7 Days. . Implement the following retention policies :
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

This command ensures that for each data file , A backup that is older than the recoverable point in time is retained . for example , If the recovery window is 7, Then each data file must always have a backup that meets the following conditions :
SYSDATE - BACKUP CHECKPOINT TIME >= 7

All older backups than the most recent one that meets this condition are expired .

Suppose the retention policy is as shown in the following figure :

 Insert picture description here

Retention policies have the following aspects :
1) The recovery window is 7 God .
2) Database backup is scheduled every two weeks , On these dates :1 month 1 Japan ,1 month 15 Japan ,1 month 29 Japan ,2 month 12 Japan .
3) The database runs on ARCHIVELOG Pattern , If the retention policy requires , Archive logs are saved only on disk .

Such as Figure 8-4 Shown , The current time is 1 month 23 Japan , The recoverable time point is 1 month 16 Japan . therefore ,1 month 15 Daily backup needs to be used for recovery , from log Sequence 500 To 850 The same is true of archive logs for . stay 500 Previous logs and 1 month 1 The backup of day is expired , Because they do not need to be used to recover to the point in time within the window .

Suppose the same scenario lasts for a week , As shown in the figure below :

 Insert picture description here

In this scenario , The current time is 1 month 30 Japan , The recoverable time point is 1 month 23 Japan . Be careful 1 month 15 How can a backup of a day not expire even if it is a more recent backup (1 month 29 Japan ) Exists during the recovery window . This happens because the restore 1 month 29 Day backups do not allow you to recover to the earliest time in the window ,1 month 23 Japan . To ensure recoverability at any point in time during the window , Must keep 1 month 15 Day backup and slave sequence 500 To 1150 All archived logs for .


2. About backup redundancy

In some cases , Using recovery windows complicates disk space planning , Because the number of backups that must be retained is not constant , Depends on the backup schedule . contrary , The redundancy based retention policy specifies how many backups must be retained for each data file .

for example , Redundancy can be configured as 2, as follows :
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;

The default retention policy configuration is REDUNDANCY 1.


3. About batch deleting expired backups

Can run REPORT OBSOLETE The command determines which backups are currently expired based on the retention policy .

A pair of commands ,DELETE OBSOLETE Delete all files that are expired according to the retention policy . It can run on a regular basis DELETE OBSOLETE Command to minimize the waste of space for storing expired backups . for example , Can be run in weekly scripts DELETE OBOSOLETE.

It can also be done through REPORT or DELETE The order specifies REDUNDANCY or RECOVERY WINDOW Option to override the configured retention policy . Use DELETE OBSOLETE And the Restore window option, which is shorter than the configured Restore window, actually reduces the number of recoverable windows . for example , If the configured window is 14 God , But you do DELETE OBSOLETE RECOVERY WINDOW OF 7 DAYS, Then you no longer have the ability to recover to 7 Days and 14 Time point between days ago .


4. About backup retention policies and quick recovery zone deletion rules

If a quick recovery zone is configured , Then the database uses an internal algorithm to select files that are no longer needed in the fast recovery area to meet the configured retention policy .

When deciding which files to delete from the quick recovery area to meet the disk quota plan , Retention policies will never be violated . These states are OBSOLETE To meet the disk quota rules .

RMAN The state of OBSOLETE It is always determined by the retention policy . for example , If the database is backed up in RMAN In the warehouse is regarded as OBSOLETE, Then it is because it does not need to be used to recover to the point in time within the recovery window, or it is redundant .

In the fast recovery area OBSOLETE There is an important difference between the rule of status and the rule of disk quota meeting the deletion condition . Suppose the archive log is on disk , Required by the current recovery window , So it's not expired . If you back up these logs to tape , Then the retention policy regards these disk logs as necessary , That is, those that have not expired . However , The fast recovery area disk quota algorithm considers the logs on the disk as eligible for deletion , Because they have been backed up to tape . The logs on the disk are RMAN The status in the warehouse is not OBSOLETE, However, they meet the deletion conditions of the quick recovery area .


Refer to the following sections for more information on how to configure backup retention policies :
RMAN Configure backup retention policy (RETENTION POLICY)



source :《Oracle Database Backup and Recovery User’s Guide,19c》

原网站

版权声明
本文为[Count words and lines]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206090820549788.html