Read Oracle RMAN 11g Backup and Recovery Online
Authors: Robert Freeman
■ The time the backup set piece was created.
Following the eight-character mnemonic will be an underscore, followed by the backup set piece number. Because the backup set piece number uniquely identifies each piece of the backup set, it is unique to that backup set. Finally, another underscore will be followed by the copy number of the backup set piece. Each multiplexed backup set piece copy has its own unique number assigned to it. If you are not multiplexing, the copy number will be 1.
An example of the resulting backup set piece name might look like this:
Rob1 16E112V9 1 1
Note in this filename that the time component of the eight-character mnemonic is not readily discernable, but that’s not really a problem. The important thing about the use of the %U placeholder is that it guarantees that the name of each backup set piece is unique. Of course, several different mnemonics are available for use with the
format
command, but generally %U will suffice. We added the instance name to the name and the extension just out of habit and good practice. Finally, there are a number of other options with the
allocate channel
command. Check out Appendix A for the entire syntax of the
allocate channel
command.
If you are using the FRA, Oracle will create backup set filenames based on the Oracle Managed Files naming standard. See the Oracle Database 11
g
Release 2 Database Administrators Guide for more details on the Oracle OMF naming standard.
Chapter 11: RMAN Backups
235
NOTE
You might have noticed that we are using SBT instead of SBT_TAPE.
Earlier versions of RMAN used SBT_TAPE, but this is now just SBT.
SBT_TAPE is still usable for backward compatibility.
Channels can fail. Perhaps the hardware might fail, or some other failure might occur. Many RMAN backups consist of more than one channel going to a different location. If RMAN is using multiple channels and one channel should fail, the remaining channels will attempt to complete the work of the failed channel.
Backup Is the Name of the Game
Moving on now with our example code, after we have allocated the channels, it’s time to back up the database with the
backup
command (using the
database
option). The sum result of the
backup database
command is that RMAN will proceed to use the two channels we created and back up the database. The command is a bit different from the
backup database
command we issued earlier, as this
backup database
command is issued within the confines of a
run
command block. We had to perform this backup using a
run
block because we manually allocated the channels with the
allocate channel
command.
The
backup
command also takes care of the control file and server parameter file (SPFILE) for us if datafile 1 is getting backed up (which it always will during an offline backup or any full backup, which is the default). Where this control file backup is stored depends on the setting of the
controlfile autobackup
parameter. If this parameter is set to
off
, then the control file is included in the database backup set along with the server parameter file (if an SPFILE is being used). If the parameter is set to
on
, the control file and SPFILE backup will be made to a separate control file backup piece. You can force RMAN to put the control file in the database backup set by including the
include current controlfile
clause in the
backup database
command (assuming you are not backing up datafile 1). Better yet, as we have done in our example, a separate backup of the control file is a good idea, to ensure that you have a control file backup that is current, including the most recent database backup.
NOTE
RMAN will only back up a server parameter file (SPFILE). It will not
back up text-based init.ora files.
The
backup database
command comes with a number of different options (and is, in fact, a subset of the larger
backup
command). Let’s look at the use of some of the options of the
backup
command.
NOTE
A new feature in Oracle Database 11
g
RMAN backups is the
elimination of the backup of most UNDO within the database. Since
a great deal of UNDO is not needed during a database recovery
(for transactions that are already committed), it does not need to be
backed up. This can reduce the size of the backups of the UNDO
tablespaces a great deal! Note that this is a feature that cannot be
disabled.
236
Part II: Setup Principles and Practices
Backup Command Options
Now that we have introduced you to the
backup
command, let’s look at the number of different options you can use with it. These
backup
command options can be used with many of the various
backup
command flavors, such as
backup database
(which we just covered),
backup
tablespace
,
backup datafile
, and other backup options, which we will cover later in this chapter.
A number of different options available for use with the
backup
command allow you to do such things as provide a naming format for individual backup pieces, or limit the size of those backup pieces. The
backup
command even allows you to manually decide which channels will be used to back up what, should you wish to override the choices that RMAN makes otherwise. Let’s look at some of the options that you can use with the
backup
command.
Multisection Backups
A new feature in Oracle Database 11
g
is the ability to split out backups of large datafiles into multiple sections of a fixed size. These sections can be backed up over different channels, thus parallelizing the backup of a large datafile. This is very helpful if you are using bigfile tablespaces, which were first available in Oracle Database 10
g.
A backup that takes advantage of this new feature is called a multisection backup.
To enable multisection backups, you specify the section size parameter within RMAN. RMAN
will divide the files being backed up into file sections, which are just logically divided, contiguous blocks in a file. RMAN will create a backup set with one backupset piece for each file section.
Here is an example of backing up a bigfile tablespace called USER_DATA, chunking the backup into 1GB sections:
backup section size 1g tablespace USER DATA;
Multisection backups are a great way to spread the load of a backup over a number of different I/O devices.
Compression
As you saw in previous examples, you can actually compress backup sets. By default, RMAN
does NULL data block compression. RMAN also offers true compression of backup sets, which can reduce the overall storage space consumed by backup images. We discuss these two different types of compression next.
NULL Data Block Compression
With this form of compression, Oracle does not back up unused data blocks. NULL data block compression occurs in two different ways:
■ Data blocks that have never been used will not be backed up.
■ RMAN will also skip backing up blocks that were once used given specific criteria.
In the first case, any block that has never had data in it will simply not be backed up. In the second case, if the database and the associated block meet certain criteria, then an empty block will not be backed up even if it contained data at one time. The following are the conditions that must be met to allow RMAN to skip backing up these blocks:
■ The compatible parameter is set to 10.2.
Chapter 11: RMAN Backups
237
■ No guaranteed restore points are defined for the database.
■ The datafile is locally managed.
■ The backup is a backup set and is a full backup or a level zero incremental backup.
■ The backup set has been created on disk.
If these conditions are met, Oracle will not back up any unused block, and your backups will therefore take up less space on your disks or tape.
RMAN Backup Compression
We provided an example earlier in this chapter of a database backup using RMAN compression.
RMAN has the ability to apply compression algorithms to your backup sets. The end result is that backup sets are often much smaller. RMAN compression can significantly reduce the size of backup sets. Compression can be significant; for example, in one of our test databases, we saw a 70
percent difference in the size of the backup set images when using compression. If you don’t have the database configured to automatically compress backup sets, you can use the
as compressed
backupset
parameter to create the backup set as a compressed backup set. If you have compression configured and you do not wish to use it in a given
backup
command, simply use the
as
backupset
parameter (without the
compressed
keyword) of the
backup
command.