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,
or DISK
) for RMAN jobssbt
- 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
or ON
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
or ON
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.
cannot be used within a RUN block.CONFIGURE
- 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
command.BACKUP
- To direct backups or restores to specific channels, use the RMAN-generated channel names. If you specify channel numbers in the
CONFIGURE
command, then RMAN uses the same numbers in the system-generated channel names.CHANNEL
- If you configure channels by using the nondefault
or CONNECT
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.PARMS
- You cannot exclude the
tablespace from whole database backups.SYSTEM
- The
and REDUNDANCY
RECOVERY
options are mutually exclusive. Only one type of retention policy can be in effect at any time.WINDOW
- You cannot clear individual parameters when running
CONFIGURE
...
. For example, you can run CLEAR
CONFIGURE
CHANNEL
DEVICE
TYPE
sbt
but not CLEAR
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
. In other words, you cannot issue a command such as CHANNEL
CONFIGURE
CHANNEL
2
DEVICE
TYPE
, but you can issue a command such as DISK
CONFIGURE
CHANNEL
2
DEVICE
TYPE
DISK
MAXPIECESIZE
.2500K
- The
CONFIGURE
CONTROLFILE
AUTOBACKUP
format string must include the %F substitution variable. It cannot contain any other substitution variable.FORMAT
- With Oracle Database Release 10g
Syntax Element | Description |
( | | ) | Governs archived redo log deletion policy for the flash recovery area. Possible settings are:
|
datafileSpec | Configures the auxiliary filename for the specified target datafile to . For example, you can set the auxiliary name for datafile 2 to , and then unspecify this auxiliary name by running . If you are performing TSPITR or running the command, then by setting 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 parameter in TSPITR for the datafiles of the 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 of a datafile is the location where TSPITR can create a temporary copy of it. When renaming files with the command, is an alternative to . The difference is that after you set the the first time, you do not need to reset the filename when you issue another command: the setting remains in effect until you issue . In contrast, you must reissue the 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. |
| 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 . With , resets the database to the default algorithm, which is . |
{ | } { | | } | Specifies whether to use encryption for the database or specified tablespaces. With , the effect is as follows: enables encryption for all database files, turns off encryption for all database files restores the default setting of . Configured settings for a tablespace always override configuration set at the database level. With , the effect is as follows: means encryption is on for that tablespace, unless is used. means encryption is off for that tablespace, unless is used. means that encryption for that tablespace is determined by the current default for the whole database. With , turns on encryption for the specified tablespaces or the whole database. With turns off encryption for the specified tablespaces or the whole database. With , returns the database or tablespaces to the default setting of . |
| Configures the snapshot control file filename to . If you run , 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 . 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 |
deviceSpecifier | Specifies the number of copies of each backup set for (both datafiles and control files) or files on the specified device type, from 1 (default) to 4. If duplexing is specified in the BACKUP command or in a SET command, then the 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 |
| Toggles backup optimization or (default). Specify to return optimization to its default value of . 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 option of the command. RMAN does not signal an error if optimization causes all files to be skipped during a backup. Note that 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 retention policy has an effect on which files backup optimization skips. 優化算法是要結合保留政策來進行判斷是否備份的,詳細的優化算法由于排版關系,筆者把他附在文章最後。 |
| Excludes the specified tablespace from commands. Note that you cannot exclude the 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 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 command or by specifying the option on a command. |
| Specifies the maximum size of each backup set created on a channel. By default is set to , meaning that it is disabled. 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 command to remove obsolete files. By default, is configured to . For backups, the basic unit of the retention policy is a backup set (not a backup piece) or image copy. For example, generates a single backup set that is duplexed into four identical backup pieces. The retention policy considers this as one |
| 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 ( ) to the point of recoverability , which is the earliest date to which you want to recover. The point of recoverability is - days in the past. |
| Specifies that RMAN should retain backups or copies of each datafile and control file. If more than 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 command removes obsolete backups and copies as well as archived log backups and copies. |
| 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 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 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 by default and searches for values of n If is enabled, then RMAN only skips datafiles when = +1 backups exist. RMAN skips backup only if at least n |
Archived log | By default, n . RMAN searches for values of n RMAN skips backup only if at least n |
Backup set | By default, n . RMAN searches for other values of 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
command has been run to enable backup optimization.ON
- You run
BACKUP
,DATABASE
BACKUP
withARCHIVELOG
orALL
options, orLIKE
BACKUP
BACKUPSET
ALL.
- Only one type of channel is allocated, that is, you do not mix channels of type
andDISK
in the same backup command.sbt
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
to tape is January 3.tools
- Tablespace
is read-only.tools
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 offline normal. | ||
Tuesday | | The tablespace is backed up. | |
Wednesday | | The tablespace is backed up. | |
Thursday | | The tablespace is backed up. | Tuesday backup |
Friday | | The tablespace is not | Tuesday backup |
Saturday | | The tablespace is not | Tuesday backup |
Sunday | | The Tuesday backup is deleted. | |
Monday | | The 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