CONFIGURE

CONFIGURE {ARCHIVELOG DELETION POLICY {CLEAR | TO {APPLIED ON STANDBY | NONE }} | AUXNAME FOR DATAFILE datafileSpec {CLEAR | TO ' filename '} | backupConf | cfauConf | deviceConf | ENCRYPTION {ALGORITHM CLEAR | FOR {DATABASE | TABLESPACE tablespace_name } {ON | OFF | CLEAR } | ALGORITHM quoted_string } | SNAPSHOT CONTROLFILE NAME {CLEAR | TO ' filename '}}

​configure​​ ::=


Rman备份之configure语法详解1(原创)_hive



{ARCHIVELOG | DATAFILE } BACKUP COPIES FOR DEVICE TYPE [= ] deviceSpecifier {CLEAR | TO integer } | BACKUP OPTIMIZATION {CLEAR | OFF | ON } | EXCLUDE FOR TABLESPACE tablespace_name [CLEAR ] | MAXSETSIZE {CLEAR | TO {sizeSpec | UNLIMITED }} | RETENTION POLICY {CLEAR | TO {NONE | RECOVERY WINDOW OF integer DAYS | REDUNDANCY [= ] integer }}

​backupConf​​ ::=

Rman备份之configure语法详解1(原创)_数据库_02


To configure persistent settings affecting RMAN backup, restore, duplication, and maintenance jobs. These configurations are in effect for any RMAN session until the configuration is cleared or changed.

Use ​​CONFIGURE​​ to set the following:

  • An ongoing retention policy that automatically determines which backups and copies are eligible for deletion because they are no longer needed
  • The device type (for example,​​DISK​​ or ​​sbt​​ ) for RMAN jobs
  • The default number of channels of each device type that RMAN should allocate for automated backup and restore jobs
  • The settings for automatic channels for a specified device type
  • The maximum size of backup pieces and sets created on automatic channels
  • Backup optimization either​​ON​​ or ​​OFF​
  • The exclusion policy for tablespaces in whole database backups
  • The filename of the snapshot control file
  • Filenames for files in an auxiliary database
  • The control file autobackup feature to​​ON​​ or ​​OFF​
  • The default format for the control file autobackup output files

RMAN uses default settings for ​​CONFIGURE​​​ options. You can return to the default value for any ​​CONFIGURE​​​ command by running the same command with the ​​CLEAR​​ option.


See Also:


​Oracle Database Backup and Recovery Basics​

  • Execute this command at the RMAN prompt.​​CONFIGURE​​ cannot be used within a RUN block.
  • The target database must be mounted or open, because configuration settings are stored in the control file.
  • Channels allocated with​​ALLOCATE CHANNEL​​ override any configured automatic channels.
  • RMAN does not simultaneously allocate automatic channels for multiple device types in​​BACKUP​​ command.
  • To direct backups or restores to specific channels, use the RMAN-generated channel names. If you specify channel numbers in the​​CONFIGURE​​ ​​CHANNEL​​ command, then RMAN uses the same numbers in the system-generated channel names.
  • If you configure channels by using the nondefault​​CONNECT​​ or ​​PARMS​​ options to create backups or copies, then you must either use the same configured channels or manually allocate channels with the same options to restore or crosscheck these backups.
  • You cannot exclude the​​SYSTEM​​ tablespace from whole database backups.
  • The​​REDUNDANCY​​ and ​​RECOVERY​​ ​​WINDOW​​ options are mutually exclusive. Only one type of retention policy can be in effect at any time.
  • You cannot clear individual parameters when running​​CONFIGURE​​ ​​...​​ ​​CLEAR​​ . For example, you can run ​​CONFIGURE​​ ​​CHANNEL​​ ​​DEVICE​​ ​​TYPE​​ ​​sbt​​ ​​CLEAR​​ but not ​​CONFIGURE​​ ​​CHANNEL​​ ​​DEVICE​​ ​​TYPE​​ ​​sbt​​ ​​MAXPIECESIZE​​ ​​5M​​ ​​CLEAR​​ .
  • The channel number in a manually numbered channel must be less than 255.
  • You must specify at least one channel option when running​​CONFIGURE​​ ​​CHANNEL​​ . In other words, you cannot issue a command such as ​​CONFIGURE​​ ​​CHANNEL​​ ​​2​​ ​​DEVICE​​ ​​TYPE​​ ​​DISK​​ , but you can issue a command such as ​​CONFIGURE​​ ​​CHANNEL​​ ​​2​​ ​​DEVICE​​ ​​TYPE​​ ​​DISK​​ ​​MAXPIECESIZE​​ ​​2500K​​ .
  • The​​CONFIGURE​​ ​​CONTROLFILE​​ ​​AUTOBACKUP​​ ​​FORMAT​​ format string must include the %F substitution variable. It cannot contain any other substitution variable.
  • With Oracle Database Release 10g


Syntax Element

Description

​ARCHIVELOG​

​DELETION​​​ ​​POLICY​

​TO​​​ ( ​​APPLIED ON ​

​STANDBY​​​ | ​​NONE​

| ​​CLEAR​​ )

Governs archived redo log deletion policy for the flash recovery area. Possible settings are:

  • ​APPLIED ON STANDBY​​​ - enables flash recovery area to delete archivelogs that are applied on mandatory standby. See ​​Oracle Data Guard Concepts and Administration​
  • ​NONE​​ - enables flash recovery area to delete archivelogs that are backed up to tertiary device and that are obsolete based on the configured backup retention policy. This is the default configuration.
  • ​CLEAR​​​ - clears the deletion policy and returns the specified configuration to default value. The default value is ​​NONE​​ .
    从10g版本开始提供的配置选项,用来指定归档文件的删除策略。
    在默认情况下归档文件备份完之后就可以被删除,不过对于配置了Data Guard环境的数据库系统,Primary数据库端的归档文件就不能说删就删,因为归档文件不仅它自己要用,与其在相同Data Guard环境的Standby数据库也要用,从严谨的角度来考虑,DBA必须要保证归档文件在Standby端成功接收并且应用之前,Primary端 始终能保存该文件。在10g之前的版本,这一问题困扰了很多DBA,无奈之下不少人只能通过操作系统脚本的方式,在删除归档文件之前,首先对 Standby端数据库的归档文件应用状态作判断,直到确认一切OK才敢在Primary端执行正常删除。
    10g 之后的版本,Oracle在RMAN中内置增加了一项归档文件的删除策略,终于,DBA可以仅通过一项配置就解决该问题了。该策略对应两个值:
    APPLIED ON STANDBY :设置为该值时,当通过附加的 DELETE INPUT 子句删除Standby数据库仍需要的日志时,会提示RMAN-08137错误。不过用户仍然可以手动地通过 DELETE ARCHIVELOG 方式删除。
    NONE :设置为该值时,则不启用归档文件的删除策略。默认情况下就是NONE。

​AUXNAME​​​ ​​FOR​​​ ​​DATAFILE​​​ ​​datafileSpec​​​ ​​TO​​​ ​​'​​​ ​​filename​​​ ​​'​

Configures the auxiliary filename for the specified target datafile to ​​'​​​ ​​filename​​​ ​​'​​​ . For example, you can set the auxiliary name for datafile 2 to ​​/df2.f​​​ , and then unspecify this auxiliary name by running ​​CONFIGURE​​​ ​​AUXNAME​​​ ​​FOR​​​ ​​DATAFILE​​​ ​​2​​​ ​​CLEAR​​ .

If you are performing TSPITR or running the ​​DUPLICATE​​​ command, then by setting ​​AUXNAME​​ you can preconfigure the filenames for use on the auxiliary database without manually specifying the auxiliary filenames during the procedure.

For example, use this command during TSPITR if the datafiles are on raw disk and you need to restore auxiliary datafiles to raw disk for performance reasons. Typically, you set the ​​AUXNAME​​​ parameter in TSPITR for the datafiles of the ​​SYSTEM​​​ tablespace and the tablespaces containing rollback segments. Do not overlay files which are in use by the production database and can be discarded after TSPITR completes. In essence, the ​​AUXNAME​​ of a datafile is the location where TSPITR can create a temporary copy of it.

When renaming files with the ​​DUPLICATE​​​ command, ​​CONFIGURE​​​ ​​AUXNAME​​​ is an alternative to ​​SET​​​ ​​NEWNAME​​​ . The difference is that after you set the ​​AUXNAME​​​ the first time, you do not need to reset the filename when you issue another ​​DUPLICATE​​​ command: the ​​AUXNAME​​​ setting remains in effect until you issue ​​CONFIGURE​​​ ​​AUXNAME​​​ ​​...​​​ ​​CLEAR​​​ . In contrast, you must reissue the ​​SET​​​ ​​NEWNAME​​ command every time you rename files.

笔者认为这个选项主要作用在利用Rman复制数据库或者创建辅助实例时事先定义好目标数据文件的文件名。

See Also: ​​Oracle Database Backup and Recovery Advanced User's Guide​​​ to learn how to perform RMAN TSPITR, and ​​Oracle Database Backup and Recovery Advanced User's Guide​

​backupConf​

Configures default backup options such as duplexing, optimization, excluding tablespaces, backup set sizes, and retention policies.

​ENCRYPTION​

Used to specify encryption settings for the database or tablespaces within the database, which apply unless overridden using the ​​SET​​ command. Options specified for an individual tablespace take precedence over options specified for the whole database.

​ALGORITHM​

{ ​​algorithm_name​​ |

​CLEAR​​ }

Specifies the default algorithm to use for encryption, when writing encrypted backup sets. Possible values are listed in ​​V$RMAN_ENCRYPTION_ALGORITHMS​​​ . With ​​CLEAR​​​ , resets the database to the default algorithm, which is ​​AES128​​ .

​FOR​

{ ​​DATABASE​​ |

​TABLESPACE​

​tablespace_name​​ }

{ ​​ON​​​ | ​​OFF​​​ | ​​CLEAR​​ }

Specifies whether to use encryption for the database or specified tablespaces. With ​​FOR​​​ ​​DATABASE​​ , the effect is as follows:

​ON​​ enables encryption for all database files,

​OFF​​ turns off encryption for all database files

​CLEAR​​​ restores the default setting of ​​OFF​​ .

Configured settings for a tablespace always override configuration set at the database level. With ​​FOR​​​ ​​TABLESPACE​​​ ​​tablespace_name​​ , the effect is as follows:

​ON​​​ means encryption is on for that tablespace, unless ​​SET​​​ ​​ENCRYPTION​​​ ​​OFF​​​ ​​FOR​​​ ​​ALL​​​ ​​TABLESPACES​​ is used.

​OFF​​​ means encryption is off for that tablespace, unless ​​SET​​​ ​​ENCRYPTION​​​ ​​ON​​​ ​​FOR​​​ ​​ALL​​​ ​​TABLESPACES​​ is used.

​CLEAR​​ means that encryption for that tablespace is determined by the current default for the whole database.

With ​​ON​​​ , turns on encryption for the specified tablespaces or the whole database. With ​​OFF​​​ turns off encryption for the specified tablespaces or the whole database. With ​​CLEAR​​​ , returns the database or tablespaces to the default setting of ​​OFF​​ .

​SNAPSHOT​​​ ​​CONTROLFILE​​​ ​​NAME​​​ ​​[ TO​​​ ​​'​​​ ​​filename​​​ ​​' | CLEAR ]​

Configures the snapshot control file filename to ​​'​​​ ​​filename​​​ ​​'​​​ . If you run ​​CONFIGURE​​​ ​​SNAPSHOT​​​ ​​CONTROLFILE​​​ ​​NAME​​​ ​​CLEAR​​ , then RMAN sets the snapshot control file name to its default.

The default value for the snapshot control file name is platform-specific and dependent on the Oracle home. For example, the default on some UNIX system is ​​?/dbs/snapcf_@.f​​ . If you clear the control file name, and you change the Oracle home, then the default location of the snapshot control file changes as well.


See Also: ​​Oracle Database Backup and Recovery Advanced User's Guide​

责编只介绍了controlfile snapshot的配置,具体请查看笔者的另一篇文章。
​​​ http://czmmiao.iteye.com/blog/1225211​


backupConf

 


Syntax Element

Description

​{ARCHIVELOG | ​

​DATAFILE} ​

​BACKUP​​​ ​​COPIES​

​FOR​​​ ​​DEVICE TYPE​

​ [=]​​​ ​​deviceSpecifier​​​ ​​[CLEAR |TO​

​integer​​​ ​​]​



Specifies the number of copies of each backup set for ​​DATAFILE​​​ (both datafiles and control files) or ​​ARCHIVELOG​​​ files on the specified device type, from 1 (default) to 4. If duplexing is specified in the ​​BACKUP​​​ command or in a ​​SET​​​ ​​BACKUP​​​ ​​COPIES​​​ command, then the ​​CONFIGURE​​ setting is overridden.

Note:

always writes one and only copy.

Note:

注意,控制文件不会生成副本。如果在使用db_recovery_file_dest作为备份文件生成的路径情况下,生成备份文件的副本那么将产生ORA-19806错误。

示例:

RMAN>show datafile backup copies;
RMAN configuration parameters are:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;


RMAN> backup tablespace users;
Starting backup at 29-OCT-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=142 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/app/oracle/oradata/czmmiao/users01.dbf
channel ORA_DISK_1: starting piece 1 at 29-OCT-11
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 10/29/2011 17:35:31
ORA-19806: cannot make duplex backups in recovery area

解决方式,将备份路径指定为非db_recovery_files_dest的目录

RMAN> backup tablespace users format '/home/oracle/%U.dbf';
Starting backup at 29-OCT-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00004 name=/u01/app/oracle/oradata/czmmiao/users01.dbf
channel ORA_DISK_1: starting piece 1 at 29-OCT-11
channel ORA_DISK_1: finished piece 1 at 29-OCT-11 with 2 copies and tag TAG20111029T173658
piece handle=/home/oracle/19mqb5hr_1_1.dbf comment=NONE
piece handle=/home/oracle/19mqb5hr_1_2.dbf comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 29-OCT-11

​BACKUP​

​OPTIMIZATION ​

​[CLEAR | OFF | ON​

​ ]​

Toggles backup optimization ​​ON​​​ or ​​OFF​​​ (default). Specify ​​CLEAR​​​ to return optimization to its default value of ​​OFF​​ .

Optimization does not back up a file to a device type if the identical file is already backed up on the device type. For two files to be identical, their content must be exactly the same. You can override backup optimization by using the ​​FORCE​​​ option of the ​​BACKUP​​ command.

RMAN does not signal an error if optimization causes all files to be skipped during a backup. Note that ​​BACKUP​​​ ​​...​​​ ​​DELETE​​​ ​​INPUT​​ deletes all specified files whether or not optimization would skip these files during a backup.

Backup optimization is enabled when all of the following conditions are met:

  • The​​CONFIGURE​​​​BACKUP​​​​OPTIMIZATION​​​​ON​​ command has been run.
  • You run​​BACKUP​​​​DATABASE​​​ ,​​BACKUP​​​​ARCHIVELOG​​​ with​​ALL​​​ or​​LIKE​​​ options, or​​BACKUP​​​​BACKUPSET​​​​ALL​​ .
  • The RMAN job uses a channel of only one device type.分配的通道仅使用了一种设备类型,也就是没有同时分配使用sbt与disk的多个通道。
    备份的优化选项可以避免对数据没有进变的表空间进行备份,也可以不重复备份已备份过的归档日志文件。当显示的指定需要备份的文件时,将会进行该文件的备份而忽略备份优化选项。

The retention policy has an effect on which files backup optimization skips.

优化算法是要结合保留策略来进行判断是否备份的,详细的优化算法由于排版关系,笔者把他附在文章最后。


​EXCLUDE​​​ ​​FOR​​​ ​​TABLESPACE​​​ ​​tablespace_name​​​ ​​[ CLEAR ]​

Excludes the specified tablespace from ​​BACKUP​​​ ​​DATABASE​​​ commands. Note that you cannot exclude the ​​SYSTEM​​​ tablespace. By default, each tablespace is not excluded, that is, the exclude functionality is disabled. The exclusion is stored as an attribute of the tablespace, not the individual datafiles, so the exclusion applies to any files that are added to this tablespace in the future. If you run ​​CONFIGURE​​​ ​​...​​​ ​​CLEAR​​ on a tablespace after excluding it, then it returns to the default configuration of "not excluded."

You can still back up the configured tablespace by explicitly specifying it in a ​​BACKUP​​​ command or by specifying the ​​NOEXCLUDE​​​ option on a ​​BACKUP​​​ ​​DATABASE​​ command.

​MAXSETSIZE [ ​

​CLEAR | TO [ ​

​sizeSpec | ​

​UNLIMITED ]​

Specifies the maximum size of each backup set created on a channel. By default ​​MAXSETSIZE​​​ is set to ​​UNLIMITED​​ , meaning that it is disabled.

Note: This option is ignored by ​​BACKUP​​​ ​​AS​​​ ​​COPY​​ .

​RETENTION​

​POLICY​


Specifies a persistent, ongoing policy for datafile and control file backups and copies that RMAN marks as obsolete, that is, not needed and eligible for deletion. As time passes, RMAN marks backups and copies as obsolete according to the criteria you specify in the retention policy. RMAN does not automatically delete any backups or copies: manually run the ​​DELETE​​​ ​​OBSOLETE​​​ command to remove obsolete files. By default, ​​RETENTION​​​ ​​POLICY​​​ is configured to ​​REDUNDANCY​​​ ​​1​​ .

For backups, the basic unit of the retention policy is a backup set (not a backup piece) or image copy. For example, ​​BACKUP​​​ ​​AS​​​ ​​BACKUPSET​​​ ​​COPIES​​​ ​​4​​​ ​​TABLESPACE​​​ ​​users​​ generates a single backup set that is duplexed into four identical backup pieces. The retention policy considers this as one

​CLEAR​

Resets the retention policy to its default (​​REDUNDANCY​​​ ​​=​​​ ​​1​​ ).

​TO RECOVERY​

​WINDOW​​​ ​​OF​

​integer​​​ ​​DAYS​


Specifies a time window in which RMAN should be able to recover the database. The window stretches from the current time (​​SYSDATE​​​ ) to the point of recoverability , which is the earliest date to which you want to recover. The point of recoverability is ​​SYSDATE​​​ - ​​integer​​ days in the past.

​TO REDUNDANCY​

​integer​

Specifies that RMAN should retain ​​integer​​​ backups or copies of each datafile and control file. If more than ​​integer​​​ backups or copies exist, RMAN marks these extra files as obsolete. Then, RMAN determines the oldest of the retained backups and copies, and marks all archived logs and log backups older than this backup or copy as obsolete. The ​​DELETE​​​ ​​OBSOLETE​​ command removes obsolete backups and copies as well as archived log backups and copies.

​TO NONE​

Disables the retention policy feature. RMAN does not consider any backups or copies as obsolete.






Examples

Configuring Backup Optimization: Example  This example configures RMAN so that the ​​BACKUP​​​ command does not back up files to a device type if the identical file has already been backed up to the device type:
CONFIGURE BACKUP OPTIMIZATION ON;

Configuring a Retention Policy: Example  This example configures a retention policy with a recovery window of 2 weeks, and then resets the retention policy to its default value of ​​REDUNDANCY​​​ ​​=​​​ ​​1​​​ :
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
CONFIGURE RETENTION POLICY CLEAR;


Configuring the Snapshot Control File Location: Example  This example configures a new location for the snapshot control file and then resynchronizes the recovery catalog.
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '?/oradata/snap.cf';

Excluding a Tablespace from a Whole Database Backup: Example  This example excludes the ​​example​​​ tablespace from whole database backups, then returns the tablespace to its default value of "not excluded":
CONFIGURE EXCLUDE FOR TABLESPACE example;
CONFIGURE EXCLUDE CLEAR;

 

Specifying Auxiliary Filenames: Example  This example duplicates a database to a remote host with a different directory structure, by using ​​CONFIGURE​​​ ​​AUXNAME​​​ to specify new filenames for the datafiles:
# set auxiliary names for the datafiles
CONFIGURE AUXNAME FOR DATAFILE 1 TO '/oracle/auxfiles/aux_1.f';
CONFIGURE AUXNAME FOR DATAFILE 2 TO '/oracle/auxfiles/aux_2.f';
CONFIGURE AUXNAME FOR DATAFILE 3 TO '/oracle/auxfiles/aux_3.f';
CONFIGURE AUXNAME FOR DATAFILE 4 TO '/oracle/auxfiles/aux_4.f';

RUN

  ALLOCATE AUXILIARY CHANNEL dupdb1 TYPE DISK;
  DUPLICATE TARGET DATABASE TO dupdb
  LOGFILE
    GROUP 1 ('?/dbs/dupdb_log_1_1.f',
             '?/dbs/dupdb_log_1_2.f') SIZE 200K,
    GROUP 2 ('?/dbs/dupdb_log_2_1.f',
             '?/dbs/dupdb_log_2_2.f') SIZE 200K REUSE;
}
# Un-specify the auxiliary names for the datafiles so that they are not overwritten
# by mistake:
CONFIGURE AUXNAME FOR DATAFILE 1 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 2 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 3 CLEAR;
CONFIGURE AUXNAME FOR DATAFILE 4 CLEAR;

 

Backup Optimization

If you enable backup optimization, then the ​​BACKUP​​ command skips backing up files when the identical file has already been backed up to the specified device type.


Rules for Identifying Identical Files for Backup Optimization

​Table 2-2​​ describes criteria that RMAN uses to determine whether a file is identical to a file that it already backed up.


Type of File

Criteria to Determine an Identical File

Datafile

The datafile must have the same DBID, checkpoint SCN, creation SCN, and ​​RESETLOGS​​ SCN and time as a datafile already in a backup. The datafile must be offline-normal, read-only, or closed normally.

Archived redo log

Same thread, sequence number, and ​​RESETLOGS​​ SCN and time.

Backup set

Same backup set recid and stamp.



If RMAN determines that a file is identical and it has already been backed up, then it is a candidate to be skipped. However, RMAN must do further checking to determine whether to skip the file, because both the retention policy and the backup duplexing feature are factors in the algorithm that determines whether RMAN has sufficient backups on the specified device type.



Backup Optimization Algorithm

​Table 2-3​​​ describes the algorithm that backup optimization uses when determining whether to skip the backup of an identical file.
Table 2-3 Backup Optimization Algorithm


For an Identical ...

Backup Optimization Algorithm

Datafile

With a recovery window-based retention policy:

For backups to tape, RMAN takes another backup of a file, even if a backup of an identical file exists, if the most recent backup is older than the configured recovery window. This is done to allow media to be recycled after the media expires.

For backups to disk, RMAN skips taking the backup if an identical file is available from a backup on disk, even if that backup is older than the beginning of the recovery window. The retention policy causes RMAN to retain the old backup for as long as it is needed.

With a redundancy-based retention policy:

RMAN sets r ​​=1​​ by default and searches for values of n



If ​​CONFIGURE​​​ ​​RETENTION​​​ ​​POLICY​​​ ​​TO​​​ ​​REDUNDANCY​​​ ​​r​​​ is enabled, then RMAN only skips datafiles when ​​n​​​ =​​r​​ +1 backups exist.


​BACKUP​​​ ​​...​​​ ​​COPIES​​​ ​​n​


​SET​​​ ​​BACKUP​​​ ​​COPIES​​​ ​​n​


​CONFIGURE​​​ ​​DATAFILE​​​ ​​BACKUP​​​ ​​COPIES​​​ ​​FOR​​​ ​​DEVICE​​​ ​​TYPE​​​ ​​...​​​ ​​TO​​​ ​​n​



RMAN skips backup only if at least n

Archived log

By default, n ​​=1​​ . RMAN searches for values of n



​BACKUP​​​ ​​...​​​ ​​COPIES​​​ ​​n​


​SET​​​ ​​BACKUP​​​ ​​COPIES​​​ ​​n​


​CONFIGURE​​​ ​​ARCHIVELOG​​​ ​​BACKUP​​​ ​​COPIES​​​ ​​FOR​​​ ​​DEVICE​​​ ​​TYPE​​​ ​​...​​​ ​​TO​​​ ​​n​



RMAN skips backup only if at least n

Backup set

By default, n ​​=1​​ . RMAN searches for other values of n



​BACKUP​​​ ​​...​​​ ​​COPIES​​​ ​​n​


​SET​​​ ​​BACKUP​​​ ​​COPIES​​​ ​​n​



RMAN skips backup only if at least n


For example, assume that at 9 a.m. you back up three copies of all existing archived logs to tape:
BACKUP DEVICE TYPE sbt COPIES 3 ARCHIVELOG ALL;

Later, you enable the following configuration setting in preparation for another backup:
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE sbt TO 4;
CONFIGURE BACKUP OPTIMIZATION ON;

Then, you run the following archived log backup at noon:
BACKUP DEVICE TYPE sbt COPIES 2 ARCHIVELOG ALL;



In this case, the ​​BACKUP​​​ ​​...​​​ ​​COPIES​​​ setting overrides the ​​CONFIGURE​​​ ​​...​​​ ​​COPIES​​​ setting, so RMAN sets ​​n​​​ ​​=2​​​ . RMAN skips the backup of a log only if at least two copies of the log exist on the ​​sbt​​​ device. Because three copies of each log exist on ​​sbt​​ of all the logs generated before 9 a.m., RMAN skips the backups of these logs. However, RMAN backs up two copies of all logs generated after 9 a.m. because these logs have not yet been backed up to tape.

At this point, three copies of the logs created before 9 a.m. exist on tape, and two copies of the logs created after 9 a.m. exist on tape. Assume that you run the following backup at 3 p.m.:
RUN
{
  SET BACKUP COPIES 3;
  BACKUP DEVICE TYPE sbt ARCHIVELOG ALL;
}



In this case, RMAN sets ​​n​​​ ​​=3​​ and so will not back up the logs created before 9 a.m. because three copies already exist on tape. However, only two copies of the logs created after 9 a.m. exist on tape, so RMAN does not optimize backups of these logs. Hence, RMAN backs up three copies of the logs created after 9 a.m.



Requirements for Backup Optimization

  • The​​CONFIGURE​​​​BACKUP​​​​OPTIMIZATION​​​​ON​​ command has been run to enable backup optimization.
  • You run​​BACKUP​​​​DATABASE​​​ ,​​BACKUP​​​​ARCHIVELOG​​​ with​​ALL​​​ or​​LIKE​​​ options, or​​BACKUP​​​​BACKUPSET​​​​ALL.​
  • Only one type of channel is allocated, that is, you do not mix channels of type​​DISK​​​ and​​sbt​​ in the same backup command.

For example, assume that you run these commands:
BACKUP DEVICE TYPE sbt DATABASE PLUS ARCHIVELOG;
BACKUP DEVICE TYPE sbt BACKUPSET ALL;



If none of these files has changed since the last backup, then RMAN does not back up the files again, nor signal an error if it skips all files specified in the command.



Overriding and Disabling Backup Optimization

To override backup optimization and back up all files whether or not they have changed, specify the ​​FORCE​​​ option on the ​​BACKUP​​​ command. For example:
BACKUP DEVICE TYPE sbt BACKUPSET ALL FORCE;



To disable backup optimization on a persistent basis, use the following command:
RMAN> CONFIGURE BACKUP OPTIMIZATION OFF;



Effect of Retention Policies on Backup Optimization for SBT Backups

Backup optimization is not always applied when backing up to SBT devices. The exceptions to normal backup optimization behavior for recovery window-based and redundancy-based retention policies are described in the following sections.


Note:

Use caution when enabling backup optimization if you use a media manager with its own internal expiration policy. Run ​​CROSSCHECK​​ periodically to synchronize the RMAN repository with the media manager. Otherwise, RMAN may skip backups due to optimization without recognizing that the media manager has discarded backups stored on tape.

Backup Optimization for SBT Backups with Recovery Window Retention Policy

  • Today is February 21.
  • The recovery window is 7 days.
  • The most recent backup of tablespace​​tools​​ to tape is January 3.
  • Tablespace​​tools​​ is read-only.

On February 21, when you issue a command to back up tablespace ​​tools​​ to tape, RMAN backs it up even though it did not change after the January 3 backup (because it is read-only). RMAN makes the backup because no backup of the tablespace exists within the 7-day recovery window.

This behavior allows the media manager to expire old tapes. Otherwise, the media manager would be forced to keep the January 3 backup of tablespace ​​tools​​​ indefinitely. By making a more recent backup of tablespace ​​tools​​ on February 21, RMAN allows the media manager to expire the tape containing the obsolete January 3 backup.


Backup Optimization for SBT Backups With Redundancy Retention Policy

Assume that you configure a retention policy for redundancy. In this case, RMAN only skips backups of offline or read-only datafiles to SBT when there are ​​r​​​ + 1 backups of the files, where ​​r​​​ is set in ​​CONFIGURE​​​ ​​RETENTION​​​ ​​POLICY​​​ ​​TO​​​ ​​REDUNDANCY​​​ ​​r​​ .

For example, assume that you enable backup optimization and set the following retention policy:
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;



With these settings, RMAN only skips backups when three identical files are already backed up. Also assume that you have never backed up the ​​users​​​ tablespace, which is read/write, and that you perform the actions described in ​​Table 2-4​​ over the course of the week.


Table 2-4 Effect of Redundancy Setting on Backup Optimization

Day

Action

Result

Redundant Backup

Monday

Take tablespace ​​users​​ offline normal.

 

 

Tuesday

​BACKUP​​​ ​​DATABASE​

The ​​users​​ tablespace is backed up.

 

Wednesday

​BACKUP​​​ ​​DATABASE​

The ​​users​​ tablespace is backed up.

 

Thursday

​BACKUP​​​ ​​DATABASE​

The ​​users​​ tablespace is backed up.

Tuesday backup

Friday

​BACKUP​​​ ​​DATABASE​

The ​​users​​ tablespace is not

Tuesday backup

Saturday

​BACKUP​​​ ​​DATABASE​

The ​​users​​ tablespace is not

Tuesday backup

Sunday

​DELETE​​​ ​​OBSOLETE​

The Tuesday backup is deleted.

 

Monday

​BACKUP​​​ ​​DATABASE​

The ​​users​​ tablespace is backed up.

Wednesday backup



The backups on Tuesday, Wednesday, and Thursday back up the offline ​​users​​​ tablespace to satisfy the condition that three backups must exist (one more than redundancy setting). The Friday and Saturday backups do not back up the ​​users​​​ tablespace because of backup optimization. Note that the Tuesday backup of ​​users​​ is obsolete beginning on Thursday.



On Sunday, you delete all obsolete backups, which removes the Tuesday backup of ​​users​​​ . The Tuesday backup is obsolete because of the retention policy setting. The whole database backup on Monday then backs up the ​​users​​ tablespace to satisfy the condition that three backups must exist (one more than redundancy setting). In this way, you can recycle your tapes over time.


参考至:http://download.oracle.com/docs/cd/B19306_01/backup.102/b14194/rcmsynta015.htm


​             http://download.oracle.com/docs/cd/B19306_01/backup.102/b14191/rcmconc1.htm#BRADV113​

​             https://forums.oracle.com/forums/thread.jspa?threadID=942113​

​             http://www.ochef.net/2009/08/configure-backup-optimization.html​

​             http://www.itpub.net/thread-973238-1-1.html​

​             http://space.itpub.net/12020513/viewspace-614475​

​             http://www.itpub.net/thread-1081369-1-1.html​

​             http://space.itpub.net/7607759/viewspace-628518​

本文原创,转载请注明出处、作者

如有错误,欢迎指正