Oracle9i Recovery Manager Reference Release 2 (9.2) Part Number A96565-01 |
|
RMAN Commands , 9 of 59
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.
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.
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
.In a Real Application Clusters configuration, RMAN automatically uses the appropriate channels to back up datafile and control file copies, archived logs, and backup sets. RMAN only performs the backups on channels that can read the files on the file system. For example, if channel 1 connected to instance 1 can read log 1000 on its local file system, but a channel 2 connected to instance 2 cannot read the log on its local file system, then channel 1 backs up the log. Autolocation is automatically enabled when the channels meet any of the following criteria:
PARMS
settingsCONNECT
strings
See Also:
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 |
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).DISK
channel.
Note: 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 |
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 manager.BACKUP_TAPE_IO_SLAVES
initialization parameter to TRUE
when duplexing backups (this parameter is not required for non-duplexed backups). Otherwise, Oracle signals an error. RMAN configures as many spawned processes as needed for the number of duplexed backup copies you request.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 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 for a device other than DISK
if you have not already run CONFIGURE
DEVICE
TYPE
for this device.BACKUP
with the DEVICE
TYPE
option.Syntax Element | Description |
---|---|
|
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 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, then 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 is usable by a subsequent
If you specify Note: You cannot make inconsistent incremental backups when the database is in See Also: "CHANGE" |
|
When you specify
The |
|
A Each |
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. Refer to description of 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. Tags are not case sensitive. |
|
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. |
|
Creates a backup set containing all datafiles in the database. RMAN can include only datafiles and control files in the backup set: it cannot include archived redo logs. If a backup includes datafile If a backup includes datafile Note: To force RMAN to include the current control file in the backup set when |
|
|
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 backup of the 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. |
|
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 various options for the |
|
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: 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 the Gregorian calendar 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 ' |
|
|
Specifies the case-sensitive name of a channel to use when creating backup sets. Use any name that is meaningful, for example Note: You can also specify this parameter in the |
|
Copies the data blocks used since the most recent backup at level |
|
Specifies a maximum size for a backup set in bytes (default), kilobytes ( RMAN limits 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 name for a backup set. The tag name is not case sensitive. If you do not specify a tag name, then by default RMAN creates a tag for backups and copies (except for control file autobackups) in the format A tag applies to each backup piece in a given copy of a backup set. For example, if you run Typically, a tag is a meaningful name such as You can also specify the tag at the |
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 according to the criteria specified by the following keywords. Note: You can also specify this option in the |
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 means of 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 |
|
Directs RMAN to populate each backup set with datafiles from at least 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
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 never backed up. This option is a convenient way to back up new files after adding them to the database. |
Specifies the date after which RMAN should back up files that have no backups. The 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 When determining whether a file has been backed up, the |
|
Backs up only those archived logs that have not been backed up at least 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). |
|
|
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 |
|
Sets 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 |
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 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 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 FILESPERSET 20) (DATAFILE 2,4,5); }
This example backs up the archived redo logs in %/arch1
to one set of tapes and the logs from %/arch2
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 '%/arch1/%' CHANNEL ORA_SBT_TAPE_1) (ARCHIVELOG LIKE '%/arch2/%' CHANNEL ORA_SBT_TAPE_2);
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, 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 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:
CONFIGURE DEFAULT DEVICE TYPE TO DISK; BACKUP DEVICE TYPE sbt SPFILE 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
(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 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/arch/%' DELETE ALL INPUT # deletes all logs that match LIKE criteria CHANNEL node_1); (ARCHIVELOG UNTIL TIME 'SYSDATE' LIKE '%/node2/arch/%' 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 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 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;
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;
The following UNIX shell script backs up an older of the server parameter file. RMAN can only back up the copy of the server parameter file currently in use by the target database:
#!/usr/bin/tcsh # create temporary initialization parameter file that points to old SPFILE echo "SPFILE=/tmp/old_spfile.ora" > /tmp/initTEMP.ora rman TARGET / <<EOF # 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 EOF
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|