Oracle® Database Backup and Recovery Advanced User's Guide 10g Release 2 (10.2) Part Number B14191-01 |
|
|
View PDF |
An RMAN channel represents one stream of data to a device type, and corresponds to one server session. Most backup and recovery commands in RMAN are executed by server sessions. As illustrated in Figure 2-1, each channel establishes a connection from the RMAN client to a target or auxiliary database instance by starting a server session on the instance. The server session performs the backup, restore, and recovery.
You can use the CONFIGURE
CHANNEL
command to configure channels for use with disk or tape in all RMAN sessions using automatic channel allocation, or allocate channels manually within a RUN block. RMAN comes preconfigured with one DISK
channel that you can use for backups to disk.
When you run a command that requires a channel without allocating a channel explicitly, then RMAN automatically allocates the channels with the options specified in the CONFIGURE
command. For the BACKUP
command, RMAN allocates only a single type of channel, such as DISK
. For the RESTORE
command and maintenance commands (for example, DELETE
), RMAN allocates all necessary channels for the device types required to execute the command.
To specify the device type to use for an operation explicitly, use the ALLOCATE CHANNEL
command, which must be used within a RUN block, or ALLOCATE CHANNEL FOR MAINTENANCE
, which must be executed at the RMAN prompt.
In a Real Application Clusters configuration, there are special considerations regarding channel allocation and backups. See Oracle Database Oracle Clusterware and Oracle Real Application Clusters Administration and Deployment Guide for more details.
How and when the ALLOCATE
CHANNEL
or CONFIGURE
CHANNEL
commands cause the media manager to allocate resources is vendor-specific. Some media managers allocate resources when you issue the command; others do not allocate resources until you open a file for reading or writing.
See Also: Oracle Database Backup and Recovery Reference forALLOCATE CHANNEL syntax and Oracle Database Backup and Recovery Reference on ALLOCATE CHANNEL FOR MAINTENANCE |
You can use the automatic channel allocation feature to configure a set of persistent, automatic channels for use in all RMAN sessions. You can use the manual channel allocation feature to specify channels for commands used within a RUN
block.
RMAN allocates automatic channels according to the settings in these commands:
CONFIGURE
DEVICE TYPE
...
PARALLELISM
CONFIGURE
DEFAULT
DEVICE
TYPE
CONFIGURE
CHANNEL
For example, you can issue the following commands at the RMAN prompt:
# since you do not manually allocate channels, RMAN uses preconfigured channels BACKUP DATAFILE 3; RESTORE TABLESPACE users;
When you run a command that requires channels, and no channels have been allocated using the ALLOCATE
command, RMAN automatically allocates channels according to values set with the CONFIGURE
command in the following cases:
You use commands such as BACKUP
, RESTORE
, or DELETE
outside of a RUN
block.
You use commands within a RUN
block but do not allocate any channels within the RUN
block.
You can override automatic channel allocation settings by manually allocating channels within a RUN
block. Manual channels always override automatic channels. For example, you override automatic channel allocation when you issue a command as follows:
RUN { ALLOCATE CHANNEL c1 DEVICE TYPE sbt; BACKUP DATABASE PLUS ARCHIVELOG; }
RMAN optimizes automatic channel allocation by leaving automatic channels allocated so long as each new command requires exactly the same channel configuration as the previous command. For example, RMAN can use the same preallocated channels for the following series of commands:
BACKUP DATAFILE 1; BACKUP CURRENT CONTROLFILE; BACKUP ARCHIVELOG ALL;
If you issue a command such as ALLOCATE
or CONFIGURE
, then RMAN automatically releases the preallocated channels.
The CONFIGURE
DEVICE
TYPE
...
PARALLELISM
command specifies the number of automatic channels to allocate for a specified device type. For example, if you configure parallelism to 3 for a device type, then RMAN allocates three channels for the device type when using automatic channels.
You can change a parallelism setting by issuing another CONFIGURE
DEVICE
TYPE
...
PARALLELISM
command. This example configures PARALLELISM
2
and then changes it to 3:
CONFIGURE DEVICE TYPE DISK PARALLELISM 2; CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
The parallelism setting defines the number of channels for a device that RMAN allocates in parallel. It does not have to correspond to the actual number of channels configured for the device. For example, you can manually configure four different sbt
channels and set PARALLELISM
for sbt
to 2
, 1
, or 10
.
You can view the default setting for parallelism by running the SHOW
DEVICE
TYPE
command. For example:
RMAN> SHOW DEVICE TYPE; RMAN configuration parameters are: CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; #default
As always when the SHOW
command is used to view the value of a parameter, RMAN includes a "#default"
comment at the end of the line if the RMAN default value has not been overridden.
The following example configures the default device to sbt
and then displays the resulting configuration using the SHOW DEVICE TYPE
command:
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt; new RMAN configuration parameters: CONFIGURE DEFAULT DEVICE TYPE TO 'sbt'; new RMAN configuration parameters are successfully stored RMAN> SHOW DEVICE TYPE; RMAN configuration parameters are: CONFIGURE DEVICE TYPE SBT PARALLELISM 1; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
Run the CONFIGURE
DEFAULT
DEVICE
TYPE
command to specify a default device type for automatic channels. For example, you may make backups to tape most of the time and only occasionally make a backup to disk. In this case, configure channels for disk and tape devices, but make sbt
the default device type:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # configure device disk CONFIGURE DEVICE TYPE sbt PARALLELISM 2; # configure device sbt CONFIGURE DEFAULT DEVICE TYPE TO sbt;
Now, RMAN will, by default, use sbt channels for backups. For example, if you run the following command:
BACKUP TABLESPACE users;
RMAN only allocates channels of type sbt
during the backup because sbt
is the default device.
You can override the default device for backups by specifying the target device as part of the command. For example:
BACKUP DEVICE TYPE sbt DATABASE;
If the default device type is DISK
, then the preceding command overrides this default and uses the sbt
channel configuration. Note that this command fails unless you have configured the sbt
device or configured sbt
channels.
When restoring files, RMAN allocates all automatic channels according to the settings configured for each device type. The default device type configuration is irrelevant. For example, if you configure PARALLELISM
to 3
for the default sbt
device and PARALLELISM
to 2
for DISK
, then RMAN automatically allocates three sbt
channels and two DISK
channels during the restore.
RMAN uses the following convention for channel naming: ORA_
devicetype
_
n
, where devicetype
refers to the user's device type (such as DISK
or sbt_tape
) and n
refers to the channel number.
Note: Thesbt and sbt_tape device types are synonymous, but RMAN output always displays sbt_tape whether the input is sbt or sbt_tape . |
For example, RMAN names the first DISK
channel ORA_DISK_1
, the second ORA_DISK_2
, and so forth. RMAN names the first sbt
channel ORA_SBT_TAPE_1
, the second ORA_SBT_TAPE_2
, and so forth. When you parallelize channels, RMAN always allocates channels in numerical order, starting with 1 and ending with the parallelism setting (CONFIGURE
DEVICE
TYPE
...
PARALLELISM
n
), as in this example:
ORA_SBT_TAPE_1 ORA_SBT_TAPE_2 ORA_SBT_TAPE_3
Automatic channel allocation also applies to maintenance commands. If RMAN allocates an automatic maintenance channel, then it uses the same naming convention as any other automatically allocated channel. If you manually allocate a maintenance channel using ALLOCATE
CHANNEL
FOR
MAINTENANCE
, then RMAN uses the following convention for channel naming: ORA_MAINT_
devicetype
_
n
, where devicetype
refers to the user's device type (for example, DISK
or sbt
) and n
refers to the channel number. For example, RMAN uses these names for two manually allocated disk channels:
ORA_MAINT_DISK_1 ORA_MAINT_DISK_2
Note that if you run the CONFIGURE
DEVICE
TYPE
command to configure default settings for a device type and do not run CONFIGURE
CHANNEL
for this device type, then RMAN allocates all channels without other channel control options. For example, assume that you configure the sbt
device and run a backup as follows:
CONFIGURE DEVICE TYPE sbt PARALLELISM 1; BACKUP DEVICE TYPE sbt DATABASE;
In effect, RMAN does the following:
RUN { ALLOCATE CHANNEL ORA_SBT_TAPE_1 DEVICE TYPE sbt; BACKUP DATABASE; }
Channel names beginning with the ORA_
prefix are reserved by RMAN for its own use. You cannot manually allocate a channel with a name that begins with ORA_
.
The CONFIGURE
CHANNEL
DEVICE
TYPE
command configures generic settings that are used for all automatic channels of the specified device type. In other words, the command creates a template of settings that RMAN uses for all channels allocated on the device. For example, you can configure disk and tape channels as follows:
CONFIGURE CHANNEL DEVICE TYPE sbt PARMS='ENV=(NSR_SERVER=bksvr1)'; CONFIGURE CHANNEL DEVICE TYPE DISK RATE 5M FORMAT="?/oradata/%U";
Because you do not specify channel numbers for these channels, the channel settings are generic to all automatic channels of the specified type. The configuration acts as a template. For example, if you set PARALLELISM
for DISK
to 10
, and the default device type is DISK
, then RMAN allocates ten disk channels using the settings in the CONFIGURE
CHANNEL
DEVICE
TYPE
DISK
command.
You can also configure parameters that apply to a specific automatic channel. If you are using a media manager that requires different settings on each channel, then you may find it useful to configure individual channels.
You can mix a CONFIGURE
CHANNEL
command that creates a generic configuration with a CONFIGURE
CHANNEL
command that creates a specific configuration. A generic automatic channel creates a configuration that can be used for any channel that is not explicitly configured.
For example, assume that you run these commands:
CONFIGURE DEVICE TYPE DISK PARALLELISM 3; CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE = 2M; CONFIGURE CHANNEL 3 DEVICE TYPE DISK MAXPIECESIZE = 900K;
In this scenario, RMAN allocates ORA_DISK_1
and ORA_DISK_2
with option MAXPIECESIZE
=
2M
, using the settings for the DISK
channel with no number. RMAN allocates ORA_DISK_3
with MAXPIECESIZE
=
900K
because this channel was manually assigned a channel number. RMAN always allocates the number of channels specified in the parallelism parameter.
You can specify the CLEAR
option for any CONFIGURE
command. The CLEAR
option returns the specified configuration to its default value. Assume you run these commands:
CONFIGURE DEVICE TYPE DISK CLEAR; # returns DISK to default PARALLELISM 1 # and backup type to BACKUPSET CONFIGURE DEFAULT DEVICE TYPE CLEAR; # returns to default device type of DISK CONFIGURE CHANNEL DEVICE TYPE sbt CLEAR; # removes all options for sbt channel CONFIGURE CHANNEL 3 DEVICE TYPE DISK CLEAR; # removes configurations for 3rd ch.
Each CONFIGURE...CLEAR
command removes the user-entered settings and returns the configuration to its default value.
The only way to find out the default setting for parameters set through CONFIGURE
is to use CONFIGURE
... CLEAR
to un-set the parameter, so that it takes on the default value, and then run SHOW
ALL
to view all parameters. For any parameter for which the value is currently set to RMAN'S default, RMAN includes a "#default
" comment at the end of that line of the output from SHOW ALL
.
See Also: Oracle Database Backup and Recovery Reference for the default settings for eachCONFIGURE command |
RMAN can perform the I/O required for many commands in parallel, to make optimal use of your hardware resources. To perform I/O in parallel, however, the I/O must be associated with a single RMAN command, not a series of commands. For example, it can be more efficient to back up three datafiles using a command such as:
BACKUP DATAFILE 5,6,7;
rather than issuing the commands
BACKUP DATAFILE 5; BACKUP DATAFILE 6; BACKUP DATAFILE 7;
When all three datafiles are backed up in one command, RMAN recognizes the opportunity for parallelism and can use multiple channels to do the I/O in parallel. When three separate commands are used, RMAN can only perform the backups one at a time, regardless of available channels and I/O devices.
The number of channels available (whether allocated in a RUN block or configured in advance) for use with a device at the moment that you run a command determines whether RMAN will read from or write to that device in parallel while carrying out the command. Failing to allocate the right number of channels adversely affects RMAN performance during I/O operations.
As a rule, the number of channels used in carrying out an individual RMAN command should match the number of physical devices accessed in carrying out that command. If manually allocating channels for a command, allocate one for each device; if configuring automatic channels, configure the PARALLELISM setting appropriately.
When backing up to tape, you should allocate one channel for each tape drive. When backing up to disk, allocate one channel for each physical disk, unless you can optimize the backup for your disk topography by using multiple disk channels. Each manually allocated channel uses a separate connection to the target or auxiliary database.
The following script creates three backups sequentially: three separate BACKUP
commands are used to back up one file each. Only one channel is active at any one time because only one file is being backed up in each command.
RUN { ALLOCATE CHANNEL c1 DEVICE TYPE sbt; ALLOCATE CHANNEL c2 DEVICE TYPE sbt; ALLOCATE CHANNEL c3 DEVICE TYPE sbt; BACKUP DATAFILE 5; BACKUP DATAFILE 6; BACKUP DATAFILE 7; }
The following statement uses parallelization on the same example: one RMAN BACKUP
command backs up three datafiles, with all three channels in use. The three channels are concurrently active—each server session copies one of the datafiles to a separate tape drive.
RUN { ALLOCATE CHANNEL c1 DEVICE TYPE sbt; ALLOCATE CHANNEL c2 DEVICE TYPE sbt; ALLOCATE CHANNEL c3 DEVICE TYPE sbt; BACKUP DATAFILE 5,6,7; }
See Also: Oracle Database Oracle Clusterware and Oracle Real Application Clusters Administration and Deployment Guide for information about parallelization in a Real Application Clusters (RAC) configuration. |
Whether you allocate channels manually or automatically, you can use channel control commands and options to do the following:
Control the operating system resources RMAN uses when performing RMAN operations
Affect the degree of parallelism for a backup or restore command
Set limits on I/O bandwidth consumption in kilobytes, megabytes, or gigabytes (ALLOCATE
CHANNEL
...
RATE
, CONFIGURE
CHANNEL
...
RATE
)
Set limits on the size of backup pieces (the MAXPIECESIZE
parameter specified on the CONFIGURE
CHANNEL
and ALLOCATE
CHANNEL
commands)
Set limits on the size of backup sets (the MAXSETSIZE
parameter specified on the BACKUP
and CONFIGURE
commands)
Send vendor-specific commands to the media manager (SEND
)
Specify vendor-specific parameters for the media manager (ALLOCATE
CHANNEL
...
PARMS
, CONFIGURE
CHANNEL
...
PARMS
)
Specify which instance performs the operation (ALLOCATE
CHANNEL
...
CONNECT
, CONFIGURE
CHANNEL
...
CONNECT
)
In releases 8.1.5 and later of the database, the ALLOCATE
CHANNEL
command causes RMAN to contact the media manager whenever the type specified is other than DISK
. In earlier releases, the ALLOCATE
CHANNEL
command does not cause RMAN to contact the media manager; RMAN does not call the media manager until a BACKUP
, RESTORE
, or RECOVER
command is issued.
Note: When you specifyDEVICE TYPE DISK with any version of RMAN, RMAN does not allocate operating system resources other than for the creation of the server session and does not call the media manager. |
Because RMAN has one preconfigured automatic DISK
channel, you do not have to manually allocate a maintenance channel when running CHANGE
, CROSSCHECK
, or DELETE
against a disk file (that is, an ARCHIVELOG
, DATAFILECOPY
, or CONTROLFILECOPY
).
A maintenance channel is useful only for a maintenance task; you cannot use it as an input or output channel for a backup or restore.
See Also: Oracle Database Backup and Recovery Reference forALLOCATE CHANNEL syntax, and Oracle Database Backup and Recovery Reference for CONFIGURE syntax |
A BACKUP
command is decomposed into multiple independent backup steps by RMAN. Each independent step can be executed on any channel allocatedfor the type of device used in the command. If you have multiple channels allocated, and one channel fails or encounters a problem during a backup step, then RMAN attempts to complete the work on another channel. Typically, such retriable errors can occur when a media manager encounters problems with one of several tape drives, or when an instance fails in a RAC environment.
RMAN reports a message in V$RMAN_OUTPUT
and in the output to the interactive session or log file when it encounters such problems, as in the following example (refer to bold text):
channel ORA_SBT_TAPE_1: backup set failed, re-triable on other channel ORA-19506: failed to create sequential file, name="/bkup/63d3c3og_1_1", parms="" ORA-27028: skgfqcre: sbtbackup returned error ORA-19511: Error received from media manager layer, error text: failed to open file /bkup/63d3c3og_1_1 for backup, errno = 2 channel ORA_SBT_TAPE_2: finished piece 1 at 06-SEP-01 piece handle=5ld3blun_1_1 comment=API Version 2.0,MMS Version 3.2.0.0 channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:04 retrying ORA_SBT_TAPE_1 failed backup step on ORA_SBT_TAPE_2 channel ORA_SBT_TAPE_2: starting full datafile backupset channel ORA_SBT_TAPE_2: specifying datafile(s) in backupset input datafile fno=00004 name=/oracle/dbs/tbs_12.f input datafile fno=00017 name=/oracle/dbs/tbs_14.f channel ORA_SBT_TAPE_2: starting piece 1 at 06-SEP-01 piece handle=5ld3buds_1_1 comment=API Version 2.0,MMS Version 3.2.0.0 channel ORA_SBT_TAPE_2: backup set complete, elapsed time: 00:00:06
Note that if RMAN is executing a script, then the next command in the script will not be executed if there were any errors in the previous command.