Oracle® Database Recovery Manager Reference 10g Release 1 (10.1) Part Number B10770-02 |
|
|
View PDF |
backup::=
Text description of backupOperand
backupSpec::=
Text description of backupSpec
Text description of backupSpecOperand
Text description of backupTypeSpec
copyOfSpec::=
Text description of copyOfSpec
Text description of datafileCopySpec
duration::=
Text description of forRecoveryOfSpec
Text description of notBackedUpSpec
sizeSpec::=
skipSpec::=
To back up a database, tablespace, datafile (current or copy), control file (current or copy), SPFILE, archived log, or backup set. (These are the only file types that can be backed up by RMAN.) can back up a target or standby database. The term backup refers to the files created by an RMAN BACKUP
command.
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.
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.
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 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.
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.
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. 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.
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:
CONFIGURE
BACKUP
OPTIMIZATION
ON
command has been run.BACKUP
DATABASE
, BACKUP
ARCHIVELOG
with ALL
or LIKE
options, or BACKUP
BACKUPSET
ALL
.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.
When using the BACKUP
command you must:
ARCHIVELOG
mode, but you must apply redo logs to make the backups consistent for use in restore operations.BACKUP
command if no automatic channel is configured for the specified device type. If no manual channel is allocated, then RMAN uses the default channels (refer to description of CONFIGURE
command). RMAN comes with a preconfigured DISK
channel.
DEVICE
TYPE
DISK
, then RMAN will back up to random access disks. You can make a backup on any device that can store a datafile: in other words, if the statement CREATE
TABLESPACE
tablespace_name
DATAFILE
'filename'
works, then 'filename'
is a valid backup path name. If you specify DEVICE
TYPE
sbt
, then you can back up to any media supported by the media manager.When using the RMAN BACKUP
command, you cannot perform any of the following actions:
NOARCHIVELOG
mode when the database is open or is closed after an instance failure or SHUTDOWN
ABORT
. You can only backup a database running in NOARCHIVELOG
mode after a consistent shutdown.FORMAT
strings within a single backupSpec
(for example, BACKUP
DATAFILE
3
TO
'/tmp/foo',
DATAFILE
4
TO
'/tmp/foo'
). However, RMAN permits a single FORMAT
string to exist in multiple backupSpec
clauses.DELETE
INPUT
option when backing up objects other than datafile copies, archived redo logs, or backup sets.BACKUP
AS
COPY
) on a nondisk media device.PLUS
ARCHIVELOG
clause on the BACKUP
ARCHIVELOG
command.NOARCHIVELOG
mode database while it is being backed up. If you do, and some data blocks in the files being backed up are modified before being read by the backup session, then the backup is not usable after being restored because it requires recovery.DEVICE
TYPE
option for a device other than DISK
if you have not already run CONFIGURE
DEVICE
TYPE
for this device.BACKUP
with the DEVICE
TYPE
option.DEVICE
TYPE
DISK
when running the BACKUP
RECOVERY
AREA
command.Syntax Element | Description |
---|---|
|
Specifies various options for the |
|
Specifies the type of backup being created, either backup sets or image copies. See |
|
Specifies the case-sensitive name of a channel to use when creating backups. Use any name that is meaningful, for example Note: You can also specify this parameter in the |
|
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 If the sum of physical and logical corruptions detected for a file is no more than its If the initialization parameter Note: The |
|
Sets the number of identical backups ( Note: This option does not apply with Note: Duplexing cannot be used when creating files in the flash recovery area. |
|
Copies the data blocks used since the most recent backup at level 0 or lower, where Note: This option does not apply with |
|
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 BACKUP DEVICE TYPE DISK DATABASE; See Also: "deviceSpecifier" |
|
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 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 If you set The 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 to keep the tape streaming. Otherwise, you increase restore time for a file without increasing performance. |
Specifies options related to the maximum time for a backup command to run. See Also: "duration" |
|
|
This option is valid only when See "fileNameConversionSpec" for details about file renaming patterns. |
|
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.. |
|
Causes RMAN to ignore backup optimization. In other words, even if Note: You can also specify this option in the |
|
Specifies a pattern to use in creating a filename for the backup pieces or image copies created by this command. For See Also: "formatSpec" for legal substitution variables |
|
Identifies the backup being created as an incremental backup to be used in rolling forward an image copy. See "forRecoveryOfSpec" for details. |
|
Copies all blocks into the backup set or image copy, skipping only datafile blocks that have never been used. RMAN makes full backups by default if neither 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). |
|
Copies only those data blocks that have changed since the last incremental 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
If you specify Note: You cannot make inconsistent incremental backups when the database is in 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 See Also: "CHANGE" |
Overrides any configured retention policy for this backup so that the backup is not considered obsolete. You can use See Also: "keepOption" |
|
|
Specifies a maximum size for a backup set.RMAN limits all backup sets to this size. Use Specify size in bytes (default), kilobytes ( The default number of files in each backup set is 4 for datafiles and 16 for archived logs. When you specify Note: This option cannot be used with |
|
Suppresses block checksums. A checksum is a number that is computed from the contents of a data block. If the 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 See Also: Oracle Database Reference for more information about the |
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. |
|
|
When specified on |
|
Specifies the media pool in which the backup should be stored. Consult your media management documentation to see whether the Note: This option does not apply with |
|
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
If you do not want RMAN to try a conventional copy when a proxy copy fails, use the Note: If you specify Note: This option cannot be used with |
Causes the database to issue an error message when it cannot proxy copy rather than creating conventional backup sets. |
|
|
Enables RMAN to overwrite an already existing backup or copy with the same filename as the file that |
Excludes datafiles or archived redo logs from the backup if they are inaccessible, offline or read-only. See |
|
|
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 A tag applies to each backup piece in a given copy of a backup set (for Typically, a tag is a meaningful name such as You can also specify the tag at the |
|
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. |
Syntax Element | Description |
---|---|
|
A Each |
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 If you specify If the database is open when you run Note: If you run 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 |
|
|
Backs up either Note if you specify the 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 See Also: "completedTimeSpec" |
|
Specifies a control file copy in one of the following ways:
The control file copy can be:
RMAN inspects the header of the control file copy to determine whether it is a standby or nonstandby control file. |
Makes a backup of previous image copies of datafiles and possibly control files. See "copyOfSpec" for details. |
|
|
Specifies the current control file. If you specify Note: You cannot assign a tag to a backup of the current control file. |
|
Creates a backup set ( If the If the Note: To force RMAN to include the current control file in the backup when |
Specifies the filenames of one or more datafile image copies. See "datafileCopySpec" for details. |
|
|
Specifies a list of one or more datafiles. Refer to description of See Also: "datafileSpec" |
|
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.
Backup optimization is always 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. |
|
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 |
|
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 |
|
Specifies the names of one or more tablespaces. RMAN backs up all datafiles that are currently part of the tablespaces. If the The |
The |
Syntax Element | Description |
---|---|
|
Specifies a variety of options and parameters that affect the |
|
Deletes the input files upon successful creation of the backup. Specify this option only when backing up archived logs, datafile copies ( The Note: The See Also: "CONNECT" for information on the effect of recovery catalog compatibility on this command |
|
Allows specifying a backup by tag. Defined in context with several other commands. |
|
Creates a snapshot of the current control file and places it into each backup set produced by this clause. If you specify Note: This option does not apply with |
Syntax Element | Description |
---|---|
Makes a backup of previous image copies of all datafiles and control files in the database. All datafiles that would normally be included by Note: The output of this command can be image copies or backup sets. |
|
Makes a backup of previous image copies of the datafiles in one or more specified tablespaces. All datafiles that would normally be included by Specify the tablespaces in the list by tablespace name (for example, Note: The output of this command can be image copies or backup sets. |
|
|
Makes a backup of a previous image copy of one or more datafiles. Specify the datafile by file number ( Note: It is not necessary for the image copies that you are backing up to have been created by a single Note: The output of this command can be image copies or backup sets. See Also: "datafileSpec" |
Syntax Element | Description |
---|---|
|
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. |
|
Lets you specify that this incremental should contain all changes since the SCN of a datafile copy (level 0 incremental backup) of your database. The datafile copies should be identified with either a |
Used with |
|
Used with |
Syntax Element | Description |
---|---|
|
Specifies the size of data, such as a file, in kilobytes (K), megabytes (M) or gigabytes (G). |
Syntax Element | Description |
---|---|
|
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 |
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. |
|
Specifies that offline datafiles should be excluded from the backup. |
|
Specifies that read-only datafiles should be excluded from the backup. |
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;
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;
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;
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 (TABLESPACE SYSTEM, tools, users, undotbs MAXSETSIZE 5M) (DATAFILE 2,4,5); }
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 MAXSETSIZE 5M) (DATAFILE 2,4,5); }
This example finds three datafile copies with the tag LATESTCOPY
, copies them to directory /copies
and names the copies by means of subsitution variables:
BACKUP AS COPY FROM TAG 'LATESTCOPY' COPY OF DATAFILE 4, 6, 14 FORMAT '/copies/Datafile%f_Database%d';
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;
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;
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;
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';
This example parallelizes a backup operation by specifying which channels should back up which files and to which location:
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 }
This example creates a backup of the current control file that can be used to create a standby database:
BACKUP CURRENT CONTROLFILE FOR STANDBY;
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; }
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';
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;
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;
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;
This example creates several duplicate datafiles, and then backs up only the most recent of the duplicates:
RMAN> backup as copy datafile 10 format 'foo' tag my_tag; RMAN> backup as copy datafilecopy 'foo' format 'bar'; RMAN> backup as copy datafilecopy 'bar' format 'foobar'; RMAN> backup as backupset datafilecopy all noduplicates; # backs up only 'foobar' RMAN> backup as backupset datafilecopy all; # backs up all files
The following UNIX example backs up an older version of the server parameter file. RMAN can only back up the copy of the server parameter file currently in use by the target database:
# create temporary initialization parameter file that points to old SPFILE echo "SPFILE=/tmp/old_spfile.ora" > /tmp/initTEMP.ora rman TARGET / # start database with old SPFILE STARTUP FORCE PFILE=/tmp/initTEMP.ora # backup old SPFILE BACKUP SPFILE TAG "old_spfile.bak"; # restart database with current SPFILE STARTUP FORCE; EXIT