Skip Headers

Oracle9i Recovery Manager Reference
Release 2 (9.2)

Part Number A96565-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

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

RMAN Commands , 9 of 59


BACKUP

Syntax

Text description of rcmsynta47.gif follows
Text description of the illustration rcmsynta47.gif


backupSpec::=
Text description of backupSpec.gif follows
Text description of the illustration backupSpec.gif


backupOperand::=
Text description of backupOperand.gif follows
Text description of the illustration backupOperand.gif


backupSpecOperand::=
Text description of backupSpecOperand.gif follows
Text description of the illustration backupSpecOperand.gif


Purpose

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:

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:

Restrictions and Usage Notes

When using the BACKUP command you must:

When using the RMAN BACKUP command, you cannot perform any of the following actions:

Keywords and Parameters

Syntax Element Description

FULL

copies all blocks into the backup set, skipping only datafile blocks that have never been used. RMAN makes full backups by default if neither FULL nor INCREMENTAL is specified. The server session does not skip blocks when backing up archived redo logs or control files. A full backup has no effect on subsequent incremental backups, so it is not considered a part of the incremental backup strategy.

INCREMENTAL LEVEL = integer

Copies only those data blocks that have changed since the last incremental integer backup, where integer is any integer from 0 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, 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 RECOVER command. Among the checks performed are:

  • A level 0 backup set must exist, or level 0 datafile copies must exist for each datafile in the BACKUP command. These backup sets must not be marked UNAVAILABLE. If no level 0 backup exists, then RMAN automatically generates 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.

See Also: "CHANGE"

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.

The backupSpecPlus clause includes the same options as the backupSpec clause.

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. A backupSpec clause generates multiple backup sets if the number of datafiles specified in or implied by its list of objects exceeds the FILESPERSET limit.

BACKUPSET

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"

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"

DATAFILECOPY 'filename'

Specifies the filenames of one or more datafile image copies.

DATAFILECOPY TAG = tag_name

Specifies a list of one or more datafile copies, identified by tag. If multiple datafile copies with this tag exist, then Oracle backs up only the most current datafile copy of any particular datafile. Tags are not case sensitive.

TABLESPACE tablespace_name

Specifies the names of one or more tablespaces. RMAN backs up all datafiles that are currently part of the tablespaces.

This keyword is provided merely as a convenience; Oracle translates the tablespace name internally into a list of datafiles.

DATABASE

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 1, and if CONFIGURE CONTROLFILE AUTOBACKUP is OFF, then RMAN automatically includes the control file in the backup set. If the instance is started with a server parameter file, then RMAN also includes this parameter file in the backup.

If a backup includes datafile 1, and if CONTROLFILE AUTOBACKUP is ON, then RMAN does not automatically include the control file in the datafile backup set. 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 set when CONTROLFILE AUTOBACKUP is ON, specify the INCLUDE CURRENT CONTROLFILE clause.

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 logs to multiple destinations, RMAN backs up one copy of each log sequence number--not each archived copy of each log sequence number. For other commands, such as DELETE, ALL does refer to every log, even duplicate log sequences.

See Also: "archivelogRecordSpecifier" for syntax, and Oracle9i Recovery Manager User's Guide for explanations of backup failover for logs and automatic log switching

CURRENT CONTROLFILE

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.

CONTROLFILECOPY 'filename'

Specifies the filename of a control file copy. The control file copy can be:

  • A copy of a normal control file (that is, not a standby control file) created with the COPY CURRENT CONTROLFILE command or the SQL statement ALTER DATABASE BACKUP CONTROLFILE TO '...'
  • A standby control file copy created with the 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.

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.

backupOperand

Specifies various options for the BACKUP command. Most of the options for this clause are shared with "backupSpecOperand".

FORMAT = 'format_string'

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 FORMAT parameter, RMAN stores the backup pieces in a port-specific directory (?/dbs on UNIX).

You can specify up to four FORMAT strings. RMAN uses the second, third, and fourth values only when BACKUP COPIES, SET BACKUP COPIES, or CONFIGURE ... BACKUP COPIES is in effect. When choosing the format for each backup piece, RMAN uses the first format value for copy 1, the second format value for copy 2, and so on. If the number of format values exceeds the number of copies, then the extra formats are not used. If the number of format values is less than the number of copies, then RMAN reuses the format values, starting with the first one.

Specify FORMAT in any of these places, listed in order of precedence:

  1. The backupSpec clause
  2. The BACKUP command
  3. The ALLOCATE CHANNEL command
  4. The CONFIGURE CHANNEL command

If specified in more than one of these places, then RMAN searches for the FORMAT parameter in the order shown.

Note: The entire FORMAT string is processed in a port-specific manner by the target instance to derive the final backup piece name. The following substitution variables are available in FORMAT strings to aid in generating unique filenames. The formatting of this information varies by platform.

%c

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 %c is 256.

%d

Specifies the name of the database.

%D

Specifies the current day of the month from the Gregorian calendar in format DD.

%F

Combines the DBID, day, month, year, and sequence into a unique and repeatable generated name.

%M

Specifies the month in the Gregorian calendar in format MM.

%n

Specifies the name of the database, padded on the right with x characters to a total length of eight characters. For example, if the prod1 is the database name, then the padded name is prod1xxx.

%p

Specifies the piece number within the backup set. This value starts at 1 for each backup set and is incremented by 1 as each backup piece is created.

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

%s

Specifies the backup set number. This number is a counter in the control file that is incremented for each backup set. The counter value starts at 1 and is unique for the lifetime of the control file. If you restore a backup control file, then duplicate values can result. Also, CREATE CONTROLFILE initializes the counter back to 1.

%t

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 %s and %t can be used to form a unique name for the backup set.

%T

Specifies the year, month, and day in the Gregorian calendar in this format: YYYYMMDD.

%u

Specifies an 8-character name constituted by compressed representations of the backup set number and the time the backup set was created.

%U

Specifies a convenient shorthand for %u_%p_%c that guarantees uniqueness in generated backup filenames. If you do not specify a format, then RMAN uses %U by default.

%Y

Specifies the year in this format: YYYY.

%%

Specifies the '%' character. For example, %%Y translates to the string %Y.

CHANNEL channel_id

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

CUMULATIVE

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.

MAXSETSIZE = integer

Specifies a maximum size for a backup set in bytes (default), kilobytes (K), megabytes (M), and gigabtyes (G). Thus, to limit a backup set to 3 MB, specify MAXSETSIZE = 3M. The default size is in bytes, rounded down from kilobtyes. 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.

RMAN limits all backup sets to this size. Use MAXSETSIZE to configure backup sets so that each fits on one tape rather than spans 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.

When files are located on one disk and do not create an I/O distribution problem, the MAXSETSIZE parameter is easier to use than FILESPERSET. The FILESPERSET parameter is more useful for managing I/O distribution for backups of files on multiple disks.

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

FILESPERSET = integer

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

RMAN always attempts to create enough backup sets so that all allocated channels have work to do. An exception to the rule occurs when there are more channels than files to back up. For example, if RMAN backs up two datafiles when three channels are allocated and FILESPERSET = 1, then one channel is necessarily idle.

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

PARMS = 'channel_parms'

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 PARMS settings are available when specified in the BACKUP command, although you can specify PARMS in the ALLOCATE CHANNEL or CONFIGURE CHANNEL command.

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.

TAG tag_name

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 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 may receive the tag TAG20020208T133437. The date and time refer to when RMAN started the backup. If multiple backup sets are created by one BACKUP command 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 example, if you run BACKUP 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 must be 30 characters or less. Tags are reusable, so that backup set 100 can have the tag MONDAY_EVENING_BACKUP one week while backup set 105 has the same tag the next week.

You can also specify the tag at the backupSpec level. If you specify the tag at:

  • The command level, then all backup sets created by 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.

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"

SKIP

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

OFFLINE

Specifies that offline datafiles should be excluded from the backup set.

READONLY

Specifies that read-only datafiles should be excluded from the backup set.

INACCESSIBLE

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

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.

NOEXCLUDE

When specified on BACKUP 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.

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 Oracle 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. RMAN attempts a conventional (that is, nonproxy) backup of the specified files unless the ONLY option is specified, in which case it does not attempt a conventional backup.
  2. If RMAN locates a proxy-capable channel, it calls the media manager to check whether it can proxy copy the file. If the media manager cannot proxy copy the file, then RMAN uses conventional backup sets to back up the file.

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

ONLY

Causes Oracle to issue an error message when it cannot proxy copy rather than creating conventional backup sets.

VALIDATE

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.

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.

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=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 to keep the tape streaming. Otherwise, you increase restore time for a file without increasing performance.

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 BACKUP UP SINCE TIME clause and avoid backing up those files that you already backed up. This feature is only useful if RMAN generates multiple backup sets during the backup. Thus, set the FILESPERSET parameter to a low value so that RMAN generates multiple backup sets.

When determining whether a file has been backed up, the SINCE date is compared with the completion time of the most recent backup. 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. 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 archived logs on a specified media (for example, you want to keep at least three copies of each log on tape).

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 Oracle computes a checksum for each block and stores it in the block before writing the block to disk. When Oracle reads the block from disk later, it makes sure that the block generates the same checksum. If it does not, then the block is damaged.

Unless you specify the NOCHECKSUM option, Oracle computes a checksum for each block and stores it in the backup. The checksum is verified when restoring from the backup and written to the datafile when restored. If the database is already maintaining block checksums, then this flag has no effect. The checksum is always verified and stored in the backup in this case.

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

CHECK LOGICAL

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

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

Note: For COPY and BACKUP the MAXCORRUPT setting represents the total number of physical and logical corruptions permitted on a file.

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

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"

backupSpecOperand

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 included in the following parameter descriptions.

INCLUDE CURRENT CONTROLFILE

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.

DELETE INPUT

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

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;
Backing Up Tablespaces and Datafiles: 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 
    (TABLESPACE SYSTEM, tools, users, undotbs FILESPERSET 20)
    (DATAFILE 2,4,5);
}
Backing Up Multiple Copies of Archived Redo Logs: Example

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); 
Backing Up Multiple Copies of 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, 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;
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:

CONFIGURE DEFAULT DEVICE TYPE TO DISK;
BACKUP DEVICE TYPE sbt SPFILE ARCHIVELOG ALL;
Performing a Cumulative Incremental Backup: Example

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;
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 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
}
Performing an Oracle Real Application Clusters Backup: Example

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);
}
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;
Checking for Corruption: 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;
}
Creating a Long-Term 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;
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;
Backing Up a Noncurrent Server Parameter File: Example

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

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

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback