Oracle® Database Backup and Recovery Advanced User's Guide 10g Release 2 (10.2) Part Number B14191-01 |
|
|
View PDF |
Recovery Manager provides a number of options to control filenames, sizes of backups and speed during backup.
You can either let RMAN determine a unique name for backup pieces or use the FORMAT
parameter to specify a name. For example, enter:
BACKUP TABLESPACE users;
RMAN automatically generates unique names for the backup pieces in the default backup location.
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 "Manual Parallelization of Backups", 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, then check your vendor documentation for restrictions onFORMAT such as the size of the name, the naming conventions, and so forth. |
See Also: Oracle Database Backup and Recovery Reference for descriptions of theFORMAT parameter and the substitution variables |
FORMAT
variables are also used to specify the names of image copies. The default format %U
is defined differently for image copies than for backup pieces. RMAN produces image copies of three types of files: datafiles, control files, and archived logs. The following table describes the meaning of %U
for each type of file.
Type of File | Meaning of %U |
---|---|
Datafile | data-D-%d_id-%I_TS-%N_FNO-%f_%u |
Archived log | arch-D_%d-id-%I_S-%e_T-%h_A-%a_%u |
Control file | cf-D_%d-id-%I_%u |
When creating image copies (and only image copies), you can also name the output copies with the DB_FILE_NAME_CONVERT
option of the BACKUP
command. This parameter works identically to the initialization parameter DB_FILE_NAME_CONVERT
. Pairs of filename prefixes are provided to change the names of the output files. If a file is not converted by any of the pairs, then RMAN uses the FORMAT
specification; if no FORMAT
is specified, then RMAN uses the default format %U
.
For example, you can run the following command to copy the datafiles whose filename is prefixed with /maindisk/oradata/users
so that they are prefixed with /backups/users_ts
:
BACKUP AS COPY TABLESPACE users DB_FILE_NAME_CONVERT=('/maindisk/oradata/users','/backups/users_ts');
You can assign a user-specified character string called a tag to backup sets and image copies (either copies created by RMAN or copies created by an operating system utility). A tag is a symbolic name for a backup set or file copy, such as weekly_backup
. You can specify the tag rather than the filename when executing the RESTORE
or CHANGE
command. The maximum length of a tag is 30 bytes.
If you do not specify a tag, then RMAN creates a default tag for backups (except for control file autobackups) in the format TAG
YYYYMMDD
T
HHMMSS
, where YYYY
is the year, MM
is the month, DD
is the day, HH
is the hour (in 24-hour format), MM
is the minutes, and SS
is the seconds. For example, a backup of datafile 1
may receive the tag TAG20030208T133437
. The date and time refer to when RMAN started the backup, in the time zone of the instance performing the backup. If multiple backup sets are created by one BACKUP
command, then each backup piece is assigned the same default tag.
When applied to a backup set, a tag applies to a specific copy of the backup set. If you do not duplex a backup set, that is, make multiple identical copies of it, then the backup set has just one tag. For example,
BACKUP COPIES 1 DATAFILE 7 TAG foo;
creates one backup set with tag FOO
. Tags are stored in uppercase, regardless of the case used when entering them. However, you can back up this backup set and give this new copy of the backup set the tag BAR
. So, the backup set has two identical copies: one tagged FOO
and the other tagged BAR
.
When applied to image copies, a tag applies to each individual image copy. For example, you run the following command:
# Back up as image copies the datafiles of tablespaces users and tools # all copies get the TAG 'users_tools' BACKUP AS COPY TAG users_tools TABLESPACE users, tools;
You can also copy an image copy with a specific tag, and give the output copy a different tag, as in the following example:
# Create new copies of all image copies of the database that have the tag # 'full_cold_copy', and give the new copies the tag 'new_full_cold_copy' BACKUP AS COPY COPY OF DATABASE FROM TAG=full_cold_copy TAG=new_full_cold_copy; # Create backup sets of the image copy of tablespace users that has the tag # 'monday_users', and of tablespace SYSTEM which has the tag 'monday_system'. # All these new backup # sets receive the tag 'for_audit'. BACKUP AS BACKUPSET TAG for_audit COPY OF TABLESPACE users FROM TAG monday_users TABLESPACE SYSTEM FROM TAG monday_system;
Tags do not need to be unique, so multiple backup sets or image copies can have the same tag, for example, weekly_backup
. When you specify that a datafile should be restored from backups that have a specific tag, and more than one backup of the requested file has the desired tag, RMAN restores the most recent backup that has the desired tag (within any other constraints of the restore command, of course, such as a point in time).
Tags can indicate the intended purpose or usage of different classes of backups or copies. For example, you can tag datafile copies that you intend to use in a SWITCH
differently (for_switch_only
) from file copies that should be used only for RESTORE
(for_restore_only
).
Note: If you specify theFROM tag option to the RESTORE or SWITCH command, then RMAN considers only backup sets and image copies with a matching tag when choosing which backup to use |
See Also: Oracle Database Backup and Recovery Reference forSWITCH syntax, and Oracle Database Backup and Recovery Reference for RESTORE syntax |
RMAN will, by default, put the entire contents of a backup set into one backup piece, regardless of the size of the backup set. If you are backing up to a file system or media manager that has a limit on the maximum file size that can be created, then you may need to restrict the size of backup pieces that RMAN will create.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 umber of bytes. If the total size of the backup set is greater than the specified backup piece size, then multiple physical pieces will be created to hold the backup set contents.
For example, if datafile 1 is 6GB, you can still 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 AS BACKUPSET 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 2002 18:29:26 List of Datafiles in backup set 29 File LV Type Ckp SCN Ckp Time Name ---- -- ---- ---------- -------------------- ---- 1 Full 177590 NOV 02 2002 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 2002 18:29:26 TAG20021102T152701 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
This option can be used for media managers that cannot manage a backup piece that spans more than one tape. For example, if a tape can hold 10GB, but the backup set being created must hold 80GB of data, then RMAN must be instructed to create backup pieces of 10GB, small enough to fit on the tapes used with the media manager. The backup set media will in this case consist of eight tapes. Media managers supporting SBT2.0 can return a value to RMAN indicating the largest supported backup piece size, which RMAN will use in planning backup activities.
See Also:
|
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 for the most part on an internal RMAN algorithm, although you can tune RMAN behavior to a certain extent with the MAXSETSIZE
parameter.
In determining the characteristics of the RMAN backup sets, the internal algorithm is influenced by the following factors:
The number of input files specified in each backupSpec
clause
The number of channels that you allocate
The default number of files in each backup set (4 for datafiles and 16 for archived logs)
The default number of files read simultaneously by a single channel (8)
The MAXSETSIZE
parameter (specified on the CONFIGURE
and BACKUP
commands), which specifies a maximum backup set size
The most important rules in the algorithm for backup set creation are:
Each allocated channel that performs work in the backup job—that is, each channel that is not idle—generates at least one backup set.
Note: RMAN writes backup pieces sequentially; striping a backup piece across multiple output devices is not supported. For example, RMAN does not simultaneously write half of a backup piece to one device and the other half to another device, nor can it write the first piece of a backup set to one device andthe second piece to another device. |
RMAN always tries to divide the backup load so that all allocated channels have roughly the same amount of work to do.
The default number of datafiles in each backup set is determined by an internal RMAN limit (16 for archived logs, 4 for datafiles).
The number of datafiles multiplexed in a backup set is limited by the lesser of the number of files in each backup set and the default number of files read by a single channel simultaneously (8).
The maximum size of a backup set is determined by the MAXSETSIZE
parameter of the CONFIGURE
or BACKUP
command.
See Also: Oracle Database Backup and Recovery Reference to learn the syntax for thebackupSpec clause, and Chapter 11, "Tuning Backup and Recovery" to learn about RMAN buffer management |
To specify the maximum size of each 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.
Assume that you want to back up 50 datafiles, each containing 1000 blocks. To set the maximum size of each backup set to 10 MB, use the following command:
BACKUP DATABASE MAXSETSIZE = 10M;
Caution: If a datafile being backed up is bigger thanMAXSETSIZE then your backup will fail. Always ensure that MAXSETSIZE is as large as your largest datafile. |
By default, RMAN uses all available I/O bandwidth to read/write to disk. You can limit the I/O resources consumed by a backup job with the RATE
option of the ALLOCATE
CHANNEL
or CONFIGURE
CHANNEL
commands. The RATE
option specifies the maximum number of bytes for each second that RMAN reads on the channel.
For example, you can configure automatic channels to limit each channel to read 1 MB a second:
CONFIGURE DEVICE TYPE sbt PARALLELISM 2; CONFIGURE DEFAULT DEVICE TYPE TO sbt; CONFIGURE CHANNEL DEVICE TYPE sbt RATE 1M;
In effect, the RATE
option throttles RMAN so that a backup job does not consume excessive I/O bandwidth on the computer.
See Also: "Tuning RMAN Backup Performance: Procedure" for tips about how to optimize RMAN performance |