Skip Headers
Oracle® Database Backup and Recovery Reference
10g Release 2 (10.2)

Part Number B14194-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Feedback

Go to previous page
Previous
Go to next page
Next
View PDF

BACKUP

Syntax

backup::=

Description of backup.gif follows
Description of the illustration backup.gif

backupOperand::=

Description of backupoperand.gif follows
Description of the illustration backupoperand.gif

backupSpec::=

Description of backupspec.gif follows
Description of the illustration backupspec.gif

backupSpecOperand::=

Description of backupspecoperand.gif follows
Description of the illustration backupspecoperand.gif

backupTypeSpec::=

Description of backuptypespec.gif follows
Description of the illustration backuptypespec.gif

copyOfSpec::=

Description of copyofspec.gif follows
Description of the illustration copyofspec.gif

datafileCopySpec::=

Description of datafilecopyspec.gif follows
Description of the illustration datafilecopyspec.gif

duration::=

Description of duration.gif follows
Description of the illustration duration.gif

forRecoveryOfSpec::=

Description of forrecoveryofspec.gif follows
Description of the illustration forrecoveryofspec.gif

notBackedUpSpec::=

Description of notbackedupspec.gif follows
Description of the illustration notbackedupspec.gif

sizeSpec::=

Description of sizespec.gif follows
Description of the illustration sizespec.gif

skipSpec::=

Description of skipspec.gif follows
Description of the illustration skipspec.gif

Purpose

To back up a database, tablespace, datafile (current or copy), control file (current or copy), SPFILE, archived log, or backup set.


Note:

RMAN can only back up datafiles, controlfiles, SPFILEs, archived redo log files, as well as backups of these files created by RMAN.

Although the database depends on other types of files for operation, such as network configuration files, password files, and the contents of the Oracle home, these files cannot be backed up with RMAN. Likewise, some features of Oracle, such as external tables or the BFILE datatype, store data in files other than those listed above. RMAN cannot back up those files. You must use some non-RMAN backup solution for any files not in the preceding list.


RMAN can back up a target or standby database. The term backup refers to the files created by an RMAN BACKUP command.

Backup Sets, Backup Pieces, Image Copies, and Proxy Copies

When the AS BACKUPSET option is used, RMAN generates one or more backup sets, which are RMAN-specific logical structures. The backup set is the smallest unit of a backup. By default, each backup set contains 4 or fewer datafiles or 16 or fewer archived logs.


Note:

RMAN only records complete backup sets in the RMAN repository. There are no partial backup sets. When a BACKUP command creates backup pieces but does not produce a complete backup set for any reason, the backup pieces are discarded.

Each backup set contains at least one backup piece, which is an RMAN-specific physical file containing the backed up data. You can also use the BACKUP command to generate a proxy copy, which is a backup to a third-party medium in which the entire data transfer is conducted by a media manager.

Backup sets can be created on disk, or on media manager devices such as tape drives.

When the AS COPY option is used, RMAN generates image copies of the input files. An image copy is a byte-for-byte identical copy of the original file. You can create image copy backups of datafiles, datafile copies, and archived redo log files. Image copy files can only exist on disk.

You can create and restore image copy backups with RMAN, or with a native operating system command for copying files. However, when you use RMAN to create image copies, they are recorded in the RMAN repository, and are more easily available for use in restore and recovery operations. Otherwise, you must use the CATALOG command to add the image copies to the RMAN repository before RMAN can use them.

By default, RMAN creates all backups as backup sets, on tape or on disk. You can change the default backup type for disk backups to be image copies using the CONFIGURE command. Backups to tape can only be backup sets.

Incremental Backups

Incremental backups copy only those blocks that have changed since a previous backup. A level 0 incremental backup captures all data blocks in a datafile. Level 1 incremental backups capture changes since a previous backup. Level 1 backups can be cumulative, in which case they capture changes since the last level 0 incremental backup, or differential, in which case they capture changes since the last level 0 or level 1 incremental backup.

Block Change Tracking for Incremental Backups

You can improve incremental backup performance by enabling block change tracking, in which case RMAN keeps a record of which blocks have changed, and uses this record whenever possible to avoid scanning entire datafiles.

For details on block change tracking, including how to enable and disable it, see Oracle Database Backup and Recovery Basics.

Incrementally Updated Backups: Rolling Forward Datafile Image Copies

By using the BACKUP INCREMENTAL... FOR RECOVER OF COPY WITH TAG... syntax you can create level 1 incremental backups suitable for rolling forward a level 0 incremetal image copy backup of your database. RECOVER COPY OF... WITH TAG... is used to perform incremental update of a backup.


Note:

This technique is used in Enterprise Manager's Oracle-suggested Strategy for backups to disk.

For more details on incrementally updated backups, see Oracle Database Backup and Recovery Basics.

Incremental Roll Forward of Database Copy: Updating Standby Databases

RMAN's Incremental Roll Forward of Database Copy feature enables you to synchronize a standby database with a source database by creating an incremental backup at the source database containing all changed blocks since the standby was created or last synchronized, and then applying that incremental backup at the standby.

The incremental backup is created at the source database using the BACKUP INCREMENTALFROM SCN =n form of the BACKUP command. All blocks changed at SCNs greater than or equal to the specified SCN are included in the incremental created by this BACKUP command.


Note:

The resulting backup is not considered to be part of any backup strategy at the source database. It is not suitable for use in a normal RECOVER DATABASE operation at the source database.

At the standby database, the RECOVER command is used with the NOREDO option to apply the incremental backup to the standby. All changed blocks captured in the incremental backup are updated at the standby, bringing it up to date with the original.

Encryption of Backup Sets

RMAN can transparently encrypt data written to backup sets and decrypt those backup sets when they are needed in a RESTORE operation, based upon several different encryption algorithms (listed in V$RMAN_ENCRYPTION_ALGORITHMS). RMAN offers three modes of encryption:

For an overview of the encrypted backups mechanism, a guide to its use and information on choosing among the different modes of encryption, see Oracle Database Backup and Recovery Advanced User's Guide. The RMAN CONFIGURE, SET and SHOW commands are used to manage the encryption settings for your database backups. See the reference entries for those commands for more details.

Binary Compression of Backup Sets

RMAN can apply a binary compression algorithm as it writes data to backup sets. This compression is similar to the compression provided by many tape vendors when backing up data to tape. (The two types of compression should not be used together; see the discussion of BACKUP AS BACKUPSET below for details on choosing between using RMAN compression and the tape compression for backup sets.)

Unused Block Compression Of Datafile Backups to Backup Sets

When backing up datafiles into backup sets, RMAN does not back up the contents of data blocks that have never been allocated. (In previous releases, this behavior was referred to as NULL compression.)

RMAN also skips other datafile blocks that do not currently contain data, if all of the following conditions apply:

Skipping unused data blocks where possible enables RMAN to back up datafiles using less space, and can make I/O more efficient.

Backup Optimization

The BACKUP command optimizes backups, that is, does not back up files that are identical to files that are already backed up, when the following conditions are met:

Channel Failover

A BACKUP command is decomposed into multiple independent backup steps by RMAN. Each independent step can be executed on any channel allocated for a specific device. If you have multiple channels allocated, and one channel fails or encounters a problem during a backup step, then RMAN attempts to complete the work on another channel. RMAN reports a message in V$RMAN_OUTPUT and in the output to the interactive session or log file when channel failover occurs.

Control File Autobackups

If CONFIGURE CONTROLFILE AUTOBACKUP is set to ON, then RMAN automatically backs up the control file after BACKUP commands. "CONFIGURE" describes the complete set of circumstances in which autobackups occur.

Restrictions and Usage Notes

Keywords and Parameters

backup

Syntax Element Description
backupOperand Specifies various options for the BACKUP command.
backupSpec A BACKUP specification list contains a list of one or more backupSpec clauses. A backupSpec clause minimally contains a list of one or more objects to be backed up.

Each backupSpec clause generates one or more backup sets (AS BACKUPSET) or image copies (AS COPY). For AS BACKUPSET, the backupSpec clause generates multiple backup sets if the number of datafiles specified in or implied by its list of objects exceeds the default limit of 4 datafiles or 16 archived logs in each backup set.

PLUS ARCHIVELOG When you specify PLUS ARCHIVELOG, RMAN performs these steps:
  1. Runs an ALTER SYSTEM ARCHIVE LOG CURRENT statement.

  2. Runs the BACKUP ARCHIVELOG ALL command. Note that if backup optimization is enabled, then RMAN only backs up logs that have not yet been backed up.

  3. Backs up the files specified in the BACKUP command.

  4. Runs an ALTER SYSTEM ARCHIVE LOG CURRENT statement.

  5. Backs up any remaining archived redo logs.

backupSpecOperand Specifies a variety of options and parameters that affect the backupSpec clause.

backupOperand

Syntax Element Description
backupOperand Specifies various options for the BACKUP command.
backupTypeSpec Specifies the type of backup being created, either backup sets or image copies. See "backupTypeSpec" for details.
CHANNEL channel_id Specifies the case-sensitive name of a channel to use when creating backups. Use any name that is meaningful, for example ch1 or dev1. The database uses the channel ID to report I/O errors. If you do not set this parameter, then RMAN dynamically assigns the backup sets to any available channels during execution.

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

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.

If the sum of physical and logical corruptions detected for a file is no more than its MAXCORRUPT setting, then the backup command completes, and V$DATABASE_BLOCK_CORRUPTION is populated with any corrupt block ranges. If there are more thanMAXCORRUPT corrupt blocks, then the command terminates without updating the view and no output file is created for the backup.

If the initialization parameter DB_BLOCK_CHECKSUM=TRUE, and if MAXCORRUPT and NOCHECKSUM are not set, then specifying CHECK LOGICAL detects all types of corruption that are possible to detect.

Note: The MAXCORRUPT setting specifies the total number of physical and logical corruptions permitted on a file.

COPIES = integer Sets the number of identical backups (1 - 4) that RMAN should create. The default value is 1. You can specify duplexing on more than one command. The order of precedence is as follows, with settings higher on the list overriding lower settings:
  1. BACKUP COPIES

  2. SET BACKUP COPIES

  3. CONFIGURE ... BACKUP COPIES

Note: This option does not apply with AS COPY and results in an error message.

Note: Duplexing cannot be used when creating files in the flash recovery area.

CUMULATIVE Copies the data blocks used since the most recent backup at level 0 or lower, where n is 1. For example, in a cumulative level 1 backup RMAN backs up all blocks used since the most recent level 0 backup.

Note: This option does not apply with AS COPY and results in an error message.

DEVICE TYPE deviceSpecifier Allocates automatic channels for the specified device type only. This option is valid only if you have configured channels and have not manually allocated channels. For example, if you configure disk and tape channels, then configure sbt as the default device type, this command allocates disk channels only:
BACKUP DEVICE TYPE DISK DATABASE;

See Also: "deviceSpecifier"

DISKRATIO [=] integer Directs RMAN to populate each backup set with datafiles from at least integer disks. This parameter is only enabled when you are backing up datafiles or control files, and when the operating system can give RMAN disk contention and node affinity information. To manually disable this feature, set DISKRATIO = 0.

For example, assume that datafiles are distributed across 10 disks. If the disks supply data at 10 bytes/second, and if the tape drive requires 50 bytes/second to keep streaming, then set DISKRATIO = 5 to direct RMAN to include datafiles from at least 5 disks in each backup set.

If you set FILESPERSET but not DISKRATIO, then DISKRATIO defaults to the same value as FILESPERSET. If you specify neither parameter, then 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 located on three disks, then RMAN attempts to include datafiles from three disks in each backup set.

The DISKRATIO parameter is easier for datafile backups when the 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 need to spread the I/O load across several disk spindles to leave bandwidth for online operations .

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

duration
Specifies options related to the maximum time for a backup command to run.

See Also: "duration"

filenameConversionSpec This option is valid only when BACKUP is creating image copies. Files being copied are renamed according to the specified patterns. If a file being backed up has a name that does not match any of the specified rename patterns, then RMAN uses FORMAT to name the output image copies. If no FORMAT was specified, then RMAN uses the default format %U.

See "fileNameConversionSpec" for details about file renaming patterns.

FILESPERSET [=] integer When used with commands that create backupsets, specifies the maximum number of files to include in each backupset created.

By default, RMAN divides files among backupsets in order to make optimal use of channel resources. The number of files to be backed up is divided by the number of channels. If the result is less than 64, then it is the number of files placed in each backupset. Otherwise, 64 files will be placed in each backupset.

FORCE Causes RMAN to ignore backup optimization. In other words, even if CONFIGURE BACKUP OPTIMIZATION is set to ON, RMAN backs up all specified files.

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

FORMAT = formatSpec Specifies a pattern to use in creating a filename for the backup pieces or image copies created by this command. For AS COPY, if one or more of the directories mentioned in the specified format do not exist, then RMAN signals an error.

See Also: "formatSpec" for legal substitution variables

forRecoveryOfSpec Identifies the backup being created as an incremental backup to be used in rolling forward an image copy. See "forRecoveryOfSpec" for details.
FULL Creates a backup of all blocks of datafiles included in the backup. FULL is the opposite of INCREMENTAL.

RMAN makes full backups by default if neither FULL nor INCREMENTAL is specified.

A full backup has no effect on subsequent incremental backups, and is not considered a part of any incremental backup strategy (though a full image copy backup can be incrementally updated by applying incremental backups with the RECOVER command).

Note:Backup Unused Space Compression, described in "Unused Block Compression Of Datafile Backups to Backup Sets", causes some datafile blocks to be skipped during full backups of datafiles as backup sets.

INCREMENTAL LEVEL [=] integer Copies only those data blocks that have changed since the last incremental integer backup, where integer is 0 or 1. An incremental backup at level 0 backs up all data blocks in datafiles being backed up. An incremental backup at level 1 backs up only changed blocks. An incremental backup can be either differential or cumulative.In a cumulative level 1 incremental backup, RMAN backs up all blocks changed since the most recent level 0 backup. In a differential level 1 incremental backup, RMAN backs up blocks updated since the last level 0 or level 1 incremental backup.

Incremental backups at level 0 can be either backup sets or image copies. Incremental backups at level 1 can only be backup sets.

A level 0 backup must exist as the base backup for an incremental strategy. 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. If no level 0 backup exists when you run a level 1 backup, then RMAN makes a level 0 backup automatically.

The database performs checks when attempting to create a level 1 incremental backup, to ensure that the incremental backup is usable by a subsequent RECOVER command. Among the checks performed are:

  • A level 0 backup must exist for each datafile in the BACKUP command. These backups must not have status UNAVAILABLE. If no level 0 backup exists, then RMAN makes one.

  • 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 clause 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.

Note: You cannot make inconsistent incremental backups when the database is in NOARCHIVELOG mode. Hence, you cannot generate incremental backups when a NOARCHIVELOG database is open and in use.

Note: When creating an incremental backup, RMAN considers backups from parent incarnations as valid. For example, assume you make a level 0 backup and then OPEN RESETLOGS. If you make a level 1 incremental backup, then RMAN backs up all blocks changed since the pre-RESETLOGS level 0 backup.

See Also: "CHANGE"

INCREMENTAL FROM SCN= integer Creates an incremental backup of all specified datafiles which includes all datafile blocks changed at SCNs greater than or equal to the specified SCN.

The expected use of this feature is in refreshing a standby database with changes from a primary database. See Oracle Database Backup and Recovery Advanced User's Guide for details.

Note:

  • The default location of the incremental is the dbs subdirectory under the Oracle home.

  • The incremental backup created by BACKUP INCREMENTAL FROM SCN is not part of any incremental strategy at the primary database. It can only be used to refresh a standby with the changes at the primary. In the RMAN repository, this backup is not marked with an incremental level when it is recorded in the RMAN repository. The algorithms that control which backups RMAN selects for use in a restore and recovery do not select incremental backups created using FROM SCN.

keepOption
Overrides any configured retention policy for this backup so that the backup is not considered obsolete. You can use CHANGE to alter the keep status. Note that you must be connected to a recovery catalog when you specify KEEP FOREVER.

See Also: "keepOption"

MAXSETSIZE = integer [ K | M | G ] Specifies a maximum size for a backup set.RMAN limits all backup sets to this size. Use MAXSETSIZE to configure backup sets so that each fits on one tape rather than spanning multiple tapes. Otherwise, if one tape of a multivolume backup set fails, then you lose the data on all the tapes rather than just one.

Specify size in bytes (default), kilobytes (K), megabytes (M), or gigabytes (G). Thus, to limit a backup set to 3 MB, specify MAXSETSIZE = 3M. The default size is in bytes, rounded down from kilobytes. For example, MAXSETSIZE = 3000 is rounded down to 2 KB (2048 bytes). The minimum value must be greater than or equal to the database block size.

The default number of files in each backup set is 4 for datafiles and 16 for archived logs. When you specify MAsXSETSIZE, RMAN attempts to limit the size in bytes of the backup sets according to the MAXSETSIZE parameter. The limit on the number of files in a backup set will apply even if the total size of the resulting backup set is less than MAXSETSIZEs.

Note: This option cannot be used with BACKUP AS COPY and results in an error message. If you run BACKUP AS COPY on a channel that has MAXSETSIZE set, then MAXSETSIZE is silently ignored.

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, then the database computes a checksum for each block during normal operations and stores it in the block before writing the block to disk. When the database reads the block from disk later, it recomputes the checksum and compares it to the stored value. If they do not match, then the block is damaged.

By default, the database also 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.

If you wish to prevent the use of block checksums in your backup, use the NOCHECKSUM option.

See Also: Oracle Database Reference for more information about the DB_BLOCK_CHECKSUM initialization parameter

notBackedUpSpec
Limits the set of files to be backed up according to whether a specified number of backups are already present (and not obsolete), or whether the files have been backed up since a specified date. See "notBackedUpSpec" for details.
NOEXCLUDE When specified on BACKUP DATABASE or BACKUP COPY OF DATABASE command, RMAN backs up all tablespaces, including any for which a CONFIGURE EXCLUDE command has been entered. This option does not override SKIP OFFLINE or SKIP READONLY.
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.

Note: This option does not apply with AS COPY and results in an error message.

PROXY Backs up the specified files by means of the proxy copy functionality, which gives the media management software control over the data transfer between storage devices and the datafiles on disk. The media manager—not RMAN—decides how and when to move data.

When you run BACKUP with the PROXY option, RMAN performs these steps:

  1. Searches for a channel of the specified device type that is proxy-capable. If no such channel is found, then RMAN issues a warning and attempts a 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 check if it can proxy copy the files. If the media manager cannot proxy copy, then RMAN uses conventional backup sets to back up the files.

If you do not want RMAN to try a conventional copy when a proxy copy fails, use the ONLY option.

Note: If you specify PROXY, then the %p variable must be included in the FORMAT string either explicitly or implicitly within %U.

Note: This option cannot be used with BACKUP AS COPY and results in an error message.

ONLY Causes the database to issue an error message when it cannot proxy copy rather than creating conventional backup sets.
REUSE Enables RMAN to overwrite an already existing backup or copy with the same filename as the file that BACKUP is currently creating.
skipSpec
Excludes datafiles or archived redo logs from the backup if they are inaccessible, offline or read-only. See "skipSpec" for details.
TAG tag_name Creates a user-specified tag name for a backup. The tag is not case sensitive.

If you do not specify a tag name, then by default RMAN creates a tag for backups (except for control file autobackups) in the format TAGYYYYMMDDTHHMMSS, 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 can receive the tag TAG20020208T133437. The date and time refer to when RMAN started the backup. If multiple backup sets are created by one BACKUP AS BACKUPSET command, then each backup piece is assigned the same default tag.

A tag applies to each backup piece in a given copy of a backup set (for AS BACKUPSET) or each image copy (for AS COPY). For example, if you run BACKUP AS BACKUPSET COPIES 1 DATABASE TAG TUE_PM, then only one copy of the backup set exists and each piece in the backup set has tag TUE_PM. Assume that this backup set has primary key 1234. If you then run BACKUP BACKUPSET 1234 TAG WED_PM, then the first copy of the backup set has tag TUE_PM and the second copy of the backup set has tag WED_PM.

Typically, a tag is a meaningful name such as MONDAY_EVENING_BACKUP or WEEKLY_FULL_BACKUP. 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.

Tags must be 30 characters or less. The characters used in a tag must be limited to the characters that are legal in filenames on the target filesystem. For example, ASM does not support the use of the - character in the filenames it uses interally, so a tag including a - (for example, weekly-incremental) is not a legal tag name if you are storing backups in ASM disk groups.

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 the command have the 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.

VALIDATE Causes RMAN to scan the specified files and verify their contents, testing whether this file can be backed up. RMAN creates no output files. Use this command periodically to check for physical and logical errors in database files.

Note: You cannot validate backups of backup sets.


backupSpec

Syntax Element Description
backupSpec A BACKUP specification list contains a list of one or more backupSpec clauses. A backupSpec clause contains, at a minimum, a list of one or more objects to be backed up.

Each backupSpec clause generates one or more backup sets (AS BACKUPSET) or image copies (AS COPY). For AS BACKUPSET, the backupSpec clause generates multiple backup sets if the number of datafiles specified in or implied by its list of objects exceeds the default limit of 4 datafiles or 16 archived logs in each backup set.

archivelogRecordSpecifier
Specifies a range of archived redo logs to be backed up. RMAN does not signal an error if the command finds no logs to back up, because this situation probably exists because no new logs were generated after the previous BACKUP ARCHIVELOG ALL DELETE INPUT command.

If you specify BACKUP ARCHIVELOG ALL, then RMAN backs up exactly one copy of each distinct log sequence number. For example, if you archive to multiple destinations, RMAN backs up one copy of each log sequence number—not each copy of each log sequence number. For other commands, such as DELETE, ALL does refer to every log, even duplicate log sequences.

If the database is open when you run BACKUP ARCHIVELOG, and if the UNTIL clause or SEQUENCE parameter is not specified, then RMAN runs ALTER SYSTEM ARCHIVE LOG CURRENT.

Note: If you run BACKUP ARCHIVELOG ALL, or if the specified log range includes logs from prior incarnations, then RMAN backs up logs from prior incarnations to ensure availability of all logs that may be required for recovery through an OPEN RESETLOGS.

See Also: "archivelogRecordSpecifier" for syntax, and Oracle Database Backup and Recovery Advanced User's Guide explanations of backup failover for logs and automatic log switching

BACKUPSET { ALL | completedTimeSpec | primaryKey [, primaryKey ]} Backs up either ALL backup sets or backup sets specified by primary_key or completion time. Use this parameter in conjunction with the DEVICE TYPE sbt clause to back up all backups on disk to tape. You cannot back up from tape to tape or from tape to disk: only from disk to disk or disk to tape.

Note if you specify the DELETE INPUT option, then RMAN deletes all copies of the backup set that exist on disk. For example, if you duplexed a backup to 4 locations, then RMAN deletes all 4 backup sets. The ALL option is redundant, that is, it does not add any functionality.

RMAN performs backup set failover when backing up backup sets. RMAN searches for all available backup copies when the copy that it is trying to back up is corrupted or missing. This behavior is similar to RMAN's behavior when backing up archived logs that exist in multiple archiving destinations.

Note: You can duplex backups of backup sets by using BACKUP COPIES and SET BACKUP COPIES.

See Also: "completedTimeSpec"

CONTROLFILECOPY { 'filename' | ALL | LIKE 'string_pattern' } Specifies a control file copy in one of the following ways:
  • 'filename' specifies a control file copy by filename

  • ALL specifies that all control file copies should be backed up

  • LIKE 'pattern' specifies a filename pattern. The percent sign (%) as a wildcard meaning 0 o r more characters; an underscore (_) is a wildcard meaning 1 character.

The control file copy can be:

  • A copy of a normal control file (that is, not a standby control file) created with the BACKUP AS COPY CURRENT CONTROLFILE command or the SQL statement ALTER DATABASE BACKUP CONTROLFILE TO '...'

  • A standby control file copy created with the BACKUP AS COPY STANDBY CONTROLFILE command or the SQL statement ALTER DATABASE CREATE STANDBY CONTROLFILE

RMAN inspects the header of the control file copy to determine whether it is a standby or nonstandby control file.

copyOfSpec
Makes a backup of previous image copies of datafiles and possibly control files. See "copyOfSpec" for details.
CURRENT CONTROLFILE [FOR STANDBY] Specifies the current control file.

If you specify FOR STANDBY, then RMAN generates a backup of the control file that is usable during creation of a standby database. The backup contains only the standby control file.

Note: You cannot assign a tag to a backup of the current control file.

DATABASE Creates a backup set (AS BACKUPSET) or group of image copies (AS COPY) for all datafiles in the database. If generating a backup set, then RMAN can include only datafiles and control files: it cannot include archived redo logs.

If the backupSpec includes datafile 1, and if CONFIGURE CONTROLFILE AUTOBACKUP is OFF, then RMAN automatically includes the control file in the backup. If the instance is started with a server parameter file, then RMAN also includes this parameter file in the backup.

If the backupSpec includes datafile 1, and if CONTROLFILE AUTOBACKUP is ON, then RMAN does not automatically include the control file in the output. Instead, RMAN generates a separate control file autobackup piece. If the instance is started with a server parameter file, then RMAN includes this parameter file in the autobackup piece.

Note: To force RMAN to include the current control file in the backup when CONTROLFILE AUTOBACKUP is ON, specify the INCLUDE CURRENT CONTROLFILE clause.

datafileCopySpec
Specifies the filenames of one or more datafile image copies. See "datafileCopySpec" for details.
DATAFILE datafileSpec Specifies a list of one or more datafiles. Refer to description of BACKUP DATABASE for RMAN behavior when datafile 1 is backed up.

See Also: "datafileSpec"

RECOVERY AREA | DB_RECOVERY_FILE_DEST Backs up recovery files created in the current and all previous flash recovery area destinations. Recovery files are full and incremental backup sets, control file autobackups, archived logs, and datafile copies. Flashback logs, the current control file, and online redo logs are not backed up.

RECOVERY AREA and DB_RECOVERY_FILE_DEST are synonyms.

Backup optimization is always ON for this option. The backup must go to sbt, so RMAN issues an error if no sbt channels are allocated or configured.

Note: If the flash recovery area is not enabled but has been enabled in the past, then files that were created in the previous flash recovery area location are backed up.

RECOVERY FILES Backs up all recovery files on disk, whether they are stored in the flash recovery area or another locations on disk. Recovery files include full and incremental backup sets, control file autobackups, archived logs, and datafile copies. Backup optimization is always ON for this option. The backup must go to sbt, so RMAN issues an error if no sbt channels are allocated or configured.
SPFILE Backs up the server parameter file currently used by the database. RMAN cannot back up other copies of the server parameter file, and cannot back up the server parameter file when the instance was started with an initialization parameter file. RMAN cannot make incremental backups of the SPFILE.
TABLESPACE tablespace_name [, tablespace_name] Specifies the names of one or more tablespaces. RMAN backs up all datafiles that are currently part of the tablespaces. If the SYSTEM tablespace (and thus datafile 1) is included in the backup, and if CONTROLFILE AUTOBACKUP is not configured, then RMAN creates a copy of the control file.

The TABLESPACE keyword is merely a convenience; tablespace names are translated internally into a list of datafiles. If you rename a tablespace (for example, from users to customers), then RMAN detects that the tablespace has changed its name and updates the recovery catalog on the next resynchronization.

backupSpecOperand The backupSpecOperand that follows a backupSpec specifies options that apply to the backupSpec.

backupSpecOperand

Syntax Element Description
backupSpecOperand Specifies a variety of options and parameters that affect the backupSpec clause. Many subclauses of backupSpecOperand are also used with backupOperand. For those, see the description of "backupOperand". Those which are not shared in common with backupOperand are listed here.
DELETE [ALL] INPUT Deletes the input files upon successful creation of the backup. Specify this option only when backing up archived logs, datafile copies (COPY OF or DATAFILECOPY), or backup sets. It is equivalent to issuing DELETE for the input files.

The ALL option applies only to archived logs. If you run DELETE ALL INPUT, then the command deletes all copies of corresponding archived redo logs or datafile copies that match the selection criteria. For example, if you specify the SEQUENCE n clause, then RMAN deletes all archive logs with same sequence number n, including duplicate archived logs (that is, logs with same log sequence number and thread).

Note: The BACKUP ARCHIVELOG command only backs up one copy of each distinct log sequence number, so if the DELETE INPUT option is used without the ALL keyword, RMAN only deletes the copy of the file that it backs up.

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

FROM TAG = 'tag_name' Allows specifying a backup by tag. Defined in context with several other commands.
INCLUDE CURRENT CONTROLFILE [FOR STANDBY] Creates a snapshot of the current control file and places it into each backup set produced by this clause.

If you specify FOR STANDBY, then RMAN creates a backup of the control file usable for creation of a standby database. The backup set includes the standby control file and the object backed up.

Note: This option does not apply with AS COPY and results in an error message.


backupTypeSpec

Syntax Element Description
AS [ COMPRESSED ] BACKUPSET Creates backup sets (rather than image copies) on the specified device type.

AS BACKUPSET is the only possibility when backing up to tape, and for creating level 1 incremental backups to any destination.

When backing up datafiles into backup sets, RMAN only backs up blocks that are currently in use.

With the COMPRESSED option, binary compression is used. The data written into the backup set is compressed to reduce the overall size of the backup set. All backups that create backup sets can create compressed backup sets. Restoring compressed backup sets is no different from restoring uncompressed backup sets.

Note:

  • There is some CPU overhead associated with compressing backup sets. If the database being backed up is running at or near its maximum load, you may find the overhead from using AS COMPRESSED BACKUPSET unacceptable. In most other circumstances, compressing backupsets saves enough disk space to be worth the CPU overhead.

  • When backing up to a locally attached tape device, compression provided by the media management vendor is usually preferable to the binary compression provided by BACKUP AS COMPRESSED BACKUPSET. Therefore, use uncompressed backup sets and turn on the compression provided by the media management vendor when backing up to locally attached tape devices. In any case, you should not use both forms of compression together.

  • When using incrementally updated backups, the level 0 incremental must be an image copy backup.

  • Full database backups should usually be either image copies or compressed backupsets. Image copies are more flexible than backup sets for some purposes (such as use in an incrementally updated backups strategy), and compressed backupsets make more efficient use of storage space, if the CPU overhead involved in creating them is tolerable.

AS COPY Creates image copies (rather than backup sets). Can only be used with backups created on disk.

Note:

When using BACKUP AS COPY, if you do not specify the destination for the image copies, RMAN will choose a location according to the following rules:

  • If the channel used for output has a default CONFIGURE... FORMAT setting, that setting is used to generate output file names

  • If a flash recovery area is configured, the backups are placed in the flash recovery area

  • Otherwise a platform-specific default FORMAT (which includes a %U for generating a unique filename) is used.


copyOfSpec

Syntax Element Description
COPY OF DATABASE Makes a backup of previous image copies of all datafiles and control files in the database. All datafiles that would normally be included by BACKUP DATABASE are expected to have copies: if not, then RMAN signals an error. It is not necessary for all copies to have been produced by a single BACKUP command. If multiple copies exist of datafile, then RMAN backs up the latest. Optionally, specify the copies by tag name (for example, FULL_COLD_COPY).

Note: The output of this command can be image copies or backup sets.

COPY OF TABLESPACE tablespace_name Makes a backup of previous image copies of the datafiles in one or more specified tablespaces. All datafiles that would normally be included by BACKUP TABLESPACE should have copies: if not, then RMAN signals an error. It is not necessary for all copies to have been produced by a single BACKUP command. If multiple copies exist of datafile, then RMAN backs up the latest.

Specify the tablespaces in the list by tablespace name (for example, users) or specify a particular copy by tag name (for example, 0403_CPY_OF_USERS). If you do not specify TAG, then RMAN backs up the most recent datafile copy for each datafile in the tablespace.

Note: The output of this command can be image copies or backup sets.

COPY OF DATAFILE datafileSpec Makes a backup of a previous image copy of one or more datafiles. Specify the datafile by file number (DATAFILE 3) or filename (DATAFILE '?/oradata/trgt/users01.dbf'). You specify the datafile filename and not the filename of the copy of the datafile. If more than one copy exists of a given datafile, then RMAN backs up the most recent copy.

Note: It is not necessary for the image copies that you are backing up to have been created by a single BACKUP command.

Note: The output of this command can be image copies or backup sets.

See Also: "datafileSpec"


datafileCopySpec

Syntax Element Description
DATAFILECOPY { filename [,filename...]|{ ALL | LIKE 'string_pattern' | FROM TAG 'tag_name' }

}

Specifies the filenames of one or more datafile image copies. You can use the following parameters:
  • 'filename' specifies an image copy by filename

  • ALL specifies that all datafile image copies should be backed up

  • LIKE 'pattern' specifies a filename pattern. The percent sign (%) is a wildcard that means zero or more characters; an underscore (_) is a wildcard that means one character.

  • FROM TAG 'tag_name' specifies a list of one or more datafile copies, identified by the tag tag_name. If multiple datafile copies with this tag exist, then RMAN backs up only the most current datafile copy of any particular datafile. Tags are not case sensitive.

NODUPLICATES Prevents the inclusion of identical datafile copies in a backup operation. For each set of duplicate datafile copies, the file with the most recent timestamp will be selected.

duration

Syntax Element Description
DURATION hh:mm

[PARTIAL][MINIMIZE (TIME|LOAD)]

Specifies a maximum time for a backup command to run. If a backup command does not complete in the specified duration, the backup being taken stops.

With the PARTIAL option, the command is considered to have completed successfully and no error is reported by RMAN even if the whole backup is not completed in the specified duration.

Without the PARTIAL option, the backup command is considered to have failed if it does not complete in the specified duration, and RMAN reports an error. If the backup command is part of a RUN block, subsequent commands in the RUN block do not execute.

Whether PARTIAL is used or not, all backupsets completed before the backup is interrupted are retained and can be used in restore and recover operations.

With disk backups, you can use MINIMIZE TIME run the backup at maximum speed (default) , or MINIMIZE LOAD to slow the rate of backup to lessen the load on the system. With MINIMIZE LOAD the backup will take the full specified duration.

When DURATION is used with MINIMIZE TIME, the file most recently backed up is given the lowest priority to back up. This scheduling mechanism provides for the eventual complete backup of the database during successive backup windows, as different datafiles are backed up in round-robin fashion.


forRecoveryOfSpec

Syntax Element Description
FOR RECOVER OF TAG [=] 'tag_name' Lets you identify any tagged level 0 incremental to serve as the basis for this level 1 incremental. Useful in strategies other than the incrementally updated backups strategy, which uses the FOR RECOVER OF COPY clause.
FOR RECOVER OF COPY Lets you specify that this incremental should contain all changes since the SCN of a specified datafile copy (level 0 incremental backup) of your database. The datafile copies should be identified with either a DATAFILE COPY or WITH TAG clause, to keep the incremental backup strategy for which this backup will be used separate from the rest of your backup strategies. Otherwise, the most recent copy of each datafile will be used as the basis for the incremental.
WITH TAG [=] 'tag_name' Used with FOR RECOVER OF COPY, specifies a tag to identify the level 0 incremental backup to serve as the basis of the incremental. If no level 0 with the tag specified in WITH TAG option is found, then FOR RECOVER OF COPY option will create a level 0 datafile copy tagged with the value specified in the WITH TAG option. BACKUP... FOR RECOVER OF COPY WITH TAG... is key to backup strategies based on incrementally updated backups, as described in Oracle Database Backup and Recovery Basics and used in some Enterprise Manager backup strategies.
DATAFILE COPY [=] formatSpec Used with FOR RECOVER OF COPY, identifies the datafile copies to use as the basis for this incremental.

notBackedUpSpec

Syntax Element Description
NOT BACKED UP Backs up only those files (of the files specified on the command) that RMAN has never backed up. This option is a convenient way to back up new files after adding them to the database.
SINCE TIME = 'date_string' Specifies the date after which RMAN should back up files that have no backups. The date_string is either a date in the current NLS_DATE_FORMAT, or a SQL date expression such as 'SYSDATE-1'. When calculating the number of backups for a file, RMAN only considers backups created on the same device type as the current backup.

This option is a convenient way to back up files that were not backed up during a previous failed backup. For example, you back up the database, but the instance fails halfway through. You can restart the backup with the NOT BACKED UP SINCE TIME clause and avoid backing up those files that you already backed up. If AS BACKUPSET is set, then this feature is only useful if RMAN generates multiple backup sets during the backup.

When determining whether a file has been backed up, the SINCE date is compared with the completion time of the most recent backup. For BACKUP AS BACKUPSET, the completion time for a file in a backup set is the completion time of the entire backup set. In other words, all files in the same backup set have the same completion time.

integer TIMES Backs up only those archived logs that have not been backed up at least integer times. To determine the number of backups for a file, RMAN only considers backups created on the same device type as the current backup.

This option is a convenient way to back up archived logs on a specified media (for example, you want to keep at least three copies of each log on tape).


sizeSpec

Syntax Element Description
integer [K|M|G] Specifies the size of data, such as a file, in kilobytes (K), megabytes (M) or gigabytes (G).

skipSpec

Syntax Element Description
SKIP Excludes datafiles or archived redo logs from the backup according to the criteria specified by the following keywords.

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

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

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.

OFFLINE Specifies that offline datafiles should be excluded from the backup.
READONLY Specifies that read-only datafiles should be excluded from the backup.

Examples

Backing Up a Database: Example This example assumes that CONFIGURE CONTROLFILE AUTOBACKUP is OFF. The command backs up all datafiles to tape, as well as the current control file, the server parameter file, and archived logs:

BACKUP DATABASE PLUS ARCHIVELOG;

Scripting Incremental Backups: Example This example shows a series of scripts that you can run to make regular incremental backups of the database:

# Run once a week to back up database to disk as level 0:
BACKUP INCREMENTAL LEVEL 0 DATABASE;

# Run every day to back up blocks that have changed since most recent level 0 or 1:
BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
BACKUP INCREMENTAL LEVEL 1 DIFFERENTIAL TABLESPACE users;

Performing a Cumulative Incremental Backup: Example This example backs up all blocks changed in the database since the most recent level 0 backup:

BACKUP INCREMENTAL LEVEL 1 CUMULATIVE SKIP INACCESSIBLE DATABASE;

Backing Up Tablespaces and Datafiles to Disk as Backup Sets: Example 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 DEVICE TYPE DISK FORMAT '/disk1/%U';
  ALLOCATE CHANNEL dev2 DEVICE TYPE DISK FORMAT '/disk2/%U'; 
  BACKUP  AS BACKUPSET
    (TABLESPACE SYSTEM, tools, users, undotbs MAXSETSIZE 5M)
    (DATAFILE 2,4,5);
}

Backing Up Tablespaces and Datafiles to Disk as Image Copies: Example 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 DEVICE TYPE DISK FORMAT '/disk1/%U';
  ALLOCATE CHANNEL dev2 DEVICE TYPE DISK FORMAT '/disk2/%U'; 
  BACKUP AS COPY
    (TABLESPACE SYSTEM, tools, users, undotbs)
    (DATAFILE 2,4,5);
}

Backing Up Datafile Copies: Example This example finds three datafile copies with the tag LATESTCOPY, copies them to directory /copies and names the new copies by means of subsitution variables:

BACKUP AS COPY
   FROM TAG 'LATESTCOPY' 
  COPY OF DATAFILE 4, 6, 14 
  FORMAT '/copies/Datafile%f_Database%d';

Backing Up Archived Logs and Deleting the Input: Example This example assumes that you have two archive destinations set: /arch1 and /arch2. The command backs up one log for each unique sequence number and then deletes all logs from both archiving directories.

BACKUP ARCHIVELOG LIKE '/arch%' DELETE ALL INPUT;

Backing Up Backup Sets to Tape: Example In this example, the goal is to keep recent backup sets on disk and older backup sets on tape, and to avoid keeping copies of the same backup set on disk and tape simultaneously. This command backs up backup sets created more than two weeks ago to tape and then deletes the backed-up backup pieces from disk:

BACKUP DEVICE TYPE sbt BACKUPSET COMPLETED BEFORE 'SYSDATE-14' 
  DELETE INPUT;

Specifying DEVICE TYPE on the BACKUP Command: Example This example configures DISK as the default device type, then backs up the server parameter file and all archived logs to tape:

# when disk is the default device and you do not specify a FORMAT parameter, then the 
# default backup location is the flash recovery area (if configured) or 
# a platform-specific default location (if not configured)
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
BACKUP DEVICE TYPE sbt SPFILE ARCHIVELOG ALL;

Duplexing a Backup Set: Example This example duplexes a backup of datafile 1 (which includes the current control file and server parameter file) to separate disks:

BACKUP DEVICE TYPE DISK 
  COPIES 2 DATAFILE 1 
  FORMAT '/disk1/df1_%U', '/disk2/df1_%U';

Specifying How Channels Divide Workload: Example This example explicitly parallelizes a backup operation by specifying which channels should back up which files and to which locations:

RUN
{
  ALLOCATE CHANNEL ch1 DEVICE TYPE sbt PARMS="ENV=(NSR_SERVER=tape_server_1)";
  ALLOCATE CHANNEL ch2 DEVICE TYPE DISK;
  ALLOCATE CHANNEL ch3 DEVICE TYPE sbt PARMS="ENV=(NSR_SERVER=tape_server_2)";
  BACKUP 
    (DATAFILE 1,2,3,4        # channel ch1 backs up datafiles to tape drive #1
    CHANNEL ch1)
    (CONTROLFILECOPY '/oracle/copy/cf.f'
    CHANNEL ch2)             # channel ch2 backs up control file copy to disk
    (ARCHIVELOG FROM TIME 'SYSDATE-14'
    CHANNEL ch3);            # channel ch3 backs up archived redo logs to tape drive #2
}

Creating a Control File for a Standby Database: Example This example creates a backup of the current control file that can be used to create a standby database:

BACKUP CURRENT CONTROLFILE FOR STANDBY;

Creating an Incremental Backup for Refresh of a Standby Database: Example This example creates an incremental backup at a primary database that can be applied at a standby database to update it with changes since the specified SCN, as described inOracle Database Backup and Recovery Advanced User's Guide .

BACKUP DEVICE TYPE DISK INCREMENTAL FROM SCN 750983 DATABASE
     FORMAT '/tmp/incr_standby_%U';

Backing Up Datafiles, Tolerating Corrupt Blocks: Example This example backs up datafile 3 and specifies that no more than two blocks with corruption should be tolerated:

RUN
{
  SET MAXCORRUPT FOR DATAFILE 3 TO 2;
  BACKUP CHECK LOGICAL
    DATAFILE 3;
}

Making an Image Copy of a Database Copy: Example This example makes an image copy of the database copy with tag TEST to the default destination, gives the output copy the tag DUPTEST, and performs logical checking:

BACKUP AS COPY COPY OF DATABASE FROM TAG 'TEST' CHECK LOGICAL TAG 'DUPTEST';

Creating a Long-Term Database Backup: Example This example creates a consistent backup of the database and server parameter file that is exempt from the retention policy. The command instructs RMAN to keep the backup for the next year, but not to keep the archived logs necessary to recover it:

SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
BACKUP DATABASE 
  KEEP UNTIL TIME 'SYSDATE+365' 
  NOLOGS;
ALTER DATABASE OPEN;

Exempting Copies from the Retention Policy: Example The following example copies the control file and two datafiles and exempts them from the retention policy forever. (Note that KEEP FOREVER requires a recovery catalog.)

rman TARGET / CATALOG rman/rman@rcat
RMAN> SHUTDOWN IMMEDIATE;
RMAN> STARTUP MOUNT;
RMAN> BACKUP AS COPY 
  KEEP FOREVER NOLOGS
  CURRENT CONTROLFILE FORMAT '?/oradata/cf_longterm.cpy',
  DATAFILE 1 FORMAT '?/oradata/df1_longterm.cpy',
  DATAFILE 2 FORMAT '?/oradata/df2_longterm.cpy';
ALTER DATABASE OPEN;

Backing Up Files That Need Backups: Example This example backs up all datafiles that have not been backed up to tape in the last month, and then backs up all archived logs that do not have at least two backups on tape:

BACKUP DEVICE TYPE sbt DATABASE NOT BACKED UP SINCE TIME 'SYSDATE-31';
BACKUP DEVICE TYPE sbt ARCHIVELOG ALL NOT BACKED UP 2 TIMES;

Using NODUPLICATES To Back Up Datafile Copies: Example This example creates several duplicate datafiles, and then backs up only the most recent of the duplicates:

BACKUP AS COPY DATAFILE 10 FORMAT 'foo' TAG my_tag;
BACKUP AS COPY DATAFILECOPY 'foo' FORMAT 'bar';
BACKUP AS COPY DATAFILECOPY 'bar' FORMAT 'foobar';
BACKUP AS BACKUPSET DATAFILECOPY ALL NODUPLICATES; # backs up only 'foobar'
BACKUP AS BACKUPSET DATAFILECOPY ALL; # backs up all files