Oracle9i Recovery Manager Reference Release 1 (9.0.1) Part Number A90136-02 |
|
RMAN Commands , 9 of 60
backupSpec::=
backupOperand::=
backupSpecOperand::=
To back up a database, tablespace, datafile (current or copy), control file (current or copy), archived log, or backup set. You can back up a target or standby database.
When performing a backup, specify the files that you want to back up. RMAN puts the input files into one or more backup sets, which are RMAN-specific logical structures. The backup set is the smallest unit of a backup. RMAN only records backup sets in the repository that complete successfully.
Each backup set contains at least one backup piece, which is a 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.
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 job.
If CONFIGURE
CONTROLFILE
AUTOBACKUP
is ON
, then RMAN performs a control file autobackup in these circumstances:
BACKUP
or
COPY
command issued at the RMAN prompt.
BACKUP
or COPY
command within a RUN
block is followed by a command that is neither BACKUP
nor COPY
.
RUN
block if the last command in the block was either BACKUP
or COPY
.
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.
Oracle9i Recovery Manager User's Guide for a conceptual overview of RMAN backup sets, and Oracle9i Recovery Manager User's Guide to learn how to back up files
See Also:
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. Note that RMAN comes with a preconfigured DISK
channel.
Backups that use the disk test API are not supported for production backups (refer to Oracle9i Recovery Manager User's Guide). Instead, use the preconfigured
Note:
DISK
channel or manually allocate a 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 an Oracle 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 management software.
BACKUP_TAPE_IO_SLAVES
initialization parameter to TRUE
in order to perform duplexed backups. Otherwise, an error is signaled. RMAN configures as many spawned processes as needed for the number of backup copies you request.
When using the BACKUP
command, you cannot do the following:
NOARCHIVELOG
mode when the database is open or is closed after a crash or SHUTDOWN
ABORT
. You can only make a NOARCHIVELOG
backup when the database after a consistent shutdown.
DELETE
INPUT
option when backing up objects other than datafile copies, archived redo logs, or backup sets.
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 if you have not already configured a device type by using CONFIGURE
(except for DISK
, which is preconfigured).
BACKUP
with the DEVICE
TYPE
option.
CONFIGURE
BACKUP
COPIES
to duplex backup sets.
|
copies all blocks into the backup set, skipping only datafile blocks that have never been used. RMAN makes full backups by default if neither |
|
|
Copies only those data blocks that have changed since the last incremental integer backup, where integer is any integer from 1 to 4. For example, in a level 2 backup RMAN backs up all blocks used since the most recent level 2, level 1, or level 0 backup. This type of incremental backup is also called a differential backup to distinguish it from a cumulative backup. 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 or higher backup, RMAN makes a level 0 backup automatically.
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
If you specify
Note that you cannot make inconsistent incremental backups when the database is in See Also: "CHANGE" |
|
|
When you specify
The backupSpecPlus clause includes the same options as the backupSpec clause. |
|
|
A
Each backupSpec clause generates one or more backup sets. A backupSpec clause generates multiple backup sets if the number of datafiles specified in or implied by its list of objects exceeds the |
|
|
|
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 list of one or more datafiles.
Note: If you back up datafile 1, which is the first file of the See Also: "datafileSpec" |
|
|
|
Specifies the filenames of one or more datafile image copies. |
|
|
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. |
|
|
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. |
|
|
Specifies datafiles in the database.
To include the current control file in the backup set, specify the |
|
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 See Also: "archivelogRecordSpecifier" for syntax, and Oracle9i Recovery Manager User's Guide for explanations of backup failover for logs and automatic log switching |
|
|
|
specifies the current control file.
If you specify Note: You cannot assign a tag to a current control file. |
|
|
specifies the filename of a control file copy. 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. |
|
Specifies a filename to use for the backup piece. Any name that is legal as a sequential filename on the platform is allowed, if 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
You can specify up to four
Specify
If specified in more than one of these places, then RMAN searches for the
Note that the entire |
|
|
|
Specifies the copy number of the backup piece within a set of duplexed backup pieces. If you did not duplex a backup, then this variable is 1 for backup sets and 0 for proxy copies. If one of these commands is enabled, then the variable shows the copy number. The maximum value for |
|
|
Specifies the name of the database. |
|
|
Specifies the current day of the month from the Gregorian calendar in format |
|
|
Combines the DBID, day, month, year, and sequence into a unique and repeatable generated name. |
|
|
Specifies the month in the Gregorian calendar in format |
|
|
Specifies the name of the database, padded on the right with |
|
|
Specifies the piece number within the backup set. This value starts at
Note: If you specify |
|
|
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 |
|
|
Specifies the backup set time stamp, which is a 4-byte value derived as the number of seconds elapsed since a fixed reference time. The combination of |
|
|
Specifies the year, month, and day in this format: |
|
|
Specifies an 8-character name constituted by compressed representations of the backup set number and the time the backup set was created. |
|
|
Specifies a convenient shorthand for |
|
|
Specifies the year in this format: |
|
|
Specifies the '%' character. For example, |
|
Specifies the case-sensitive name of a channel to use when creating backup sets. Use any name that is meaningful, for example ch1 or dev1. Oracle uses the channel ID 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. |
|
|
Copies the data blocks used since the most recent backup at level n-1 or lower, where n is an integer from 1 to 4. For example, in a cumulative level 2 backup RMAN backs up all blocks used since the most recent level 1 or level 0 backup. |
|
|
Specifies a maximum size for a backup set in bytes (default), kilobytes (
RMAN attempts to limit all backup sets to this size. Use
When files are located on one disk and do not create an I/O distribution problem, the
Note: Because |
|
|
Specifies the maximum number of input files in each backup set. If you set
RMAN always attempts to create enough backup sets so that all allocated channels have work to do. An exception to the rule occurs when there are more channels than files to back up. For example, if RMAN backs up two datafiles when three channels are allocated and
See Also: The |
|
|
Specifies a quoted string containing operating system-specific information. RMAN passes the string to the operating system-dependent layer each time a backup piece is created. Currently, no |
|
|
Specifies the media pool in which the backup should be stored. Consult your media management documentation to see whether the |
|
|
Creates a user-specified tag for the backup set. Typically, a tag is a meaningful name such as |
|
|
You can also specify the tag at the backupSpec level. If you specify the tag at:
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. |
|
Overrides any configured retention policy for this backup so that the backup is not considered obsolete. You can use See Also: "keepOption" |
||
|
excludes datafiles or archived redo logs from the backup set. Note: You can also specify this option in the backupSpec clause. |
|
|
|
specifies that offline datafiles should be excluded from the backup set. |
|
|
specifies that read-only datafiles should be excluded from the backup set. |
|
|
specifies that datafiles or archived redo logs that cannot be read due to I/O errors should be excluded from the backup set. 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. |
|
When specified on |
|
|
Backs up the specified files by 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 run
Note: If you specify |
|
|
|
Causes Oracle to issue an error message when it cannot proxy copy rather than creating conventional backup sets. |
|
Causes RMAN to scan the specified files and verify their contents. 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. |
|
|
Causes RMAN to ignore backup optimization. In other words, even if Note: You can also specify this option in the backupSpecOperand clause. |
|
|
Directs RMAN to assign datafiles 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
If you set
The
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. |
|
|
Backs up only those files (of the files specified on the command) that RMAN has not backed up since the specified time. If
This clause is a useful way to back up files that were not backed up during a previous aborted backup. For example, you back up the database, but the instance crashes halfway through. You can then restart the backup by using the |
|
|
|
Specifies the date after which RMAN should back up files that have no backups. The date_string is either a date in the current
When determining whether a file has been backed up or not, the |
|
Suppresses block checksums. A checksum is a number that is computed from the contents of a data block. If the
Unless you specify the
See Also: Oracle9i Database Reference for more information about 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 remain below its
Note: For |
|
|
Specifies the number of identical backups ( |
|
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" |
||
|
Specifies a variety of options and parameters that affect the backupSpec clause. Most of the backupSpecOperand options are the same as the backupOperand options. Only the options unique to this clause are described below. |
|
|
|
creates a snapshot of the current control file and places it into each backup set produced by this clause.
If you specify |
|
|
deletes the input files upon successful creation of the backup set. Specify this option only when backing up archived logs, datafile copies, or backup sets. It is equivalent to issuing
The
Note: The See Also: "CONNECT" for information on the effect of recovery catalog compatibility on this command |
This command backs up the database to tape and then backs up the control file that contains the record of the database backup:
BACKUP DATABASE; BACKUP CURRENT CONTROLFILE;
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 '/fs1/%U'; ALLOCATE CHANNEL dev2 DEVICE TYPE DISK FORMAT '/fs2/%U'; BACKUP (TABLESPACE SYSTEM,sales1,sales2,sales3 FILESPERSET 20) (DATAFILE 12,14,15); }
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.
# channel configuration CONFIGURE DEVICE TYPE sbt PARALLELISM 2; CONFIGURE CHANNEL 1 DEVICE TYPE sbt PARMS="ENV=(NSR_SERVER=tape_server_1)"; CONFIGURE CHANNEL 2 DEVICE TYPE sbt PARMS="ENV=(NSR_SERVER=tape_server_2)"; # backup BACKUP FILESPERSET=20 FORMAT='AL_%d/%t/%s/%p' (ARCHIVELOG LIKE '/oracle/arch/dest1/%' CHANNEL ORA_SBT_TAPE_1) (ARCHIVELOG LIKE '/oracle/arch/dest2/%' CHANNEL ORA_SBT_TAPE_2);
This example assumes that you have two archive destinations set: /arch/dest1
and /arch/dest2
. The command backs up one log for each unique sequence number and then deletes all logs from both archiving directories.
BACKUP ARCHIVELOG LIKE '/arch/dest%' DELETE ALL INPUT;
In this example, you want to keep recent backup sets on disk and older backup sets on tape. You do not want backup sets to exist on disk and tape simultaneously. Hence, you execute this command to back up older backups created more than two weeks ago to tape and then delete the input backup pieces:
BACKUP DEVICE TYPE sbt BACKUPSET CREATED BEFORE 'SYSDATE-14' DELETE INPUT;
This example configures DISK
as the default device type, then backs up archived logs to tape:
CONFIGURE DEFAULT DEVICE TYPE TO DISK; BACKUP DEVICE TYPE sbt ARCHIVELOG ALL;
This example backs up all blocks changed in the database since the most recent level 0 or level 1 backup:
BACKUP INCREMENTAL LEVEL 2 CUMULATIVE SKIP INACCESSIBLE DATABASE;
This example duplexes a backup of datafile 1 to separate file systems:
BACKUP COPIES 2 DATAFILE 1 FORMAT '/fs1/df1_%U', '/fs2/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 RATE 1500K; 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 }
The following script distributes datafile and archived log backups across two nodes in an Oracle Real Application Clusters environment:
RUN { ALLOCATE CHANNEL node_1 DEVICE TYPE sbt CONNECT 'SYS/sys_pwd@node_1' PARMS 'ENV=(DSMO_NODE=KDFDWD01_ORACLE)' FORMAT '%d_set%s_%t_piece%p'; SET LIMIT CHANNEL node_1 KBYTES=1000000; SET COMMAND ID TO 'node_1'; ALLOCATE CHANNEL node_2 DEVICE TYPE sbt CONNECT 'SYS/sys_pwd@node_2' PARMS 'ENV=(DSMO_NODE=KDFDWD01_ORACLE)' FORMAT '%d_set%s_%t_piece%p'; SET LIMIT CHANNEL node_2 KBYTES=1000000; SET COMMAND ID TO '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 ALL INPUT # deletes all logs that match LIKE criteria CHANNEL node_1); (ARCHIVELOG UNTIL TIME 'SYSDATE' LIKE '/node2/arc/%' DELETE ALL INPUT # deletes all logs that match LIKE criteria CHANNEL node_2); }
This example creates a backup of the current control file that can be used to create a standby database:
BACKUP STANDBY CONTROLFILE;
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 creates a consistent backup of the database that is exempt from the retention policy and tells RMAN to keep the backup for the next year, but not to keep the archived logs necessary to recover it:
SHUTDOWN; STARTUP MOUNT; BACKUP DATABASE UNTIL 'SYSDATE+365' NOLOGS;
This example backs up all database files and archived logs that have not been backed up in the last month:
BACKUP DATABASE, ARCHIVELOG ALL NOT BACKED UP SINCE TIME 'SYSDATE-31';
This sample UNIX shell script can generate RMAN backups with unique backup tag names:
#!/bin/sh today=`date +%a` rman <<EOF CONNECT TARGET /; CONNECT CATALOG rman/rman@rcdb; BACKUP DATABASE PLUS ARCHIVELOG TAG '$today'; EOF
|
![]() Copyright © 1996-2001, Oracle Corporation. All Rights Reserved. |
|