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

CONFIGURE

Syntax

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 ::=

Description of configure.gif follows


cfauConf ::=

CONTROLFILE AUTOBACKUP {CLEAR | FORMAT FOR DEVICE TYPE [= ] deviceSpecifier {CLEAR | TO formatSpec } | OFF | ON }

Description of cfauconf.gif follows

deviceConf ::=

[AUXILIARY ] CHANNEL [integer ] DEVICE TYPE [= ] deviceSpecifier {allocOperandList | CLEAR } | DEFAULT DEVICE TYPE {CLEAR | TO deviceSpecifier } | DEVICE TYPE [= ] deviceSpecifier {CLEAR | {BACKUP TYPE TO {[COMPRESSED ] BACKUPSET | COPY } | PARALLELISM integer } [ {BACKUP TYPE TO {[COMPRESSED ] BACKUPSET | COPY } | PARALLELISM integer }]...}

Description of deviceconf.gif follows


cfauConf

Syntax Element Description
CONTROLFILE AUTOBACKUP Controls the control file autobackup feature. By default, this feature is not enabled.
CLEAR Returns the feature to its default setting of OFF .
FORMAT FOR DEVICE TYPE deviceSpecifier [ CLEAR | TO formatSpec ] Configures the default filename format for the control file autobackup on the specified device type. If a flash recovery area is enabled, then RMAN creates the disk autobackup in the flash recovery area. Otherwise, RMAN creates it in an operating system specific location (?/dbs on Unix and Windows).

By default, the initial format is %F for all devices. Any default format string specified with CONFIGURE must include the %F substitution variable.

%F is the only legal substitution variable for use in a control file autobackup format. Use of any other substitution variable is an error.

Specify CLEAR to return the format to the default %F .

The formatSpec can specify an Automatic Storage Management disk group. The following example configures a channel for an ASM disk group:

CONFIGURE CONTROLFILE AUTOBACKUP FOR DEVICE TYPE DISK TO '+dgroup1';

本文末尾附deviceSpecifier和formatSpec

OFF Disables the autobackup feature. (OFF is the default value.) When this command is OFF , any BACKUP command that includes datafile 1 (including BACKUP DATABASE ) automatically includes the current control file and server parameter file in the backup set. Otherwise, RMAN does not include these files.
ON If CONFIGURE CONTROLFILE AUTOBACKUP is ON (by default it is OFF ), then RMAN performs a control file autobackup in the following circumstances:
  • After every BACKUP or CREATE CATALOG command issued at the RMAN prompt.

  • Whenever a BACKUP command within a RUN block is followed by a command that is not BACKUP .

  • At the end of every RUN block if the last command in the block was BACKUP .

  • After database structural changes such as adding a new tablespace, altering the state of a tablespace or datafile (for example, bringing it online), adding a new online redo log, renaming a file, adding a new redo thread, and so forth. This type of autobackup, unlike autobackups that occur in the preceding circumstances, goes only to disk. You can run CONFIGURE CONTROLFILE AUTOBACKUP FOR DEVICE TYPE DISK to set a nondefault disk location.

The first channel allocated during the backup or copy job creates the autobackup and places it into its own backup set; for post-structural autobackups, the default disk channel makes the backup. RMAN writes the control file and the server parameter file to the same backup piece. After the control file autobackup completes, the database writes a message containing the complete path of the backup piece and the device type to the alert log.

The default location for the autobackup on disk is the flash recovery area (if configured) or a platform-specific location (if not configured). RMAN automatically backs up the current control file using the default format of %F (refer to entry for CONFIGURE CONTROLFILE AUTOBACKUP FORMAT for an explanation of this substitution variable). You can change the location and filename format with the CONFIGURE CONTROLFILE AUTOBACKUP FORMAT and SET CONTROLFILE AUTOBACKUP FORMAT commands.


deviceConf

 

Syntax Element Description
[AUXILIARY] CHANNEL [ integer ] DEVICE TYPE deviceSpecifier Specifies the standard or AUXILIARY channel that you are configuring or clearing, as well as the device type (DISK or sbt ) of the channel. Either configure a generic channel or specify a channel number, where integer is less than 255 .

If you configure a generic channel (that is, if you do not specify a channel number), then RMAN uses the generic settings for every parallelized channel except any channel number that you have explicitly configured. A generic channel setting specifies options for all channels not configured explicitly.

For generic channels of a specified device type, a new command erases previous settings for this device type. Assume that you run these commands:

CONFIGURE CHANNEL DEVICE TYPE sbt MAXPIECESIZE 1G;
CONFIGURE CHANNEL DEVICE TYPE sbt FORMAT 'bkup_%U';

The second command erases the MAXPIECESIZE setting of the first command.

If AUXILIARY is specified, then this configuration is used only for channels allocated at the auxiliary instance. Specify configuration information for auxiliary channels if they require different parameters from the channels allocated at the target instance. If no auxiliary device configuration is specified, then RMAN configures any auxiliary channels using the target database device configuration.

allocOperandList Specifies control options for the allocated channel. Note that the FORMAT parameter can specify an Automatic Storage Management disk group. The following example configures a channel for an ASM disk group:
CLEAR Clears the specified channel. For example, CONFIGURE CHANNEL 1 DEVICE TYPE DISK CLEAR returns only channel 1 to its default, whereas CONFIGURE CHANNEL DEVICE TYPE DISK CLEAR returns the generic disk channel to its default. Note that you cannot specify any other channel options (for example, PARMS ) when you specify CLEAR .
DEFAULT DEVICE TYPE [ TO deviceSpecifier | CLEAR ] Specifies the default device type for automatic channels. By default, DISK is the default device type. CLEAR returns the default device type to DISK .

By default, the BACKUP command only allocates channels of the default device type. For example, if you configure automatic channels for DISK and sbt and set the default device type to DISK , then RMAN only allocates disk channels when you run the BACKUP DATABASE command. You can override this behavior either by manually allocating channels in a RUN command, or by specifying DEVICE TYPE on the BACKUP command itself.

The RESTORE command allocates automatic channels of all configured device types, regardless of the default device type. The RESTORE command obeys the PARALLELISM setting for each configured device type.

DEVICE TYPE [ = ] deviceSpecifier Specifies the device type (disk or sbt) to which to apply the settings specified in this CONFIGURE command.
CLEAR Resets backup type and parallelism settings for this device to their defaults..
BACKUP TYPE TO [ COPY | [ COMPRESSED ] BACKUPSET] Configures the default backup type for disk or tape backups to either BACKUPSET, COMPRESSED BACKUPSET or COPY .

For sbt devices the COPY option is not supported.

The default for DISK is BACKUPSET .

If the backup type is set to BACKUPSET , the BACKUP command always produces backup sets regardless of which media the backup is produced on. With the COMPRESSED option, the backupsets produced will use binary compression.

The default location for disk backups is the flash recovery area, if one is configured; otherwise, backups are stored in a platform-specific location (for Unix and Windows, this is $ORACLE_HOME/dbs ). The default format for backup filenames is %U .

PARALLELISM integer Configures the device types that are eligible for use in jobs that use automatic channels and sets the degree of channel parallelism (DISK is the default).

The PARALLELISM parameter sets the number of automatic channels of the specified device type allocated for RMAN jobs. RMAN always allocates the number of channels set by PARALLELISM , although it may use only a subset of these channels.

By default, PARALLELISM = 1 . Specifying CLEAR for a device type resets its settings to the default. For example, you can set PARALLELISM for disk backups to 3 . If you configure automatic channels of type disk and tape, and set the default device type as disk, then RMAN allocates three disk channels when you run BACKUP DATABASE at the RMAN prompt.

To change the parallelism for a device type to n , run a new CONFIGURE DEVICE TYPE ... PARALLELISM n command. For example, you can change configure PARALLELISM to 3 for sbt and then change it to 2 as follows:

CONFIGURE DEVICE TYPE sbt PARALLELISM 3;
CONFIGURE DEVICE TYPE sbt PARALLELISM 2;

Note: If you configure n manually numbered channels, the PARALLELISM setting can be greater than or less than n . For example, you can manually number 10 automatic channels and configure PARALLELISM to 2 or 12 .

Examples
Configuring Automatic Disk and Tape Channels: Example  This example configures generic DISK and sbt channels, sets the default device type to sbt , and sets PARALLELISM to 3 :

CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/?/%U';
CONFIGURE CHANNEL DEVICE TYPE sbt PARMS 'ENV=(NSR_SERVER=bksrv1)';
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
CONFIGURE DEVICE TYPE sbt PARALLELISM 3;






Overriding the Default Device Type: Example  This example configures the default device type to sbt , backs up the archived logs on the default sbt channel, and then backs up the database to disk on the default disk channel:

CONFIGURE CHANNEL DEVICE TYPE sbt PARMS 'ENV=(NSR_SERVER=bksrv1)';
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
BACKUP ARCHIVELOG ALL;
BACKUP DEVICE TYPE DISK DATABASE;

PARMS = ' channel_parms ' Specifies parameters for the device to allocate. Do not use this port-specific string if you have specified DEVICE TYPE DISK .

'ENV=( var1 = val1 , var2 = val2 ,...)'

Specifies one or more environment variables required by the media management vendor in the server session corresponding to this RMAN client. Because RMAN is a client program, the ENV parameter can be used to set server session specific variables that perform backup and restore operations on behalf of the RMAN client. For example:

PARMS="ENV=(TAPE_SERVER=srv1)"

Configuring Automatic Channels Across File Systems: Example  This example configures automatic disk channels across three file systems:
CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/disk1/backup/%U';
CONFIGURE CHANNEL 2 DEVICE TYPE DISK FORMAT '/disk2/backup/%U';
CONFIGURE CHANNEL 3 DEVICE TYPE DISK FORMAT '/disk3/backup/%U';
BACKUP DEVICE TYPE DISK DATABASE PLUS ARCHIVELOG;

Configuring Automatic Channels in an Oracle Real Application Clusters Configuration: Example  This example allocates automatic sbt channels for two nodes of an Oracle Real Application Clusters database:

CONFIGURE DEVICE TYPE sbt PARALLELISM 2;
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
CONFIGURE CHANNEL 1 DEVICE TYPE sbt CONNECT 'SYS/change_on_install@node1'
  PARMS 'ENV=(NSR_SERVER=bkserv1)';
CONFIGURE CHANNEL 2 DEVICE TYPE sbt CONNECT 'SYS/change_on_install@node2'
  PARMS ENV=(NSR_SERVER=bkserv2)';

Clearing Automatic Channels: Example  This example clears manually numbered DISK channels 2 and 3 and the generic sbt channel:
CONFIGURE CHANNEL 2 DEVICE TYPE DISK CLEAR;
CONFIGURE CHANNEL 3 DEVICE TYPE DISK CLEAR;
CONFIGURE CHANNEL DEVICE TYPE sbt CLEAR;

Configuring and Clearing Parallelism: Example  This example sets DISK parallelism to 2 , then changes it to 3 , then returns it to the default parallelism of 1 :
CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
CONFIGURE DEVICE TYPE DISK CLEAR;

Configuring Backup Copies: Example  This example configures duplexing to 3 for DISK backups of datafiles and control files (control file autobackups on disk are a special case and are never duplexed) and then runs a database backup, specifying three different file systems for the copies:
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 3;
BACKUP DEVICE TYPE DISK DATABASE
  FORMAT '/disk1/backup/%U', '/disk2/backup/%U', '/disk3/backup/%U';

deviceSpecifier

Syntax

deviceSpecifier::=

Description of devicespecifier.gif follows
Description of the illustration devicespecifier.gif

Purpose

A subclause specifying the type of storage for a backup or copy.

Keywords and Parameters

Syntax Element Description
DISK Specifies disk storage device.
'media_device' Specifies a sequential I/O device or access method for storage. The syntax and semantics of sequential I/O device types are platform-specific. Example values are sbt and sbt_tape (with or without quotes). These values are synonymous.

The media_device variable specifies a media manager. Media device names are case insensitive. The sbt variable is legal as input, but RMAN output always displays its synonym sbt_tape . It is stored in the catalog as sbt_tape for backward compatibility.


Examples

Allocating a Tape Channel: Example  This example allocates a maintenance channel for a media management device:
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE sbt;

Backing Up to Disk: Example  This example backs up the database to disk:
BACKUP DEVICE TYPE DISK DATABASE;

Restoring from Tape: Example  This example restores archived logs from tape:
RESTORE DEVICE TYPE sbt ARCHIVELOG ALL;

formatSpec

Syntax

formatSpec::=

Description of formatspec.gif follows
Description of the illustration formatspec.gif

Purpose

To specify a filename format or an Automatic Storage Management disk group for a backup piece or image copy. If you do not specify a value for the FORMAT parameter, then RMAN either creates the backup in the flash recovery area if it is enabled, or in a port-specific directory (for example, ?/dbs on UNIX) if a flash recovery area is not enabled. In either case, RMAN uses the variable %U to name the backup.

The entire format_string is processed in a port-specific manner by the target instance to derive the final backup piece name. The substitution variables listed in "Keywords and Parameters" are available in FORMAT strings to aid in generating unique filenames. The formatting of this information varies by platform.

Order of Precedence for Multiple Format Strings

You can specify up to four FORMAT strings. RMAN uses the second, third, and fourth values only when BACKUP COPIES , SET BACKUP COPIES , or CONFIGURE ... BACKUP COPIES is in effect. When choosing the format for each backup piece, RMAN uses the first format value for copy 1, the second format value for copy 2, and so on. If the number of format values exceeds the number of copies, then the extra formats are not used. If the number of format values is less than the number of copies, then RMAN reuses the format values, starting with the first one.

Specify format_string in any of these places, listed in order of precedence:

  1. The backupSpec clause

  2. The BACKUP command

  3. The ALLOCATE CHANNEL command

  4. The CONFIGURE CHANNEL command

If specified in more than one of these places, then RMAN searches for the FORMAT parameter in the order shown.

Restrictions and Usage Notes

Any name that is legal as a sequential filename on the platform is allowed, so long as each backup piece or copy has a unique name. If backing up to disk, then any legal disk filename is allowed, provided it is unique.

Keywords and Parameters

Syntax Element Description
%a Specifies the activation ID of the database.
%c Specifies the copy number of the backup piece within a set of duplexed backup pieces. If you did not duplex a backup, then this variable is 1 for backup sets and 0 for proxy copies. If one of these commands is enabled, then the variable shows the copy number. The maximum value for %c is 256.
%d Specifies the name of the database.
%D Specifies the current day of the month from the Gregorian calendar in format DD .
%e Specifies the archived log sequence number.
%f Specifies the absolute file number.
%F Combines the DBID, day, month, year, and sequence into a unique and repeatable generated name. This variable translates into c-IIIIIIIIII-YYYYMMDD-QQ , where:
  • IIIIIIIIII stands for the DBID. The DBID is printed in decimal so that it can be easily associated with the target database.

  • YYYYMMDD is a time stamp in the Gregorian calendar of the day the backup is generated

  • QQ is the sequence in hexadecimal number that starts with 00 and has a maximum of 'FF' (256)

%h Specifies the archived redo log thread number.
%I Specifies the DBID.
%M Specifies the month in the Gregorian calendar in format MM .
%N Specifies the tablespace name.
%n Specifies the name of the database, padded on the right with x characters to a total length of eight characters. For example, if the prod1 is the database name, then the padded name is prod1xxx .
%p Specifies the piece number within the backup set. This value starts at 1 for each backup set and is incremented by 1 as each backup piece is created.

Note: If you specify PROXY , then the %p variable must be included in the FORMAT string either explicitly or implicitly within %U .

%s Specifies the backup set number. This number is a counter in the control file that is incremented for each backup set. The counter value starts at 1 and is unique for the lifetime of the control file. If you restore a backup control file, then duplicate values can result. Also, CREATE CONTROLFILE initializes the counter back to 1 .
%t Specifies the backup set time stamp, which is a 4-byte value derived as the number of seconds elapsed since a fixed reference time. The combination of %s and %t can be used to form a unique name for the backup set.
%T Specifies the year, month, and day in the Gregorian calendar in this format: YYYYMMDD .
%u Specifies an 8-character name constituted by compressed representations of the backup set or image copy number and the time the backup set or image copy was created.
%U Specifies a system-generated unique filename (default). The meaning of %U is different for image copies and backup pieces.

For a backup piece, %U specifies a convenient shorthand for %u_%p_%c that guarantees uniqueness in generated backup filenames. If you do not specify a format when making a backup, then RMAN uses %U by default.

For an image copy of a datafile, %U means the following:

data-D-%d_id-%I_TS-%N_FNO-%f_%u

For an image copy of an archived redo velog, %U means the following:

arch-D_%d-id-%I_S-%e_T-%h_A-%a_%u

For an image copy of a control file, %U means the following:

cf-D_%d-id-%I_%u

%Y Specifies the year in this format: YYYY .
%% Specifies the literal ' % ' character. For example, %%Y translates to the string %Y .

Example

Specifying an ASM Disk Group: Example  This example copies the database to ASM disk group disk1 :
BACKUP AS COPY DATABASE FORMAT '+disk1';

Specifying a Format for Datafile Copies: Example  This example creates copies of three datafiles with tag 'LATESTCOPY ' to directory /copies :
# Create copies of 3 datafiles with tag 'LATESTCOPY' to directory /copies
BACKUP AS COPY
  FROM TAG 'LATESCOPY'
  COPY OF DATAFILE 4, 6, 14
  FORMAT '/copies/Datafile%f_Database%d';

Creating a Database Copy for Use as a Standby Database: Example  This example creates an image copy of the database to instantiate a physical standby in /stby:
# Create an image copy of the database to instantiate physical standby in /stby
BACKUP AS COPY
  DATABASE
  FORMAT '/stby/standby_file_%f_of_db_%I';


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

              http://download.oracle.com/docs/cd/B19306_01/backup.102/b14194/rcmsynta006.htm#i78513

              http://download.oracle.com/docs/cd/B19306_01/backup.102/b14194/rcmsynta025.htm#i81605

              http://download.oracle.com/docs/cd/B19306_01/backup.102/b14194/rcmsynta033.htm#i82206


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

如有错误,欢迎指正

邮箱:czmcj@163.com



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值