ra2 studio - Fotolia
Oracle RMAN tutorial: Get started with database backup
Oracle Recovery Manager offers advantages over user-managed database backups. It's important to know the right commands to begin several different kinds of backups.
Oracle Recovery Manager is a built-in utility for backing up and recovering databases. RMAN is designed to perform integrity checks that are simply not possible with the user-managed method.
The utility works with third-party media management software, and unlike the user-managed method, RMAN enables the creation of incremental backups. This RMAN tutorial takes you through the steps to create full database backups, compressed backups and incremental backups.
RMAN is a command-line tool, so it takes some familiarization. Even so, many of the commands closely resemble natural language, which makes the learning process easier.
Creating database backups
Not surprisingly, the command used to create an RMAN backup is BACKUP. To back up a full database, for example, you would use this command:
To back up the database and the corresponding archive logs, you would use:
BACKUP DATABASE PLUS ARCHIVELOG;
The BACKUP command is far less limiting than these RMAN tutorial examples might lead one to believe, and it even includes a wide variety of helpful options.
One such option is to use the TAG parameter. If you use RMAN to create backups on a regular basis, you will need a way to distinguish between the backups. This is where backup tags come into play.
If you use the LIST command to display a list of the current backups, each backup is assigned a tag. However, you can apply a custom tag to a backup instead of the system-generated tag.
The simplest way to create a backup is to use the BACKUP DATABASE; command. With that in mind, if I want to create a tag containing my name (Brien) as a way of showing that I was the one who created the backup, I would use this command:
BACKUP DATABASE TAG = 'Brien';
RMAN enables you to create compressed backups to reduce the amount of space consumed by the backup. The degree to which compression can shrink a backup varies widely depending on the data within the database, but it is common to achieve a reduction rate of 70% to 80%.
The command used to create a compressed backup is simple, but it's important to understand the concept of a backup set.
So far in this RMAN tutorial, there have been several examples of how to use the BACKUP command to create a backup. To be technically precise, however, what the BACKUP command creates is a backup set, which includes data from one or more data files, any archived redo logs, control files or server parameter files.
When you compress a backup, you are actually compressing the backup set. The command even mentions the backup set. If you want to run the BACKUP DATABASE; command, but want the resulting backup to be compressed, the command would be:
BACKUP AS COMPRESSED BACKUPSET DATABASE;
RMAN can also do incremental backups. However, this process might work a little differently than what you would expect, so we'll take a closer look at the process in this RMAN tutorial.
Incremental backups usually refer to a backup of everything that has changed since the last full backup. Even though the BACKUP DATABASE; command creates a full backup, the resulting backup is not compatible with incremental backups.
If you plan on making incremental backups, the full backup has to be taken as a level 0 backup. The level 0 backup is just another type of full backup, but one that can be used as the basis for incremental backups. You can create a level 0 backup by using this command:
BACKUP INCREMENTAL LEVEL 0 DATABASE;
Once a level 0 backup exists, you can create incremental backups, which are differential or cumulative. Differential backups are the default, and are created using a command that is almost identical to the one used to create a level 0 backup. The only difference is that you will need to create a level 1 backup instead. The command is:
BACKUP INCREMENTAL LEVEL 1 DATABASE;
If you want the backup to be cumulative, then the command would be:
BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
When you create an incremental backup, that backup is defined as a level 1 backup. A level 1 backup has to have a parent backup, and that parent can be a level 0 backup or a previous level 1 backup.
You can learn more about what the RMAN BACKUP command can do by checking out the Oracle documentation.
Backup vendors that support Oracle Recovery Manager
Keys to Oracle RMAN database backup and recovery
Survey: Disk still top of the list for enterprise backup