Oracle8i Backup and Recovery Guide
Release 8.1.5

A67773-01

Library

Product

Contents

Index

Prev Prev Next


backup

Syntax


backupSpec::=

Purpose

To back up a database, tablespace, datafile, control file, or archived redo log file. When performing a backup, specify the files that you want to back up. RMAN puts the input files into a backup set, which is an RMAN-specific logical structure. Each backup set contains at least one backup piece. You can also use the backup command to generate a proxy copy, which is a backup created by a media manager.

You control the number of backup sets that Oracle produces as well as the number of input files that RMAN places into a single backup set. Any I/O errors when reading files or writing backup pieces cause Oracle to abort the jobs.

See Also: To learn how to back up files, see Chapter 8, "Making Backups and Copies with Recovery Manager".

Requirements

When using the backup command you must:

You cannot do the following:

Keywords and Parameters

full  

copies all blocks into the backup set, skipping only datafile blocks that have never been used. RMAN makes full backups by default if neither full nor incremental is specified. The server session does not skip blocks when backing up archived redo logs or control files.

A full backup has no effect on subsequent incremental backups, so it is not considered a part of the incremental backup strategy.  

incremental level integer  

copies only those data blocks that have changed since the last incremental n backup, where n is any integer from 1 to 4. For example, in a level 2 backup RMAN backs up all blocks used since the most recent level2, level 1, or level 0 backup.

This type of incremental backup is also called a differential backup to distinguish it from a cumulative backup. An incremental backup at level 0 is identical in content to a full backup, but unlike a full backup the level 0 backup is considered a part of the incremental strategy.

Oracle performs checks when attempting to create an incremental backup at a level greater than 0. These checks ensure that the incremental backup will be usable by a subsequent recover command. Among the checks performed are:

  • A level 0 backup set must exist, or level 0 datafile copies must exist for each datafile in the backup command. These backup sets must not be marked unavailable (see "change").

  • Sufficient incremental backups taken since the level 0 must exist and be available such that the incremental backup to be created is usable.

If you specify incremental, then in the backupSpec you must set one of the following parameters: datafile, datafilecopy, tablespace, or database. RMAN does not support incremental backups of control files, archived redo logs, or backup sets.  

parms 'channel_parms'  

specifies a quoted string containing O/S-specific information. RMAN passes the string to the OSD layer each time a backup piece is created.  

cumulative  

copies the data blocks used since the most recent backup at level n-1 or lower. For example, in a cumulative level 2 backup RMAN backs up all blocks used since the most recent level 1 or level 0 backup.  

nochecksum  

suppresses block checksums. A checksum is a number that is computed from the contents of a data block. If the DB_BLOCK_CHECKSUM initialization parameter is TRUE, Oracle computes a checksum for each block and stores it in the block before writing the block to disk. When Oracle reads the block from disk later, it makes sure that the block generates the same checksum. If it does not, then the block is damaged.

Unless you specify the nochecksum option, Oracle computes a checksum for each block and stores it in the backup. The checksum is verified when restoring from the backup and also written to the datafile when restored. If the database is already maintaining block checksums, then this flag has no effect. The checksum is always verified and stored in the backup in this case.

See Also: For more information about the DB_BLOCK_CHECKSUM initialization parameter, see the Oracle8i Reference.  

filesperset integer  

specifies the maximum number of input files to place in one backup set.

RMAN divides the total number of files requiring backups by the number of allocated channels to calculate the number of files to place in each backup set. When you specify the filesperset parameter, RMAN compares the filesperset value to this calculated value and takes the lowest of the two, thereby ensuring that all channels are used. If the number of files specified or implied by the combined backupSpec clauses is greater than filesperset, e.g., 8 files need backing up when filesperset = 4, RMAN creates multiple backup sets to maintain the correct ratio of files per backup set.

If you do not specify filesperset, then RMAN compares the calculated value (number of files / allocated channels) to the default value of 64 and takes the lowest of the two, again ensuring that all channels are used. The default value of 64 is high for most applications: specify a lower value or use the setsize parameter to limit the size of a backup set.

RMAN always attempts to create enough backup sets so that all allocated channels have work to do. An exception to the rule occurs when there are more channels than files to back up. For example, if RMAN backs up one datafile when three channels are allocated and filesperset = 1, then two channels are necessarily idle.

Note: The setsize parameter is often easier to use than filesperset when you make archivelog backups and for datafile backups when the datafiles are striped or they reside on separate disk spindles.If both parameters are specified, both take effect. RMAN attempts to size the backup sets according to the setsize parameter, treating filesperset as an upper limit.  

format 'format_string'  

specifies the filename to use for the backup piece. Any name that is legal as a sequential filename on the platform is allowed, provided that each backup piece has a unique name. If backing up to disk, then any legal disk filename is allowed, provided it is unique. If you do not specify the format parameter, RMAN stores the backup pieces in a port-specific directory ($ORACLE_HOME/dbs on UNIX).

Specify the format parameter in any of these places:

  • The backupSpec clause

  • The backup command

  • The allocate channel command

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

The following substitution variables are available in format strings to aid in generating unique filenames:  

 

%c  

specifies the copy number of the backup piece within a set of duplexed backup pieces. If you did not issue the set duplex command, then this variable will be 1 for regular backup sets and 0 for proxy copies. If you issued set duplex, the variable identifies the copy number: 1, 2, 3, or 4.  

 

%p  

specifies the backup 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.  

 

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

 

%d  

specifies the database name.  

 

%n  

specifies the database name, padded on the right with 'x' characters to a total length of 8 characters. For example, if PROD1 is the database name, then PROD1xxx is the padded database name.  

 

%t  

specifies the backup set timestamp, 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.  

 

%u  

specifies an 8-character name constituted by compressed representations of the backup set number and the time the backup set was created.  

 

%U  

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

channel channel_id  

specifies the name of a channel to use when creating the backup sets. Use any name that is meaningful, e.g., ch1 or dev1. Oracle uses the channel id with the release channel command and to report I/O errors. If you do not specify this parameter, then RMAN dynamically assigns the backup sets to any available channels during job execution.

Note: You can also specify this parameter in the backupSpec clause.  

skip  

excludes datafiles or archived redo logs from the backup set.

Note: You can also specify this option in the backupSpec clause.  

 

offline  

specifies that offline datafiles should be excluded from the backup set.  

 

readonly  

specifies that read-only datafiles should be excluded from the backup set.  

 

inaccessible  

specifies that datafiles or archived redo logs that cannot be read due to I/O errors should be excluded from the backup set.

Note that a datafile is only considered inaccessible if it cannot be read. Some offline datafiles can still be read because they still exist on disk. Others have been deleted or moved and so cannot be read, making them inaccessible.  

tag tag_name  

creates a user-specified tag for the backup set. Typically, a tag is a meaningful name such as monday_evening_backup or weekly_full_backup. Tags must be 30 characters or less. Note that tags are reusable, so that backup set 100 can have the tag monday_evening_backup one week while backup set 105 has the same tag the next week.

You can also specify the tag at the backupSpec level. If you specify the tag at:

  • The command level, then all backup sets created by this command are given this tag.

  • The backupSpec level, then backup sets created as a result of different backup specifications can have different tags.

  • Both levels, then the tag in the backupSpec takes precedence.

Note: You cannot automatically assign a different tag name to each backup. The easiest way to give each backup a new tag is to write a backup script and then edit it with an O/S utility before each execution.  

setsize integer  

specifies a maximum size for a backup set in units of 1K (1024 bytes). Thus, to limit a backup set to 3Mb, specify setsize = 3000. RMAN attempts to limit all backup sets to this size, which is useful in media manager configurations when you want each backup set no larger than one tape.

The setsize parameter is easier to use than filesperset when you make archived redo log backups. You should configure your backup sets so that they fit on one tape volume rather than span multiple tape volumes. Otherwise, if one tape of a multi-volume backup set fails, then you lose the data on all the tapes rather than just one.

Note: If both setsize and filesperset are specified, both take effect. RMAN attempts to set the size of the backup sets according to the setsize parameter, treating filesperset as an upper limit.  

diskratio integer  

directs RMAN to assign datafiles (and only datafiles) to backup sets spread across the specified number of drives. For example, assume that your system uses 10 disks, the disks supply data at 10 bytes/second, and the tape drive requires 50 bytes/second to keep streaming. In this case, set diskratio equal to 5 to spread the backup load across 5 disks.

The diskratio parameter is also easier for datafile backups when your datafiles are striped or reside on separate disk spindles and you either:

  • Use a high-bandwidth tape drive that requires several datafiles to be multiplexed in order to keep the tape drive streaming.

  • Make backups while the database is open and you want to spread the I/O load across several disk spindles in order to leave bandwidth for online operations.

If you tune backup performance by specifying filesperset but not diskratio, diskratio defaults to the same value as filesperset. If neither is specified, diskratio defaults to 4.

Note: Do not spread the I/O over more than the minimum number of disks to keep the tape streaming, since otherwise you do not improve performance and also increase restore time for a single file.  

proxy  

backs up the specified files using the proxy copy functionality, which gives the media management software control over the data transfer between storage devices and the Oracle datafiles on disk. The media manager--not RMAN--decides how and when to move data.

For each file that you attempt to proxy copy, RMAN queries the media manager to determine whether it can copy the file. If the media manager cannot proxy copy the file, then RMAN uses conventional backup sets to back up the file.  

 

only  

causes Oracle to issue an error message when it cannot proxy copy rather than creating conventional backup sets.  

pool integer  

specifies the media pool in which the backup should be stored. Consult your media management documentation to see whether the pool option is supported.  

backupSpec  

A backup_specification_list contains a list of one or more backupSpec clauses. A backupSpec clause minimally contains a backup_object_list, which is a list of one or more objects to be backed up.

Each backupSpec clause generates one or more backup sets. A backupSpec clause will generate multiple backup sets if the number of datafiles specified in or implied by its backup_object_list exceeds the filesperset limit.  

 

datafile datafileSpec  

specifies a list of one or more datafiles (see "datafileSpec").

Note: If you back up datafile 1, which is the first file of the SYSTEM tablespace, RMAN automatically includes the control file in the backup set.  

 

datafile copy 'filename'  

specifies the filenames of one or more datafile image copies.  

 

datafile copy tag tag_name  

specifies a list of one or more datafile copies, identified by tag. If multiple datafile copies with this tag exist, then Oracle backs up only the most current datafile copy of any particular datafile.  

 

tablespace tablespace_name  

specifies the names of one or more tablespaces. RMAN backs up all datafiles that are currently part of the tablespaces.

This keyword is provided merely as a convenience; Oracle translates the tablespace name internally into a list of datafiles.  

 

database  

specifies the control file and all datafiles in the database. This keyword is provided merely as a convenience; Oracle translates the tablespace name internally into a list of datafiles.  

 

archivelogRecord- Specifier clause  

specifies a range of archived redo logs. See "archivelogRecordSpecifier".  

 

current controlfile  

specifies the current control file.  

 

controlfile copy 'filename'  

specifies the filename of a control file copy.  

 

parms 'channel_parms'  

specifies parameters regarding the device to allocate. Do not use this port-specific string if you have specified type disk.

If you use parms in conjunction with type 'sbt_tape', then you can specify environment variables. Following are models for acceptable syntax:

PARMS="ENV=(var1=value1,var2=value2,var3=value3 . . .)" 
PARMS="BLKSIZE=integer"

For example, you can specify:

PARMS="BLKSIZE=16384,ENV=(NSR_SERVER=tape_server,NSR_CLIENT=oracleclnt,
NSR_GROUP=oracle_tapes)"

The maximum length of the quoted string is 1000 bytes.  

 

format 'format_string'  

Specifies the filename for the backup piece. See the description of the format parameter at the command level.  

 

filesperset integer  

specifies the maximum number of datafiles to place in one backup set. See the discussion of filesperset at the command level.  

 

channel channel_id  

specifies the name of a channel to use when creating the backup set for this backupSpec clause. See the discussion of channel at the command level.  

 

setsize integer  

specifies a maximum size for a backup set in units of 1K (1024 bytes). See the description of the setsize parameter at the command level.  

 

tag tag_name  

creates a tag for the backup set. See the discussion of the tag parameter at the command level for more information.  

 

diskratio integer  

specifies the number of disks involved in the backup. See the discussion of the diskratio parameter at the command level for more information.  

 

delete input  

deletes the input files upon successful creation of the backup set. Specify this option only when backing up archived redo logs or datafile copies. It is equivalent to issuing a change ... delete command for all of the input files.

Note: The backup command only backs up one copy of each distinct log sequence number, so if the delete input option is requested, RMAN only deletes the copy of the file that it backed up.  

 

skip  

skips datafiles that are offline, readonly, or inaccessible. See the description of the skip option at the command level.  

 

pool  

specifies the media pool in which the backup should be stored. See the description of pool at the command level.  

 

include current controlfile  

creates a snapshot of the current control file and places it into each backup set produced by this clause.  

Examples

Backing up Tablespaces and Datafiles

This command uses two backupSpec clauses to back up tablespaces and datafiles:

run {
     allocate channel dev1 type disk;
     allocate channel dev2 type disk; 
     backup 
       (tablespace system,sales1,sales2,sales3
       filesperset 20
       skip readonly
       channel dev1)
       (datafile 1, 4, 5
       channel dev2);
}
Performing a Cumulative Incremental Backup of a Database

This example backs up all blocks changed in the database since the most recent level 0 or level 1 backup:

run { 
     allocate channel dev1 type 'sbt_tape'; 
     backup 
       incremental level 2 cumulative
       # do not include inaccessibile datafiles in the backup
       skip inaccessible
       database;  
}
Duplexing a Backup Set

When duplexing backup sets, specify the set duplex command before allocating a channel:

run {
     # generate four identical backup sets of datafile 1
     set duplex=4;
     allocate channel dev1 type 'sbt_tape';
     backup datafile 1;
}
Checking for Corruption

This example backs up datafile 3 and specifies that no more than 2 blocks with physical or logical corruption will be tolerated:

run {
     set maxcorrupt for datafile 3 to 2;
     allocate channel dev1 type 'sbt_tape';
     backup check logical
       datafile 3;
}

Related Topics

"allocate"

"archivelogRecordSpecifier"

"printScript"

"set_run_option"




Prev

Top

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index