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 ::=
{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 ::=
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 withALLOCATE 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 |
| | Governs archived redo log deletion policy for the flash recovery area. Possible settings are:
|
| Configures the auxiliary filename for the specified target datafile to If you are performing TSPITR or running the 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 When renaming files with the 笔者认为这个选项主要作用在利用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 |
Configures default backup options such as duplexing, optimization, excluding tablespaces, backup set sizes, and retention policies. | |
| 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. |
{ | Specifies the default algorithm to use for encryption, when writing encrypted backup sets. Possible values are listed in |
{ { | Specifies whether to use encryption for the database or specified tablespaces. With Configured settings for a tablespace always override configuration set at the database level. With With |
| Configures the snapshot control file filename to 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 See Also: Oracle Database Backup and Recovery Advanced User's Guide 责编只介绍了controlfile snapshot的配置,具体请查看笔者的另一篇文章。 |
backupConf
Syntax Element | Description |
| Specifies the number of copies of each backup set for Note: always writes one and only copy. Note: 注意,控制文件不会生成副本。如果在使用db_recovery_file_dest作为备份文件生成的路径情况下,生成备份文件的副本那么将产生ORA-19806错误。 示例: RMAN>show datafile backup copies; RMAN> backup tablespace users; 解决方式,将备份路径指定为非db_recovery_files_dest的目录 RMAN> backup tablespace users format '/home/oracle/%U.dbf'; |
| Toggles backup optimization 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 RMAN does not signal an error if optimization causes all files to be skipped during a backup. Note that Backup optimization is enabled when all of the following conditions are met:
The retention policy has an effect on which files backup optimization skips. 优化算法是要结合保留策略来进行判断是否备份的,详细的优化算法由于排版关系,笔者把他附在文章最后。 |
| Excludes the specified tablespace from You can still back up the configured tablespace by explicitly specifying it in a |
| Specifies the maximum size of each backup set created on a channel. By default Note: This option is ignored by |
| 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 For backups, the basic unit of the retention policy is a backup set (not a backup piece) or image copy. For example, |
| Resets the retention policy to its default ( |
| Specifies a time window in which RMAN should be able to recover the database. The window stretches from the current time ( |
| Specifies that RMAN should retain |
| 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 |
Archived redo log | Same thread, sequence number, and |
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 If RMAN skips backup only if at least n |
Archived log | By default, n RMAN skips backup only if at least n |
Backup set | By default, 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
withALL
orLIKE
options, orBACKUP
BACKUPSET
ALL.
- Only one type of channel is allocated, that is, you do not mix channels of type
DISK
andsbt
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 | | |
Tuesday | | The | |
Wednesday | | The | |
Thursday | | The | Tuesday backup |
Friday | | The | Tuesday backup |
Saturday | | The | Tuesday backup |
Sunday | | The Tuesday backup is deleted. | |
Monday | | The | 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
本文原创,转载请注明出处、作者
如有错误,欢迎指正