Oracle8i Recovery Manager User's Guide and Reference
Release 2 (8.1.6)

Part Number A76990-01

Library

Product

Contents

Index

Go to previous page Go to beginning of chapter Go to next page

Recovery Manager Command Syntax, 6 of 50


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:

"Backup Sets" for a conceptual overview of RMAN backup sets, and Chapter 5, "Making Backups and Copies with Recovery Manager" to learn how to back up files. 

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 operating system-specific information. RMAN passes the string to the OSD layer each time a backup piece is created. Currently, no parms settings are available when specified in the backup command, although you can specify parms in the allocate channel command. 

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 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: Oracle8i Reference for more information about the DB_BLOCK_CHECKSUM initialization parameter. 

check logical 

tests data and index blocks that pass physical corruption checks for logical corruption, for example, corruption of a row piece or index entry. If RMAN finds logical corruption, then it logs the block in the alert.log and server session trace file.

Provided the sum of physical and logical corruptions detected for a file remain below its maxcorrupt setting, the RMAN command completes and Oracle populates V$BACKUP_CORRUPTION with corrupt block ranges. If maxcorrupt is exceeded, then the command terminates without populating the views.

Note: For copy and backup the maxcorrupt setting represents the total number of physical and logical corruptions permitted on a file. 

filesperset integer 

specifies the maximum number of input files per backup set. If you set filesperset = n, then RMAN never includes more than n files in a backup set. The default for filesperset is the lesser of these two values: 64, number of input files / number of channels. For example, if you back up 100 datafiles using 2 channels, RMAN sets filesperset to 50.

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 two datafiles when three channels are allocated and filesperset = 1, then one channel is necessarily idle.

See Also: The setsize parameter, which limits backup sets by total bytes rather than number of files included. 

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, for example, 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 operating system 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. You can use setsize to configure backup sets so that each fits on one tape volume rather than spans 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.

Because archived logs are located on one disk and so do not create an I/O distribution problem, the setsize parameter is easier to use than filesperset when you make archived redo log backups. The filesperset parameter is more useful for managing I/O distribution for backups of datafiles on multiple disks.

Note: Because filesperset has a default, both setsize and filesperset take effect when setsize is set. RMAN attempts to limit the size in bytes of the backup sets according to the setsize parameter, treating filesperset as an upper limit for the number of files to include in each set. 

diskratio integer 

directs RMAN to assign datafiles (only) to each backup set and spread them across the specified number of drives. For example, assume that you use 10 disks, the disks supply data at 10 bytes/second, and the tape drive requires 50 bytes/second to keep streaming. You can set diskratio to 5 to spread the backup load across 5 disks for each backup set.

If you set filesperset but not diskratio, then diskratio defaults to the same value as filesperset. If you specify neither parameter, diskratio defaults to 4. RMAN compares the diskratio value to the actual number of devices involved in the backup and uses the lowest value. For example, if diskratio is 4 and the datafiles are on 3 disks, then RMAN attempts to spread the backup load for each set among 3 disks.

The diskratio parameter is 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.

Note: Do not spread I/O over more than the minimum number of disks to keep the tape streaming. Otherwise, you increase restore time for a file without increasing performance. 

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.

When you execute a backup command with the proxy option, RMAN performs these steps:

  1. Searches for a channel of type 'sbt_tape' that is proxy-capable. If no such channel is found, then RMAN issues an error message. RMAN does not attempt a conventional (that is, non-proxy) backup of the specified files.

  2. If RMAN locates a proxy-capable channel, it calls the media manager to determine whether it can proxy 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 a quoted string containing operating system-specific information. RMAN passes the string to the OSD layer each time a backup piece is created. Currently, no parms settings are available when specified in the backup command, although you can specify parms in the allocate channel command. 

 

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 logs or datafile copies. It is equivalent to issuing change ... delete 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 backs up.

See Also: "configure" for information on the effect of recovery catalog compatibility on this command. 

 

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 a Database

This command backs up the database to tape and then backs up the control file that contains the record of the database backup:

run {
     allocate channel dev1 type 'SBT_TAPE';
     backup database;
     backup current controlfile;
}
Backing up Tablespaces and Datafiles

This command uses two backupSpec clauses to back up tablespaces and datafiles and lets RMAN perform automatic parallelization of the backup:

run {
     allocate channel dev1 type disk;
     allocate channel dev2 type disk; 
     backup 
       (tablespace system,sales1,sales2,sales3
       filesperset 20 skip readonly)
       (datafile 12, 14, 15);
}
Backing Up Multiple Copies of Archived Redo Logs

This example backs up the archived redo logs in /oracle/arch/dest1 to one set of tapes and the logs from /oracle/arch/dest2 to another set of tapes. This scenario assumes that you have two tape drives available.

run { 
     allocate channel t1 type 'sbt_tape'; 
     allocate channel t2 type 'sbt_tape'; 
     backup 
       filesperset=20 
       format='al_%d/%t/%s/%p' 
       (archivelog like '/oracle/arch/dest1/%' channel t1 delete input) 
       (archivelog like '/oracle/arch/dest2/%' channel t2 delete input); 
}
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;
}
Specifying How Channels Divide a Workload

This example parallelizes a backup operation by specifying which channels should back up which files and to which location:

run {
     allocate channel ch1 type 'SBT_TAPE';
     allocate channel ch2 type disk;
     allocate channel ch3 type 'SBT_TAPE';
     backup 
       # channel ch1 backs up datafiles to tape drive #1
       (datafile 1,2,3,4 
       channel ch1)
       # channel ch2 backs up control file copy to disk
       (controlfilecopy '/oracle/copy/cf.f'
       channel ch2)
       # channel ch3 backs up archived redo logs to tape drive #2
       (archivelog from time 'SYSDATE-14'
       channel ch3);
}
Performing an OPS Backup

The following script distributes datafile and archived redo log backups across two nodes in an Oracle Parallel Server environment:

run { 
     allocate channel node_1 type 'SBT_TAPE' connect 'sys/sys_pwd@node_1'; 
     allocate channel node_2 type 'SBT_TAPE' connect 'sys/sys_pwd@node_2'; 
        backup filesperset 1  
          (tablespace system, rbs, data1, data2 
           channel node_1)
          (tablespace temp, reccat, data3, data4 
           channel node_2); 
        backup filesperset 20 
          (archivelog until time 'SYSDATE' like '/node1/arc/%' 
           delete input 
           channel node_1); 
          (archivelog until time 'SYSDATE' like '/node2/arc/%' 
           delete input 
           channel node_2); 
}
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"

"configure"

"printScript"

"set_run_option"


Go to previous page Go to beginning of chapter Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index