Backing up a database with RMAN is meant to be simple. Therefore, for most of the parameters required for RMAN backup, there are sensible defaults which will let you do basic backup and recovery without extensive setup or configuration.
However, when implementing an RMAN-based backup strategy, you can use RMAN more effectively if you understand the more common options available to you. Many of these can be set in the RMAN environment on a persistent basis, so that you do not have to specify the same options every time you issue a command.
The following discussion presents how RMAN's default behaviors can be changed for your backup and recovery environment and strategies, and introduces the major settings available to you and their most common possible values.
This section includes the following topics:
Persistent Configuration Settings: Controlling RMAN Behavior
Configuring Compressed Backupsets as Default for Tape or Disk
Configuring Control File and Server Parameter File Autobackup
To simplify ongoing use of RMAN for backup and recovery, the RMAN lets you set a number of persistent configuration settings for each target database. These settings control many aspects of RMAN's behavior when working with that database, such as backup retention policy, default destinations for backups to tape or disk, default backup device type (tape or disk), and so on.
The default values for these configuration settings let you use RMAN effectively without changing any of them. However, as you develop a more advanced backup and recovery strategy, you will have to change these settings to implement that strategy. Use the RMAN SHOW
and CONFIGURE
commands to view and change the RMAN configuration settings.
The SHOW
command is used to display the current value of one or all of RMAN's configured settings, as well as whether those commands are currently set to their default value.
After you connect to the target database and recovery catalog (if you use one), run the SHOW
command with the name of a setting you wish to view. For example:
RMAN> SHOW RETENTION POLICY; RMAN> SHOW DEFAULT DEVICE TYPE;
The SHOW
ALL
command displays the current settings of all parameters that you can set with the CONFIGURE
command. The output includes both parameters you have changed and parameters that are still set to the default.
To view all configured settings, run the RMAN SHOW
ALL
command, as in this example:
RMAN> SHOW ALL; # shows all CONFIGURE settings, both user-entered and default
Sample output for SHOW
ALL
follows:
RMAN configuration parameters are: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS; CONFIGURE BACKUP OPTIMIZATION ON; CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET; CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=mylibrary.disksbt,ENV=(BACKUP_PARAM=value)'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/disk1/oracle/dbs/snapcf_ev.f'; # default
The configuration is displayed as the series of RMAN commands required to re-create the configuration. You can save the output of SHOW ALL
into a text file and use that command file to re-create the configuration on the same or a different target database.
You can return any setting to its default value by using CONFIGURE... CLEAR
, as in these examples:
RMAN> CONFIGURE BACKUP OPTIMIZATION CLEAR;
RMAN> CONFIGURE RETENTION POLICY CLEAR;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR;
By default, RMAN sends all backups to an operating system specific directory on disk. You can also configure RMAN to make backups to media such as tape.
After configuring an sbt
(that is, tape or media management) device according to the instructions in your media management vendor documentation, you can make the media manager the default device:
CONFIGURE DEFAULT DEVICE TYPE TO sbt;
After configuring the default device type, the backups produced by any BACKUP
command which does not specify the destination device type are directed to the configured default device type. For example, the following commands would produce a series of backups on tape:
CONFIGURE DEFAULT DEVICE TYPE TO sbt; BACKUP DATABASE; BACKUP DATAFILE 3; BACKUP DATABASE PLUS ARCHIVELOG;
To configure disk as the default device for backups, you can either use CONFIGURE
... CLEAR
to restore the default setting, or explicitly configure the default device as shown:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
Note:
You can always direct backups to a specific device type,DISK
or SBT
, using the DEVICE
TYPE
clause of the BACKUP
command. For example:
BACKUP DEVICE TYPE sbt DATABASE; BACKUP DEVICE TYPE DISK DATABASE;
See Oracle Database Backup and Recovery Reference for more details on using the BACKUP
command with the DEVICE
TYPE
clause.
You can configure backup sets or image copies as the default, using either of the following commands:
RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COPY; # image copies
RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET; # uncompressed
The default for backups to disk, as with tape, is backup set. Note that there is no analogous option for media manager devices, because RMAN can only write backups to media manager devices as backup sets.
You can configure RMAN to use compressed backupsets by default on a particular device type, by using the CONFIGURE DEVICE TYPE
command with the BACKUP TYPE TO COMPRESSED BACKUPSET
option, as shown in the following examples.
RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET; RMAN> CONFIGURE DEVICE TYPE sbt BACKUP TYPE TO COMPRESSED BACKUPSET;
To disable compression, use the CONFIGURE DEVICE TYPE
command with arguments specifying your other desired settings, but omitting the COMPRESSED
keyword, as in the following examples:
RMAN> CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET; RMAN> CONFIGURE DEVICE TYPE sbt BACKUP TYPE TO BACKUPSET;
RMAN channels (connections to server sessions on the target database) perform all RMAN tasks. By default, RMAN allocates one disk channel for all operations.
The following command configures RMAN to write disk backups to the /backup
directory (refer to "Backing Up Database Files and Archived Logs with RMAN").:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/backup/ora_df%t_s%s_s%p';
The format specifier %t
is replaced with a four byte time stamp, %s
with the backup set number, and %p
with the backup piece number.
You can also configure an Automatic Storage Management disk group as your destination, as in the following example:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '+dgroup1';
Note:
By configuring an explicit format for disk channels, you direct backups away from the flash recovery area, if you have configured one. You lose the disk space management capabilities of the flash recovery area.Some media managers require configuration settings that are passed by including a PARMS
string in the CONFIGURE
command, as follows:
CONFIGURE CHANNEL DEVICE TYPE sbt PARMS='ENV=mml_env_settings';
The contents of your PARMS
string depend on your media management library. Refer to your media management vendor's documentation for details.
You can configure parallelism settings, backup set compression and other options for the SBT device using CONFIGURE
DEVICE
TYPE
SBT
. (These settings for the device type are set independently of the channel configuration for your device set in the previous example.) The following command configures two sbt
channels for use in RMAN jobs:
CONFIGURE DEVICE TYPE sbt PARALLELISM 2; old RMAN configuration parameters: CONFIGURE DEVICE TYPE 'SBT_TAPE' BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1; new RMAN configuration parameters: CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET; new RMAN configuration parameters are successfully stored RMAN> configure device type sbt backup type to backupset; old RMAN configuration parameters: CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET; new RMAN configuration parameters: CONFIGURE DEVICE TYPE 'SBT_TAPE' BACKUP TYPE TO BACKUPSET PARALLELISM 2; new RMAN configuration parameters are successfully stored
Note that the CONFIGURE commands used in this example to set parallelism and backup type do not affect the values of settings not specified, that is, the default backup type of compressed backupset was not changed by the CONFIGURE
DEVICE
TYPE
SBT
PARALLELISM
1
command.
RMAN can be configured to automatically back up the control file and server parameter file whenever the database structure metadata in the control file changes and whenever a backup record is added. The autobackup enables RMAN to recover the database even if the current control file, catalog, and server parameter file are lost.
Because the filename for the autobackup uses a well-known format, RMAN can search for it without access to a repository, and then restore the server parameter file. After you have started the instance with the restored server parameter file, RMAN can restore the control file from an autobackup. After you mount the control file, the RMAN repository is available and RMAN can restore the datafiles and find the archived redo log.
You can enable the autobackup feature by running this command:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
You can disable the feature by running this command:
CONFIGURE CONTROLFILE AUTOBACKUP OFF;
See Also:
Oracle Database Backup and Recovery Advanced User's Guide for a conceptual overview of control file autobackups
Oracle Database Backup and Recovery Reference for CONFIGURE
syntax
By default, the format of the autobackup file for all configured devices is the substitution variable %F
. This variable format translates into c-IIIIIIIIII-YYYYMMDD-QQ
, where:
IIIIIIIIII
stands for the DBID.
YYYYMMDD
is a time stamp of the day the backup is generated
QQ
is the hex sequence that starts with 00
and has a maximum of FF
You can change the default format by using the following command, where deviceSpecifier
is any valid device such as DISK
or sbt
, and 'string
' must contain the substitution variable %F
(and no other substitution variables) and is a valid handle for the specified device:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE deviceSpecifier TO 'string';
For example, you can run the following command:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '?/oradata/cf_%F';
The following example configures the autobackup to write to an Automatic Storage Management disk group:
CONFIGURE CONTROLFILE AUTOBACKUP FOR DEVICE TYPE DISK TO '+dgroup1/%F';
To clear control file autobackup formats for a device, use the following commands:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK CLEAR; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE sbt CLEAR;
If you have set up a flash recovery area for your database, you can direct control file autobackups to the flash recovery area by clearing the control file autobackup format for disk.
The SET
CONTROLFILE
AUTOBACKUP
FORMAT
command, which you can specify either within a RUN
block or at the RMAN prompt, overrides the configured autobackup format in the current session only.
The order of precedence is:
SET CONTROLFILE AUTOBACKUP FORMAT
(within a RUN
block)
SET CONTROLFILE AUTOBACKUP FORMAT
(at RMAN
prompt)
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT
The following example shows how the two forms of SET
CONTROLFILE
AUTOBACKUP
FORMAT
interact:
RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'controlfile_%F'; RMAN> BACKUP AS COPY DATABASE; RMAN> RUN { SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/tmp/%F.bck'; BACKUP AS BACKUPSET DEVICE TYPE DISK DATABASE; }
The first SET CONTROLFILE AUTOBACKUP FORMAT
controls the name of the control file autobackup until the RMAN client exits, overriding any configured control file autobackup format. The SET CONTROFILE AUTOBACKUP FORMAT
in the RUN block overrides the SET CONTROLFILE AUTOBACKUP FORMAT
outside the RUN block for the duration of the RUN block.