Skip Headers

Oracle9i Recovery Manager User's Guide
Release 2 (9.2)

Part Number A96566-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

5
RMAN Concepts I: Channels, Backups, and Copies

This chapter describes the basic concepts involved in using the Recovery Manager (RMAN) utility.

This chapter contains these topics:

RMAN Automatic and Manual Channel Allocation

This section contains these topics:

About RMAN Channels

An RMAN channel represents one stream of data to a device type and corresponds to one server session. Allocation of one or more RMAN channels is necessary to execute most backup and recovery commands. As illustrated in Figure 5-1, each channel establishes a connection from the RMAN executable to a target or auxiliary database instance by starting a server session on the instance. The server session performs the backup, restore, and recovery operations. Only one RMAN session communicates with the allocated server sessions.

Figure 5-1 Channel Allocation

Text description of sbr81083.gif follows
Text description of the illustration sbr81083.gif


You can either allocate channels manually within a RUN block, or preconfigure channels for use in all RMAN sessions using automatic channel allocation. RMAN comes preconfigured with a DISK channel that you can use for backups and copies to disk. You can also run the CONFIGURE CHANNEL command RMAN to specify automatic channels to disk or tape. In this way, you do not have to allocate channels every time you perform a backup, restore, or recovery operation.

When you run a command that requires a channel, and you do not allocate a channel manually, then RMAN automatically allocates the channels using the options specified in the CONFIGURE command. For the BACKUP command, RMAN allocates only a single type of channel, such as DISK or sbt. For the RESTORE command and the various maintenance commands (for example, DELETE), RMAN determines which device types are required, and allocates all necessary channels.

If you specify channels manually, then the ALLOCATE CHANNEL command (executed only within a RUN command) and ALLOCATE CHANNEL FOR MAINTENANCE command (executed only at the RMAN prompt) specify the type of I/O device that the server session will use to perform the backup, restore, or maintenance operation.

Whether the ALLOCATE CHANNEL command or CONFIGURE CHANNEL causes 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:

Oracle9i Recovery Manager Reference for ALLOCATE CHANNEL syntax and Oracle9i Recovery Manager Reference on ALLOCATE CHANNEL FOR MAINTENANCE

Automatic and Manual Channel Allocation

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 you to specify channels for commands used within a RUN block.

Unless you manually run an ALLOCATE CHANNEL command, RMAN allocates automatic channels according to the settings in these commands:

For example, you can issue the following commands at the RMAN prompt:

BACKUP DATAFILE 3;
RUN { RESTORE TABLESPACE users; }

RMAN automatically allocates channels according to values set with the CONFIGURE command in the following cases:

You can override automatic channel allocation settings by manually allocating channels within a RUN block. You cannot mix automatic and manual channels, so 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.

See Also:

"Configuring Automatic Channels" to learn how to configure automatic channels

Automatic Channel Device Configuration

The CONFIGURE DEVICE TYPE ... PARALLELISM command specifies the number of channels that RMAN uses when allocating automatic channels for a specified device type. For example, if you configure parallelism to 3, then RMAN allocates three channels of the default device type whenever it uses automatic channels.

When parallelizing, RMAN always allocates channels in numerical order, beginning with 1 and ending with the parallelism setting. For example, if the device type is sbt and parallelization is set to 4, then RMAN allocates as follows:

ORA_SBT_TAPE_1
ORA_SBT_TAPE_2
ORA_SBT_TAPE_3
ORA_SBT_TAPE_4

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. The default value is followed by a number sign (#). For example:

RMAN> SHOW DEVICE TYPE;
RMAN configuration parameters are:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default

The following example configures the default device to sbt and runs another SHOW 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; # default
See Also:

"Configuring a Generic Automatic Channel for a Device Type"

Automatic Channel Default Device Types

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 the device of sbt the default device:

CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # configure device disk
CONFIGURE DEVICE TYPE sbt PARALLELISM 2; # configure device sbt
CONFIGURE DEFAULT DEVICE TYPE TO sbt;

RMAN only allocates sbt channels when you run backup commands. For example, you may issue the following:

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 and copies by specifying a different device on the command using the channel. For example, run a backup as follows:

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.

During a restore operation, RMAN allocates all automatic channels according to the parallelism 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.

See Also:

"Changing the Default Device Type"

Automatic Channel Naming Conventions

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:

The sbt 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 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 the ALLOCATE CHANNEL command and then prefix the channel name with ORA_.

Automatic Channel Generic Configurations

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" MAXOPENFILES=20;

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.

See Also:

"Configuring a Generic Automatic Channel for a Device Type"

Automatic Channel Specific Configurations

You can also configure parameters that apply to one specific automatic channel. If you are running in an Oracle Real Application Clusters configuration or using a media manager that requires different settings on each channel, then you may find it useful to configure individual channels.

For example, in an Oracle Real Application Clusters environment you can enter:

CONFIGURE DEFAULT DEVICE DEVICE TYPE TO sbt;
CONFIGURE DEVICE TYPE sbt PARALLELISM 2;
CONFIGURE CHANNEL 1 DEVICE TYPE sbt CONNECT 'node1' PARMS='ENV=(NSR_SERVER=bksvr1)';
CONFIGURE CHANNEL 2 DEVICE TYPE sbt CONNECT 'node2' PARMS='ENV=(NSR_SERVER=bksvr1)';

In this example, RMAN allocates 2 channels for every backup job, ORA_SBT_TAPE_1 and ORA_SBT_TAPE_2. The ORA_SBT_TAPE_1 channel uses the settings for CHANNEL 1 and the ORA_SBT_TAPE_2 channel uses the settings for CHANNEL 2.

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 simply 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.

See Also:

"Configuring a Generic Automatic Channel for a Device Type"

Clearing Automatic Channel Settings

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
CONFIGURE DEFAULT DEVICE TYPE CLEAR;        # returns to default device type of DISK
CONFIGURE CHANNEL DEVICE TYPE sbt CLEAR;    # removes all the options for sbt channel
CONFIGURE CHANNEL 3 DEVICE TYPE DISK CLEAR; # removes all configurations for 3rd channel

Each CONFIGURE command removes the user-entered settings and returns the configuration to its default value. To see the default configuration settings, run the SHOW ALL command before entering any configurations of your own. The defaults are prefixed with a number sign (#).

See Also:

Oracle9i Recovery Manager Reference for the default settings for each CONFIGURE command, and "Showing All RMAN Configuration Settings"

Parallelization for Manually Allocated Channels

If you do not want to use automatic channels, then you can allocate multiple channels manually within a RUN command, thus allowing a single RMAN command to read or write multiple backups or image copies in parallel. Thus, the number of channels that you allocate affects the degree of parallelism within a command. When backing up to tape you should allocate one channel for each physical device, but when backing up to disk you can allocate as many channels as necessary for maximum throughput.

Each manually allocated channel uses a separate connection to the target or auxiliary database. You can specify a different CONNECT string for each channel to connect to different instances of the target database, which is useful in an Oracle Real Application Clusters configuration for distributing work across nodes.

RMAN internally handles parallelization of BACKUP, COPY, and RESTORE commands. You only need to specify:

RMAN executes commands sequentially; that is, it completes the current command before starting the next one. Parallelism is exploited only within the context of a single command. Consequently, to create three backups of a datafile, issue a single BACKUP command specifying all three datafiles rather than three separate BACKUP commands.

The following script uses serialization to create the backups: 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.

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:

Oracle9i Real Application Clusters Concepts for information about parallelization in an Oracle Real Application Clusters configuration

Channel Control Options for Manual and Automatic Channels

Whether you allocate channels manually or automatically, you can use channel control commands and options to do the following:

On some platforms, the channel allocation and channel control commands specify the name or type of an I/O device to use. On other platforms, they specify which operating system access method or I/O driver to use. Not all platforms support the selection of I/O devices through this interface; on some platforms, I/O device selection is controlled through platform-specific mechanisms.

In Oracle9i, the ALLOCATE CHANNEL command causes RMAN to contact the media manager whenever the type specified is other than DISK. In releases before Oracle9i, the ALLOCATE CHANNEL command does not cause RMAN to contact the media manager; RMAN does not call the media manager unless a BACKUP, RESTORE, or RECOVER command is issued.


Note:

When you specify DEVICE 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 a preconfigured automatic DISK channel, you do not have to manually allocate a maintenance channel when running CHANGE ... AVAILABLE, CROSSCHECK, or DELETE against a file that is only on disk (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 job.

See Also:

Oracle9i Recovery Manager Reference for ALLOCATE CHANNEL syntax, and Oracle9i Recovery Manager Reference for CONFIGURE syntax

Hardware Multiplexing by the Media Manager

Hardware multiplexing occurs when the media manager writes multiple RMAN backups to a single sequential device (such as a tape drive). Oracle Corporation does not recommend hardware multiplexing of RMAN backups.

Backup Sets

When you execute the BACKUP command, you create one or more backup sets. This section contains these topics:

About Backup Sets

A backup set, which is a logical object, contains one or more physical backup pieces. By default, one backup set contains one backup piece. Backup pieces are operating system files that contain the backed up datafiles, control files, or archived redo logs. For example, you can back up ten datafiles into a single backup set containing a single backup piece (that is, a single output file). You cannot split a file across different backup sets or mix archived logs and datafiles into one backup set.

A backup set is a complete set of backup pieces that make up a full or incremental backup of the objects specified in the BACKUP command. Backup sets are in an RMAN-specific format. An image copy, which is a complete image of a single datafile, control file, or archived log, is not in an RMAN-specific format.

You can back up datafiles, control files, archived redo logs, and the current server parameter file. You can also back up another backup set, as when you want to back up a disk backup to tape, or an image copy. For example, you can issue commands such as the following, each of which uses an automatic channel configuration:

BACKUP DATABASE;
BACKUP TABLESPACE users, tools;
BACKUP (SPFILE) (CURRENT CONTROL FILE);
BACKUP BACKUPSET 12;
BACKUP DATAFILECOPY '/tmp/system01.dbf';

When backing up datafiles, the target database must be mounted or open. If the database is in ARCHIVELOG mode, then the target can be open or closed: you do not need to close the database cleanly. If the database is in NOARCHIVELOG mode, then you must close it cleanly before making a backup.


Note:

You cannot make a backup of a transported tablespace until after it has been specified read/write.


See Also:

"Automatic Channel Generic Configurations" to learn about automatic channels, and "Backing Up Database Files and Archived Logs with RMAN" to learn how make backups

About Proxy Copies

A proxy copy is a special type of backup in which RMAN turns over control of the data transfer to a media manager that supports this feature. The PROXY option of the BACKUP command specifies that a backup should be a proxy copy.

For each file that you attempt to back up using the BACKUP PROXY command, RMAN queries the media manager to determine whether it can perform a proxy copy. If the media manager cannot proxy copy the file, then RMAN uses conventional backup sets to perform the backup. An exception occurs when you use the PROXY ONLY option, which causes Oracle to issue an error message when it cannot proxy copy.

Oracle records each proxy-copied file in the control file. RMAN uses this data to resynchronize the recovery catalog. Use the V$PROXY_DATAFILE view to obtain the proxy copy information. Use the CHANGE PROXY command or DELETE PROXY command to change the status of or delete a proxy backup.


Note:

The proxy functionality was introduced in Oracle8i Release 1 (8.1.5). If a proxy version of RMAN is used with a non-proxy target database, RMAN will not use proxy copy to create backup sets. If you make backups using proxy copy and then downgrade Oracle to a non-proxy version, RMAN will not use proxy copy backups when restoring and will issue a warning when the best available file is a proxy copy.


See Also:

Oracle9i Database Reference for more information about V$PROXY_DATAFILE and V$PROXY_ARCHIVEDLOG

Storage of Backup Sets

RMAN can create backup sets that are written to disk or tertiary storage. If you specify DEVICE TYPE DISK, then you must back up to random access disks. You can make a backup on any device that can store an Oracle datafile: in other words, if the statement CREATE TABLESPACE tablespace_name DATAFILE 'filename' works, then 'filename' is also a valid backup path name.

Using a media management system that is available and supported on your operating system, you can write backup sets to sequential output media such as magnetic tape. If you specify a device type such as sbt that is other than DISK, then you can back up to any media supported by the media management software.

See Also:

"Backup Retention Policies" to learn how to configure a policy that determines which backups are obsolete

Backup Set Compression

As Figure 5-2 illustrates, RMAN performs compression on its backups, which means that datafile blocks that have never been used are not backed up. Image copies of a datafile, however, always contain all datafile blocks.

Figure 5-2 Backup Set Compression

Text description of sbr81081.gif follows
Text description of the illustration sbr81081.gif


See Also:

"Disk Buffer Allocation" and "Tape Buffer Allocation" to learn how RMAN buffers its backups

Backups of Archived Logs

RMAN provides additional functionality for backups of archived redo logs. This section contains these topics:

Deletion of Archived Logs After Backups

Although you cannot archive logs directly to tape, you can use RMAN to back up archived logs from disk to tape. If you specify the DELETE INPUT option, then RMAN backs up exactly one copy of each specified log sequence number and then deletes the copy from disk after backing it up.

If you specify the DELETE ALL INPUT option, then RMAN backs up exactly one copy of each specified log sequence number and then deletes the copies that match the specified criteria. For example, if you specify the LIKE parameter, RMAN deletes whichever logs match the string. RMAN automatically restores needed archived logs from tape to disk during recovery.

Backup Failover for Archived Redo Logs

In releases prior to Oracle9i, RMAN only looked in the first archiving destination for archived redo logs when backing them up. In Oracle9i, RMAN can perform archived redo log failover. RMAN can do the following:

RMAN always only backs up one copy of each distinct log sequence number. For example, assume that you archive logs 121 to 124 to two archiving destinations: /arch1 and /arch2. The control file contains archived log records as follows:

Sequence Filename

121

/arch1/archive1_121.arc

121

/arch2/archive1_121.arc

122

/arch1/archive1_122.arc

122

/arch2/archive1_122.arc

123

/arch1/archive1_123.arc

123

/arch2/archive1_123.arc

124

/arch1/archive1_124.arc

124

/arch2/archive1_124.arc

However, unknown to RMAN, someone accidentally deletes logs 122 and 124 from the /arch1 directory. Then, you run the following backup:

BACKUP ARCHIVELOG FROM SEQUENCE 121 UNTIL SEQUENCE 125;

In this case, RMAN can use the failover feature to back up the archived logs as described in the following table.

Sq. If RMAN Searches For . . . Then RMAN Can Find and Back Up . . .

121

/arch1/archive1_121.arc

/arch1/archive1_121.arc

122

/arch1/archive1_122.arc (missing)

/arch2/archive1_122.arc

123

/arch1/archive1_123.arc

/arch1/archive1_123.arc

124

/arch1/archive1_124.arc (missing)

/arch2/archive1_124.arc

Automatic Online Redo Log Switches During Backups of Archived Logs

At the beginning of every BACKUP ... ARCHIVELOG command that does not specify an UNTIL clause, RMAN attempts to automatically switch out of and archive the current online redo log. In this way, RMAN can include the current redo log in the backup set.

If the database is open, then at the start of an archived log backup RMAN tries to switch out of and archive the current online log according to these rules:

Backups of Archived Logs Needing Backups

When making backups, run the BACKUP ... PLUS ARCHIVELOG command to archive online logs as well as back up archived logs. The purpose of this feature is to guarantee that the backed up datafiles can be recovered to a consistent state.

When PLUS ARCHIVELOG is specified, RMAN performs the following actions in sequential order:

  1. Runs ALTER SYSTEM ARCHIVE LOG CURRENT.
  2. Runs BACKUP ARCHIVELOG ALL.
  3. Backs up the files specified in the BACKUP command.
  4. Runs ALTER SYSTEM ARCHIVE LOG CURRENT.
  5. Backs up any remaining archived redo logs generated during backup.

You cannot specify PLUS ARCHIVELOG when explicitly backing up archived logs, but only when backing up another object such as the database. For example, you can run this command:

BACKUP DEVICE TYPE sbt DATABASE PLUS ARCHIVELOG;

Note:

If backup optimization is enabled, then RMAN skips backups of archived logs that have already been backed up to the allocated device.


See Also:

Multiplexed Backup Sets

The technique of RMAN multiplexing is to simultaneously read files on disks and and then write them into the same backup piece. For example, RMAN can read from two datafiles simultaneously, and then combine the blocks from these datafiles into a single backup piece. Note that multiplexing in this sense is completely different from duplexing.

As Figure 5-3 illustrates, RMAN can back up three datafiles into a backup set that contains only one backup piece. This backup piece contains the intermingled data blocks of the three input files.

Figure 5-3 Datafile Multiplexing

Text description of sbr81053.gif follows
Text description of the illustration sbr81053.gif


Multiplexing is affected by the factors described in Table 5-1.

Table 5-1 RMAN Multiplexing
Concepts Definition

Number of files in each backup set

The minimum of these values: FILESPERSET setting, and the number of files read by each channel.

Multiplexing

The minimum of these values: MAXOPENFILES setting, and the number of files in each backup set.

The FILESPERSET parameter determines how many datafiles should be included in each backup set, while MAXOPENFILES defines how many datafiles RMAN can read from simultaneously.

Assume that you are backing up six datafiles with one RMAN channel. If FILESPERSET is 6 and MAXOPENFILES is 1, then the channel includes 6 datafiles in a set but does not multiplex the files because RMAN is not reading from more than one file simultaneously. The channel reads one file at a time and writes to the backup piece. In this case, the degree of multiplexing is 1.

Now, assume that FILESPERSET is 6 and MAXOPENFILES is 3. In this case, the channel can read and write in the following order:

  1. Read from datafiles 1, 2, and 3 simultaneously and write to the backup piece
  2. Read from datafiles 4, 5 and 6 simultaneously and write to the backup piece

So in this example, the degree of multiplexing is 3 (the lesser of 6 and 3).

When multiplexing files, you can do the following:

Note that multiplexing too many files can decrease restore performance. If possible, group files that will be restored together into the same backup set. Assume that RMAN backs up seventeen files with FILESPERSET = 64 and MAXOPENFILES = 16. You decide to restore data17.f, which is datafile 17. So, RMAN reads the multiplexed data for the first sixteen files and then starts reading the data for data17.f. In this case, moving to the beginning of the backup of data17.f may take more time than the restore itself.

See Also:

Duplexed Backup Sets

RMAN provides an efficient way to produce multiple copies of each backup piece in a backup set. This functionality is also known as duplexing a backup set.

You can create up to four identical copies of each piece in a backup set by issuing one of the following commands, listed in order of precedence. If multiple commands are in effect simultaneously, then commands higher on the list override commands that are lower on the list.

Command Command Restriction Object Restriction

BACKUP COPIES

Only BACKUP command on which COPIES is specified

Any object specified on BACKUP command

SET BACKUP COPIES

All BACKUP commands within RUN block

Any object specified on BACKUP command

CONFIGURE ... BACKUP COPIES

All BACKUP commands

Only datafiles, control files, server parameter files, and archived logs


Note:

Control file autobackups on disk are a special case and are never duplexed: RMAN always writes one and only one copy.


You can specify up to 4 values for the FORMAT option. RMAN uses the second, third, and fourth values only when BACKUP COPIES, SET BACKUP COPIES, or CONFIGURE ... BACKUP COPIES is specified. This example creates 3 copies of the backup of datafile 7:

BACKUP DEVICE TYPE DISK COPIES 3 DATAFILE 7 FORMAT '/tmp/%U','?/oradata/%U','?/%U';

RMAN places the first copy of each backup piece in /tmp, the second in ?/oradata, and the third in the Oracle home. Note that RMAN does not produce 3 backup sets, each with a different unique backup set key. Rather, RMAN produces one backup set with a unique key, and generates 3 identical copies of each backup piece in the set, as shown in this sample LIST output:

List of Backup Sets
===================

BS Key  Type LV Size
------- ---- -- ----------
1       Full    64K
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  7       Full 98410      08-FEB-02 /oracle/oradata/trgt/tools01.dbf

  Backup Set Copy #1 of backup set 1
  Device Type Elapsed Time Completion Time Tag
  ----------- ------------ --------------- ---
  DISK        00:00:01     08-FEB-02       TAG20020208T152314

    List of Backup Pieces for backup set 1 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    1       1   AVAILABLE   /tmp/01dg9tb2_1_1

  Backup Set Copy #2 of backup set 1
  Device Type Elapsed Time Completion Time Tag
  ----------- ------------ --------------- ---
  DISK        00:00:01     08-FEB-02       TAG20020208T152314

    List of Backup Pieces for backup set 1 Copy #2
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    2       1   AVAILABLE   /oracle/oradata/01dg9tb2_1_2

  Backup Set Copy #3 of backup set 1
  Device Type Elapsed Time Completion Time Tag
  ----------- ------------ --------------- ---
  DISK        00:00:01     08-FEB-02       TAG20020208T152314

    List of Backup Pieces for backup set 1 Copy #3
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    3       1   AVAILABLE   /oracle/01dg9tb2_1_3

When choosing which FORMAT value to use for each backup piece, RMAN uses the first format value for copy number 1, the second format value for copy number 2, and so forth. 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.

See Also:

Parallelization of Backups

When you configure PARALLELISM to greater than 1 or manually allocate multiple channels, RMAN writes multiple backup sets in parallel. The server sessions divide the work of backing up the specified files.


Note:

You cannot stripe a backup set across multiple channels.


By default, RMAN determines which channels should back up which database files. You can use the BACKUP ... CHANNEL command to manually assign a channel to back up specified files. You can also use the FILESPERSET parameter to limit the number of datafiles included in a backup set. This example shows a parallelized backup to disk that uses the default automatic DISK channels:

BACKUP
  (DATAFILE 1,2,3 
   FILESPERSET = 1
   CHANNEL ORA_DISK_1)
  (DATAFILECOPY '/tmp/system01.dbf', '/tmp/tools01.dbf'
   FILESPERSET = 2
   CHANNEL ORA_DISK_2)
  (ARCHIVELOG FROM SEQUENCE 100 UNTIL SEQUENCE 102 THREAD 1 
   FILESPERSET = 3
   CHANNEL ORA_DISK_3);

You can also manually allocate channels as in the following example:

RUN 
{
  ALLOCATE CHANNEL c1 DEVICE TYPE sbt PARMS="ENV=(BACKUP_SERVER=tape_server1)";
  ALLOCATE CHANNEL c2 DEVICE TYPE sbt PARMS="ENV=(BACKUP_SERVER=tape_server2)";
  ALLOCATE CHANNEL c3 DEVICE TYPE sbt PARMS="ENV=(BACKUP_SERVER=tape_server3)";
  BACKUP
   (DATAFILE 1,2,3
    FILESPERSET = 1
    CHANNEL c1)
   (DATAFILECOPY '/tmp/system01.dbf', '/tmp/tools01.dbf'
     FILESPERSET = 2
     CHANNEL c2)
   (ARCHIVELOG FROM SEQUENCE 100 UNTIL SEQUENCE 102 THREAD 1
     FILESPERSET = 3
     CHANNEL c3);
}

Figure 5-4 shows an example of parallelization in which channel ch1 backs up datafiles, channel ch2 backs up datafile copies, and channel ch3 backs up logs.

Figure 5-4 Parallelization of Backups

Text description of sbr81074.gif follows
Text description of the illustration sbr81074.gif


See Also:

Backups of Backup Sets

The RMAN BACKUP BACKUPSET command backs up backup sets rather than actual database files. This command supports disk-to-disk or disk-to-tape backups, but not tape-to-tape backups.

The BACKUP BACKUPSET command uses the default disk channel to copy backup sets from disk to disk. To back up from disk to tape, you must either manually allocate a channel of DEVICE TYPE sbt or configure an automatic sbt channel.

Uses for Backups of Backup Sets

The BACKUP BACKUPSET command is a useful way to spread backups among multiple media. For example, you can execute the following BACKUP command weekly as part of the production backup schedule:

BACKUP DEVICE TYPE sbt BACKUPSET ALL; 

Note:

Backups to the sbt device that use automatic channels require that you first run the CONFIGURE DEVICE TYPE sbt command.


In this way, you ensure that all your backups exist on both disk and tape. Note that you can also duplex backups of backup sets (except for control file autobackups, which are never duplexed by BACKUP BACKUPSET), as in this example:

BACKUP COPIES 2 DEVICE TYPE sbt BACKUPSET ALL;

You can also use BACKUP BACKUPSET to manage backup space allocation. For example, assume that you want more recent backups to exist on disk and older backups to exist on tape, but you do not need backups to exist on both disk and tape at the same time. In this case, you can regularly run the following command:

BACKUP BACKUPSET COMPLETED BEFORE 'SYSDATE-7' DELETE INPUT;

This command backs up backup sets that were created more than a week ago from disk to tape, and then deletes the backup sets from disk. Note that DELETE INPUT here is equivalent to DELETE ALL INPUT: RMAN deletes all existing copies of the backup set. If you duplexed a backup to four locations, then RMAN deletes all four copies of the pieces in the backup set.

Backup Optimization When Backing Up Backup Sets

Note that if backup optimization is enabled when you issue the command to back up a backup set, and the identical backup set has already been backed up to the same device type, then RMAN skips the backup of that backup set. For example, the following command backs up to tape all backup sets that do not already exist on device type sbt:

BACKUP DEVICE TYPE sbt BACKUPSET ALL;

Backup Failover When Backing Up Backup Sets

When backing up backup sets, RMAN searches for all available backup copies when the copy that it is trying to back up is either corrupted or missing. This behavior is similar to the behavior of RMAN when backing up archived redo logs that exist in multiple archiving destinations.

For example, assume that backup set 123 contains three backup pieces, and that BACKUP COPIES 3 was issued so that three copies of each backup piece exist. Each copy of a backup piece is on a different file system. The following table indicates that some of the copies of the pieces are corrupted or missing, while others are intact.

Backup Piece Number Copy Number of the Piece Status of Copy

1

1

Corrupted

1

2

Intact

1

3

Corrupted

2

1

Missing

2

2

Corrupted

2

3

Intact

3

1

Intact

3

2

Corrupted

3

3

Missing

Assume that you run the following command:

BACKUP BACKUPSET 123;

RMAN performs an automatic failover and includes only the uncorrupted copies in its backup set. The following table indicates which copies RMAN includes.

Backup Piece Number Copy Number of the Piece Status of Copy

1

2

Intact

2

3

Intact

3

1

Intact

See Also:

"Duplexed Backup Sets", and "Backup Optimization"

Backup Options: Naming, Sizing, and Speed

Recovery Manager provides a number of options to control backups.

This section contains these topics:

Filenames for Backup Pieces

You can either let RMAN determine a unique name for backup pieces or use the FORMAT parameter to specify a name. If you do not specify a filename, then RMAN uses the %U substitution variable to generate a unique name. For example, enter:

BACKUP TABLESPACE users;

RMAN automatically generates unique names for the backup pieces.

The FORMAT parameter provides substitution variables that you can use to generate unique filenames. For example, you can run a command as follows:

BACKUP TABLESPACE users FORMAT = '/tmp/users_%u%p%c';

As described in "Duplexed Backup Sets", you can specify up to four FORMAT values. RMAN uses the second, third, and fourth values only when you run BACKUP COPIES, SET BACKUP COPIES, or CONFIGURE ... BACKUP COPIES.


Note:

If you use a media manager, check your vendor documentation for restrictions on FORMAT such as the size of the name, the naming conventions, and so forth.


See Also:

Oracle9i Recovery Manager Reference for descriptions of the FORMAT parameter and the substitution variables

Size of Backup Pieces

Each backup set contains at least one backup piece. If you do not restrict the backup piece size, then every backup set contains only one backup piece. To restrict the size of each backup piece, specify the MAXPIECESIZE option of the CONFIGURE CHANNEL or ALLOCATE CHANNEL commands. This option limits backup piece size to the specified number of bytes.

For example, restrict the backup piece size for disk backups to 2 GB by configuring an automatic disk channel, and then run a backup as follows:

CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE = 2G;
BACKUP DATAFILE 1;

A LIST BACKUP command reveals that RMAN created five backup pieces rather than one backup piece to conform to the MAXPIECESIZE size restriction:

BS Key  Type LV Size       Device Type Elapsed Time Completion Time     
------- ---- -- ---------- ----------- ------------ --------------------
29      Full    9728M      DISK        00:00:35     NOV 02 2001 18:29:26
  List of Datafiles in backup set 29
  File LV Type Ckp SCN    Ckp Time             Name
  ---- -- ---- ---------- -------------------- ----
  1       Full 177590     NOV 02 2001 18:28:51 /oracle/oradata/trgt/system01.dbf

  Backup Set Copy #1 of backup set 29
  Device Type Elapsed Time Completion Time      Tag
  ----------- ------------ -------------------- ---
  DISK        00:00:35     NOV 02 2001 18:29:26 TAG20011102T152701

    List of Backup Pieces for backup set 29 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    53      1   AVAILABLE   /oracle/dbs/10d85733_1_1
    54      2   AVAILABLE   /oracle/dbs/10d85733_2_1
    55      3   AVAILABLE   /oracle/dbs/10d85733_3_1
    56      4   AVAILABLE   /oracle/dbs/10d85733_4_1
    57      5   AVAILABLE   /oracle/dbs/10d85733_5_1
See Also:

Number and Size of Backup Sets: Basic Algorithm

Use the backupSpec clause of the BACKUP command to specify the objects that you want to back up as well as specify other options. Each backupSpec clause produces at least one backup set. The total number and size of backup sets depends on which algorithm RMAN uses: the basic algorithm or the advanced algorithm.

RMAN uses the basic algorithm when any of the following conditions is true:

If all of these conditions are false, then RMAN uses the advanced algorithm described in "Number and Size of Backup Sets: Advanced Algorithm". Note that you can always force RMAN to use the basic algorithm by setting DISKRATIO=0.

Factors Affecting the Number and Size of Backup Sets

In determining the characteristics of the RMAN backup sets, the basic algorithm is influenced by the following factors:

The most important rules in the algorithm for backup set creation are:

Using the FILESPERSET Parameter

The FILESPERSET parameter limits the number of files (control files, datafiles, or archived logs) that can go in a backup set. The default value is calculated by RMAN as follows: RMAN compares the value 64 to the rounded-up ratio of number of files divided by the number of channels, and sets FILESPERSET to the lower value. For example, if you back up 70 files with one channel, then RMAN takes 70 divided by÷ 1, compares 70 to 64, and sets FILESPERSET to 64 because it is lower.

The number of backup sets produced by RMAN is the rounded-up ratio of number of datafiles divided by FILESPERSET. For example, if you back up 70 datafiles and FILESPERSET is 64, then RMAN produces 2 backup sets.

RMAN tries to make backup sets roughly the same size as the ratio of total number of blocks divided by total number of sets. The total number of blocks in a backup is equal to the number of blocks in each file that is backed up. For example, if you back up 70 files that each contain 50 blocks, and the number of sets is 2, then RMAN attempts to make each backup set about 3500/2 = 1750 blocks.

Using the Default Value for FILESPERSET: Example

Assume the following example in which RMAN backs up eight files with three channels. Because FILESPERSET is not specified, RMAN compares 64 to 3 (8 divided by÷ 3 and rounded up) and sets FILESPERSET to 3. RMAN creates three backup sets and groups the files into the sets so that each set is approximately the same size. An example of the RMAN LIST output follows:

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6       Full    320K       DISK        00:00:05     08-FEB-02      
        BP Key: 17   Status: AVAILABLE   Tag: TAG20020208T153359
        Piece Name: /oracle/dbs/06dg9tv9_1_1
  List of Datafiles in backup set 6
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  3       Full 98410      08-FEB-02 /oracle/oradata/trgt/cwmlite01.dbf
  4       Full 98410      08-FEB-02 /oracle/oradata/trgt/drsys01.dbf
  6       Full 98410      08-FEB-02 /oracle/oradata/trgt/indx01.dbf
  8       Full 98410      08-FEB-02 /oracle/oradata/trgt/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
7       Full    312K       DISK        00:00:07     08-FEB-02      
        BP Key: 18   Status: AVAILABLE   Tag: TAG20020208T153359
        Piece Name: /oracle/dbs/07dg9tv9_1_1
  List of Datafiles in backup set 7
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 98410      08-FEB-02 /oracle/oradata/trgt/undotbs01.dbf
  5       Full 98410      08-FEB-02 /oracle/oradata/trgt/example01.dbf
  7       Full 98410      08-FEB-02 /oracle/oradata/trgt/tools01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8       Full    196M       DISK        00:00:36     08-FEB-02      
        BP Key: 19   Status: AVAILABLE   Tag: TAG20020208T153359
        Piece Name: /oracle/dbs/08dg9tv9_1_1
  SPFILE Included: Modification time: 08-FEB-02
  List of Datafiles in backup set 8
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 98410      08-FEB-02 /oracle/oradata/trgt/system01.dbf
Specifying FILESPERSET: Example

If you back up eight datafiles with three channels and specify FILESPERSET = 2, then RMAN places no more than two datafiles in each backup set. Consequently, RMAN creates at least four (8 divided by 2) backup sets: it may create more depending on the sizes of the datafiles as well as other factors. An example of the RMAN LIST output follows:

RMAN> list backup;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
9       Full    144K       DISK        00:00:03     08-FEB-02      
        BP Key: 20   Status: AVAILABLE   Tag: TAG20020208T153550
        Piece Name: /oracle/dbs/0adg9u2n_1_1
  List of Datafiles in backup set 9
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  4       Full 98410      08-FEB-02 /oracle/oradata/trgt/drsys01.dbf
  7       Full 98410      08-FEB-02 /oracle/oradata/trgt/tools01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
10      Full    144K       DISK        00:00:04     08-FEB-02      
        BP Key: 21   Status: AVAILABLE   Tag: TAG20020208T153550
        Piece Name: /oracle/dbs/0bdg9u2n_1_1
  List of Datafiles in backup set 10
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  5       Full 98410      08-FEB-02 /oracle/oradata/trgt/example01.dbf
  8       Full 98410      08-FEB-02 /oracle/oradata/trgt/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
11      Full    144K       DISK        00:00:06     08-FEB-02      
        BP Key: 22   Status: AVAILABLE   Tag: TAG20020208T153550
        Piece Name: /oracle/dbs/09dg9u2n_1_1
  List of Datafiles in backup set 11
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  3       Full 98410      08-FEB-02 /oracle/oradata/trgt/cwmlite01.dbf
  6       Full 98410      08-FEB-02 /oracle/oradata/trgt/indx01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12      Full    152K       DISK        00:00:02     08-FEB-02      
        BP Key: 23   Status: AVAILABLE   Tag: TAG20020208T153550
        Piece Name: /oracle/dbs/0cdg9u2r_1_1
  List of Datafiles in backup set 12
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 98410      08-FEB-02 /oracle/oradata/trgt/undotbs01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    196M       DISK        00:00:31     08-FEB-02      
        BP Key: 24   Status: AVAILABLE   Tag: TAG20020208T153550
        Piece Name: /oracle/dbs/0ddg9u2t_1_1
  SPFILE Included: Modification time: 08-FEB-02
  List of Datafiles in backup set 13
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 98410      08-FEB-02 /oracle/oradata/trgt/system01.dbf

For datafile or datafile copy backups, group multiple datafiles into a single backup set to the extent necessary to keep an output tape device streaming, or to prevent the backup from consuming too much bandwidth from a particular datafile.

The fewer the files contained in a backup set, the faster one of them can be restored, because there is less data belonging to other datafiles that must be skipped. For backup sets containing archived logs, group logs from the same time period into a backup set because they will probably need to be restored at the same time.

See Also:

Oracle9i Recovery Manager Reference to learn the syntax for the backupSpec clause, and Chapter 14, "Tuning Recovery Manager" to learn about RMAN buffer management

Using the MAXSETSIZE Parameter

Each channel produces at least one backup set. To specify the maximum size of the backup set, use the MAXSETSIZE parameter in the CONFIGURE or BACKUP command. By limiting the overall size of the backup set, the parameter indirectly limits the number of files in the set and can possibly force RMAN to create additional backup sets.

You can use the MAXSETSIZE parameter to restrict the total size of a backup set to the maximum file size supported by your media manager or operating system. In this way, you do not cause either disk backups to fail because of space restrictions or tape backups to span multiple volumes.

Relationship Between MAXSETSIZE and FILESPERSET

The following table compares the MAXSETSIZE parameter to the FILESPERSET parameter.

Parameter Meaning You decide ... RMAN decides ...

MAXSETSIZE

Sets the maximum size in bytes of the backup set without specifying a limit to the number of files in the set.

The maximum size of the backup set.

How many files to put in each set to keep the parameter restriction.

FILESPERSET

Sets a limit to the number of files in the backup set without specifying a maximum size in bytes of the set.

The maximum number of files to include in the backup set.

What size to make the backup sets to keep the parameter restriction.

Because FILESPERSET has a default value, if you set MAXSETSIZE then you must also account for the behavior of FILESPERSET. When both parameters are in use:

Specifying MAXSETSIZE: Example

Assume that you want to back up 50 datafiles, each containing 1000 blocks. To set a maximum backup set size for a database backup to 10 MB, you issue the following command:

BACKUP DATABASE MAXSETSIZE = 10M;

Because you did not set FILESPERSET, RMAN calculates the default value for you, comparing 64 to 50/2 and setting FILESPERSET = 25. RMAN compares the following values and chooses the higher value:

Consequently, RMAN attempts to make five backup sets, with each backup set containing no more than 25 files and totalling no more than 10 MB in size.

Note that if you set MAXSETSIZE to a value smaller than the size of the largest input file, you receive the RMAN-06183 error:

RMAN-06183: datafile or datafilecopy larger than MAXSETSIZE: file# 1 
            /oracle/oradata/trgt/system01.dbf
See Also:

Oracle9i Recovery Manager Reference for information on the MAXSETSIZE parameter

Number and Size of Backup Sets: Advanced Algorithm

The advanced algorithm determines the number and size of backup sets by using the same factors described in "Number and Size of Backup Sets: Basic Algorithm". The difference is that the advanced algorithm is also influenced by the DISKRATIO parameter. If DISKRATIO=n, then each backup set must read data from at least n disk drives. RMAN uses file location information obtained from the database server to determine which datafiles are on which disk drives.

If you set FILESPERSET but not DISKRATIO, th