【11g】使用备份优化跳过文件(Using Backup Optimization to Skip Files)

Using Backup Optimization to Skip Files

正如在“备份优化和配置命令”中解释的,您可以运行CONFIGURE Backup Optimization命令来启用备份优化。当满足某些条件时,RMAN跳过与已经备份的文件相同的文件备份

For the following scenarios, assume that you configure backup optimization and a retention policy as shown in the following example.

Example 10-1 Configuring Backup Optimization

CONFIGURE DEFAULT DEVICE TYPE TO sbt;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 4 DAYS;

With RMAN configured as shown in Example 10-1, you run the following command every night to back up the database to tape:

BACKUP DATABASE;

由于已经配置了备份优化,只有在最近的备份是在恢复窗口的最早点上或之后进行的,RMAN才会跳过离线和只读数据文件的备份。当最近的备份比窗口更旧时,RMAN不会跳过备份。例如,只要恢复窗口中存在一个包含该文件的备份集,优化可以确保您不会每晚都对只读数据文件进行新的备份。

See Also:

  • "Backup Optimization for SBT Backups with Recovery Window Retention Policy" for a scenario involving backup optimization and recovery windows

  • Oracle Database Backup and Recovery Reference for a detailed description of criteria used by CONFIGURE BACKUP OPTIMIZATION to determine whether a file is identical and can potentially be skipped

Optimizing a Daily Archived Log Backup to a Single Tape: Scenario

Assume that you want to back up all the archived logs every night, but you do not want to have multiple copies of each log sequence number. With RMAN configured as shown in Example 10-1, you run the following command in a script nightly at 1 a.m.:

BACKUP DEVICE TYPE sbt 
  ARCHIVELOG ALL;

RMAN skips all logs except those produced in the last 24 hours. In this way, you keep only one copy of each archived log on tape.

Optimizing a Daily Archived Log Backup to Multiple Media Families: Scenario

In Oracle Secure Backup, a media family is a named group of volumes with a set of shared, user-defined attributes. In this scenario, you back up logs that are not on tape to one media family, then back up the same logs to a second media family. Finally, you delete old logs.

With RMAN configured as shown in Example 10-2, run the following script at the same time every night to back up the logs generated during the previous day to two separate media families.

Example 10-2 Backing Up Archived Redo Logs to Multiple Media Families

# The following command backs up just the logs that are not on tape. The 
# first copies are saved to the tapes from the media family "log_family1".
RUN
{
  ALLOCATE CHANNEL c1 DEVICE TYPE sbt
    PARMS 'ENV=(OB_MEDIA_FAMILY=log_family1)';
  BACKUP ARCHIVELOG ALL;
}
# Make one more copy of the archived logs and save them to tapes from a 
# different media family
RUN
{
  ALLOCATE CHANNEL c2 DEVICE TYPE sbt 
    PARMS 'ENV=(OB_MEDIA_FAMILY=log_family2)';
  BACKUP ARCHIVELOG
    NOT BACKED UP 2 TIMES;
}

如果您的目标是从备份了两次到SBT的磁盘中删除日志,那么实现该目标的最简单方法是使用存档的重做日志删除策略。以下一次性配置指定,如果磁带上存在两个存档日志备份,存档重做日志可以从磁盘删除:

CONFIGURE ARCHIVELOG DELETION POLICY 
  TO BACKED UP 2 TIMES TO DEVICE TYPE sbt;

After running the script in Example 10-2, you can delete unneeded logs by executing DELETE ARCHIVELOG ALL.

Creating a Weekly Secondary Backup of Archived Logs: Example

假设有一个更复杂的场景,其中您的目标是每天将归档日志备份到磁带上。但是,您担心磁带失败,所以您希望在执行每周从磁盘删除日志之前,确保在单独的磁带上有每个日志序列号的多个副本。此场景假定数据库没有使用快速恢复区域。

First, perform a one-time configuration as follows:

CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEVICE TYPE sbt PARALLELISM 1;
CONFIGURE default DEVICE TYPE TO sbt;
CONFIGURE CHANNEL DEVICE TYPE sbt PARMS 'ENV=(OB_MEDIA_FAMILY=first_copy);

因为您已经启用了优化功能,所以您可以每天晚上运行以下命令,将所有存档的日志备份到尚未备份的first_copymedia家族:

BACKUP ARCHIVELOG ALL TAG first_copy;

每周五晚上,您都要为不同媒体家族中的所有存档日志创建一个额外备份。在备份结束时,您希望删除磁带上至少有两个副本的所有存档日志。所以运行以下脚本:

RUN
{
  # manually allocate a channel, to specify that the backup run by this
  # channel should go to both media families "first_copy" and "second_copy"
  ALLOCATE CHANNEL c1 DEVICE TYPE sbt
      PARMS 'ENV=(OB_MEDIA_FAMILY=second_copy)';
  ALLOCATE CHANNEL c2 DEVICE TYPE sbt
      PARMS 'ENV=(OB_MEDIA_FAMILY=first_copy)';
  BACKUP 
    CHANNEL c1 
    ARCHIVELOG 
    UNTIL TIME 'SYSDATE' 
    NOT BACKED UP 2 TIMES # back up only logs without 2 backups on tape
    TAG SECOND_COPY; 
  BACKUP 
    CHANNEL c2 
    ARCHIVELOG 
    UNTIL TIME 'SYSDATE' 
    NOT BACKED UP 2 TIMES # back up only logs without 2 backups on tape
    TAG FIRST_COPY;
}

# now delete from disk all logs that have been backed up to tape at least twice
DELETE 
  ARCHIVELOG ALL
  BACKED UP 2 TIMES TO DEVICE TYPE sbt;

The following table explains the effects of the daily and weekly backup scripts.

Table 10-1 Effects of Daily and Weekly Scripts

Script Tape Contents After Script Disk Contents After Script

Daily

Archived logs that have not yet been backed up are now in media family first_copy.

All archived logs created since the last DELETE command are still on disk.

Weekly

Archived logs that have fewer than two backups on tape are now in media families first_copy and second_copy.

All archived logs that have been backed up at least twice to tape are deleted.

 

在每周备份之后,您可以将磁带从media family second_copy发送到离线存储。只有当池first_copy中的主磁带损坏时,才应该使用此磁带备份。由于备用磁带不在现场,您不希望RMAN将其用于恢复,因此可以将备份标记为不可用:

CHANGE BACKUP OF ARCHIVELOG TAG SECOND_COPY UNAVAILABLE;

See Also:

  • Chapter 12, "Maintaining RMAN Backups and Repository Records" to learn how to change the status of and delete backups

  • Oracle Database Backup and Recovery Reference to learn about the CHANGE and DELETE commands

你可能感兴趣的:(【11g】使用备份优化跳过文件(Using Backup Optimization to Skip Files))