ALLOCATE CHANNEL

Purpose

ALLOCATE CHANNEL manually allocates a channel (which is a connection between RMAN and a database instance). The ALLOCATE CHANNEL command must be issued within a RUN block. It allocates a channel only in the block where the command is issued.

Prerequisites

The target instance must be started.

Usage Notes

Manually allocated channels are distinct from automatically allocated channels specified with CONFIGURE. Automatic channels apply to any RMAN job in which you do not manually allocate channels. You can override automatic channel configurations by manually allocating channels within a RUN command, but you cannot use BACKUP DEVICE TYPE or RESTORE DEVICE TYPE to use automatic channels after specifying manual channels with ALLOCATE CHANNEL.

Multiple Channels

You can allocate up to 255 channels; each channel can read up to 64 files in parallel. You can control the degree of parallelism within a job by the number of channels that you allocate. Allocating multiple channels simultaneously allows a single job to read or write multiple backup sets or disk copies in parallel, which each channel operating on a separate backup set or copy.

When making backups to disk, the guideline is to allocate one channel for each output device (see Example 2-7). If RMAN is writing to a striped file system or an ASM disk group, however, then multiple channels can improve performance. When backing up to tape, the guideline is that the number of tape channels should equal the number of tape devices divided by the number of duplexed copies (see Example 2-8).

Channels in an Oracle RAC Environment

If the SYSDBA password for all Oracle RAC instances is the same, then you never need to put passwords in the CONNECT option of the ALLOCATE or CONFIGURE command. If you use a connect string of the form user@database, then RMAN automatically uses the same password that was used for the TARGET connection when the RMAN session was started.

Semantics

Syntax Element Description
AUXILIARY Specifies a connection between RMAN and an auxiliary database instance.

An auxiliary instance is used when executing the DUPLICATE or TRANSPORT TABLESPACE command, and when performing TSPITR with RECOVER TABLESPACE (see Example 2-9). When specifying this option, the auxiliary instance must be started but not mounted.

See Also: DUPLICATE to learn how to duplicate a database, and CONNECT to learn how to connect to a duplicate database instance

CHANNEL channel_id Specifies a connection between RMAN and the target database instance. The channel_id is the case-sensitive name of the channel. The database uses the channel_id to report I/O errors.

Each connection initiates an database server session on the target or auxiliary instance: this session performs the work of backing up, restoring, or recovering RMAN backups. You cannot make a connection to a shared server session.

Whether ALLOCATE CHANNEL allocates operating system resources immediately depends on the operating system. On some platforms, operating system resources are allocated when the command is issued. On other platforms, operating system resources are not allocated until you open a file for reading or writing.

Each channel operates on one backup set or image copy at a time. RMAN automatically releases the channel after the job.

Note: You cannot prefix ORA_ to a channel name. RMAN reserves channel names beginning with the ORA_ prefix for its own use.

DEVICE TYPE deviceSpecifier Specifies the type of storage for a backup. Query the V$BACKUP_DEVICE view for information about available device types and names.

Note: When you specify DEVICE TYPE DISK, no operating system resources are allocated other than for the creation of the server session.

See Also: deviceSpecifier

   allocOperandList Specifies control options for the allocated channel. The channel parameters for sequential I/O devices are platform-specific (see Example 2-6).

See Also: allocOperandList


Examples

Example 2-6 Manually Allocating a Channel for a Backup

This example allocates a single tape channel for a whole database and archived redo log backup. The PARMS parameter specifies the Oracle Secure Backup media family named wholedb_mf.

RUN
{
  ALLOCATE CHANNEL c1 DEVICE TYPE sbt
    PARMS 'ENV=(OB_MEDIA_FAMILY=wholedb_mf)';
  BACKUP DATABASE;
  BACKUP ARCHIVELOG ALL NOT BACKED UP;
}

Example 2-7 Distributing a Backup Across Multiple Disks

When backing up to disk, you can spread the backup across several disk drives. Allocate one DEVICE TYPE DISK channel for each disk drive and specify the format string so that the output files are on different disks.

RUN
{
  ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT '/disk1/%U'; 
  ALLOCATE CHANNEL disk2 DEVICE TYPE DISK FORMAT '/disk2/%U'; 
  BACKUP DATABASE PLUS ARCHIVELOG;
}

Example 2-8 Creating Multiple Copies of a Backup on Tape

In this example, four tape drives are available for writing: stape1, stape2, stape3, and stape4. You use the SET BACKUP COPIES command to indicate that RMAN should create two identical copies of the database backup. Because the guideline is that the number of tape channels should equal the number of tape devices divided by the number of duplexed copies, you allocate two channels. In this case the BACKUP_TAPE_IO_SLAVES initialization parameter must be set to TRUE.

In the OB_DEVICE_n parameter for Oracle Secure Backup, the n specifies the copy number of the backup piece. RMAN writes copy 1 of each backup piece to tape drives stape1 and stape2 and writes copy 2 of each backup piece to drives stape3 and stape4. Thus, each copy of the database backup is distributed between two tape drives, so that part of the data is on each drive.

RUN
{
  ALLOCATE CHANNEL t1 DEVICE TYPE sbt 
    PARMS 'ENV=(OB_DEVICE_1=stape1,OB_DEVICE_2=stape3)';
  ALLOCATE CHANNEL t2 DEVICE TYPE sbt 
    PARMS 'ENV=(OB_DEVICE_1=stape2,OB_DEVICE_2=stape4)';
  SET BACKUP COPIES 2;
  BACKUP DATABASE;
}

Example 2-9 Allocating an Auxiliary Channel for Database Duplication

This example creates a duplicate database from backups. RMAN can use configured channels for duplication even if they do not specify the AUXILIARY option. In this example, no SBT channel is preconfigured, so an auxiliary SBT channel is manually allocated.

RUN
{ 
  ALLOCATE AUXILIARY CHANNEL c1 DEVICE TYPE sbt;
  DUPLICATE TARGET DATABASE
    TO dupdb   
  DB_FILE_NAME_CONVERT '/disk2/dbs/','/disk1/'
  SPFILE 
    PARAMETER_VALUE_CONVERT   '/disk2/dbs/',
                              '/disk1/'
    SET LOG_FILE_NAME_CONVERT '/disk2/dbs/',
                              '/disk1/';
}

See Also:

Oracle Database Reference for more information on the parameter DB_FILE_NAME_CONVERT