When you run a BACKUP command for disk-based backups, RMAN creates backup pieces in one of the following locations:
- Default location
- FRA
- Location specified via the BACKUP...FORMAT command
- Location specified via the CONFIGURE CHANNEL...FORMAT command
Of these choices, I lean toward the last of them; I prefer specifying a target location via a backup channel.
Default Location
If you don’t configure any RMAN variables and don’t set up an FRA, by default RMAN allocates one disk-based channel and writes the backup files to a default location. For example, you can run the following command without configuring any RMAN parameters:
RMAN> backup database;
The default location varies by OS. In many Linux/Unix environments the default location is ORACLE_HOME/dbs. The default format of the name of the backup files created is an OMF format; for example,
<ORACLE_HOME>/dbs/01ln9g7e_1_1
Tip The default location is okay for small development databases. However, for most other environments (especially production), you’ll need to plan ahead for how much disk space you’ll need for backups and explicitly set the location for the backups via one of the other methods (such as implementing an FRA or CONFIGURE CHANNEL).
FRA
When backing up to disk, if you don’t explicitly instruct RMAN to write the backups to a specific location (via the FORMAT or CONFIGURE command), and you’re using an FRA, RMAN automatically writes the backup files to directories in the FRA. The files are stored in a subdirectory with the same name as the database’s unique name. Also, the default format of the name of the backup files created in the FRA is an OMF format; for example,
/<fra>/<dbuname>/backupset/<YYYY_MM_DD>/o1_mf_nnndf_TAG20100907T025402_68czfbdf_.bkp
I don’t usually use an FRA for the placement of RMAN backups. In many of the environments I work in, there isn’t enough disk space on a single mount point to accommodate the entirety of the database backups. In such situations, you need to allocate two or more channels that point to different mount points. Using an FRA in these environments is somewhat unwieldy.
Also, for performance reasons, you may want to instruct RMAN to write to multiple disk locations. If you can ensure that different mount points are based on different physical disks and are written to by separate controllers, you can reduce I/O contention by allocating multiple channels pointing to separate mount points.
When you’re using an FRA, RMAN automatically creates separate directories when backing up a database for the first time on a given date. I prefer to have the backups written to one directory and not separate the directories and backups by date. I find it easier to manage, maintain, and troubleshoot the backups if I use one standard directory for each database on each server.
BACKUP...FORMAT
If you’ve configured an FRA and don’t want to place RMAN backup files in the FRA automatically, you can directly specify where you want backups to be placed when you issue the BACKUP command; for example,
RMAN> backup database format '/u01/O12C/rman/rman_%U.bkp';
Here is a corresponding file generated by RMAN:
/u01/O12C/rman/rman_0jnv0557_1_1.bkp
The %U instructs RMAN to dynamically construct a unique string for the backup file name. A unique name is required in most situations, because RMAN won’t write over the top of a file that already exists. This is important, because if you instruct RMAN to write in parallel, it needs to create unique file names for each channel; for example,
RMAN> configure device type disk parallelism 2;
Now, when you run the BACKUP command, you see this message:
RMAN> backup database format '/u01/O12C/rman/rman_%U.bkp';
RMAN allocates multiple channels and writes in parallel to two different backup files. The U% in the format string guarantees that unique file names are created.
CONFIGURE CHANNEL...FORMAT
I don’t usually use the BACKUP...FORMAT syntax to specify the location for RMAN backups. I prefer to use the CONFIGURE CHANNEL...FORMAT command. This is because I’m frequently writing to multiple disk locations and need the flexibility to specify directories located on different mount points. Here is a typical configuration specifying CONFIGURE CHANNEL...FORMAT:
RMAN> configure device type disk parallelism 3;
RMAN> configure channel 1 device type disk format '/u01/O12C/rman/rman1_%U.bk';
RMAN> configure channel 2 device type disk format '/u02/O12C/rman/rman2_%U.bk';
RMAN> configure channel 3 device type disk format '/u03/O12C/rman/rman3_%U.bk';
In these lines of code, you should configure the device-type parallelism degree to match the number of channels that you allocated. RMAN only allocates the number of channels as specified by the degree of parallelism; other configured channels are ignored. For instance, if you specify a degree of parallelism of 2, RMAN allocates only two channels, regardless of the number of channels you configured via the CONFIGURE CHANNEL command.
In this example of configuring three channels, suppose the BACKUP command is issued, like this:
RMAN> backup database;
RMAN allocates three channels, all on separate mount points (/u01, /u02, /u03), and writes in parallel to the specified locations. RMAN creates as many backup pieces in the three locations as it deems necessary to create a backup of the database.
If you need to unconfigure a channel, do so as follows:
RMAN> configure channel 3 device type disk clear;
Note Also consider what happens if you configure a degree of parallelism higher than the number of preconfigured channels. RMAN will open a channel for each degree of parallelism, and if the number of channels opened is greater than the number of preconfigured channels, for the unconfigured channels, RMAN will write backup files to the FRA (if configured) or the default location.