You are on page 1of 5

Understanding Recovery Manager

 
Published: 12 Dec 2007
Abstract
In this article the author describes what Recovery Manager (RMAN) is, how
it can be used for database backup and recovery, what the requirements
are for using it, and what the advantages and disadvantages of using it
are.
by Debjani Mallick

Article Contents:

 Introduction
 Need of Backup and Recovery
 Requirements
 RMAN Repository
 Backup Types in RMAN
 Advantages
 Disadvantages
 Conclusion

Introduction
[ Back To Top ]

Recovery Manager (RMAN) is a utility in Oracle that is generally used to backup, restore or
recover database files. It performs backup and recovery by using database server sessions. The
metadata about its operation may be stored in a control file of the target database or in recovery
catalog schema in Oracle database. By default, RMAN automatically stores the metadata in the
control file of the target database; so using a recovery catalog database is fully optional though it
is encouraged to use a recovery catalog database so that if the production machine fails, we have
the operations information in the catalog on a separate machine.
Need of Backup and Recovery
[ Back To Top ]

Before knowing how to use RMAN for backup and recovery, one should know why backup of
files is required. One should remember that backup and recovery are one of the most important
aspects in database administration. What is backup and recovery? It is a copy of the data which
includes important parts of a database like redo log files, control files and data files. Normally
back up is divided into two parts: physical backup and logical backup. Physical backup is the
copy of physical database files. Logical backup contains data that is exported using SQL
commands and stored in a binary file. Restoring a database generally refers to various operations
in restoring, rolling forward and rolling back a backup. Regular backups prevent the loss of data
and damage caused due to failure of disk drives, virus attack, power outrages and other network
problems. No one is completely sure about when the failures may occur. One of the important
reasons for failure is user error which may cause corruption or loss of valuable data. Another
reason is media failure which can occur when the media, where the data files or transaction logs
are stored, fails. Backup operations which are planned properly beforehand make the recovery
process of the data very simple. Like this, there can be a number of reasons of failure.
Requirements
[ Back To Top ]

At a minimum, the environment for RMAN requires:


         The target database that is required to be backed up
         The RMAN client
Other optional components are:
         Media Management Software
         Flash Recovery Area
         Recovery Catalog Database
Target Database
It is the database which needs to be backed up, restored or recovered using RMAN. The target
database's control file is used by RMAN to gather information about the target database and to
store information about RMAN's own operations.
RMAN Client
It is here where RMAN commands and SQL statements can be issued for performing backup
and restoring operations. RMAN client uses Oracle Net to connect to the target database. So
locating a RMAN client to any host that is connected to the target host through Oracle Net will
do the job.
The above two are the required components for performing backup or restoring using RMAN.
The components described below are the optional components.
Media Management Software
Media management software is used by RMAN to handle sequential media devices (for
example: tape libraries, etc.).The media manager controls these devices during backup and
recovery operations. It manages the loading, labeling, unloading of media, among all other
functions performed by it. Actually, what happens during backup or restore operation, RMAN
client get connected to target instance and it is this instance which is directed to communicate
with the media manger. So instead of having a direct communication between RMAN client and
media manager, the communication happens through the target instance.

Flash Recovery Area


RMAN has a feature known as Automatic Disk-based Backup and Recovery that manages all the
related files of backup and recovery in a flash recovery area. This feature thus simplifies
managing disk space and files related to backup and recovery operations. The flash recovery
area parameter can be set using:
         db_recovery_file_dest – This parameter determines the location of the flash recovery
area.
         db_recovery_file_dest_size – This parameter determines how much space can be used
by Oracle in the flash recovery area.
There can be a need to assign flash recovery area more space, which typically depends on:
         The size of the database
         The number of backups one wants or requires to keep
         If the database is being run in ARCHIVELOG mode
Recovery Catalog Database
The Recovery catalog can be used to hold RMAN repository records, RMAN stored scripts, and
the sequences of RMAN commands for common backup tasks. Actually, it can be more
convenient to work with the centralized store of scripts than working with command files.
RMAN Repository
[ Back To Top ]

It stores the metadata about the target database and its backup and restores operations
information. RMAN also stores information about its own configurational settings, the target
database schema, etc. RMAN repository information can be viewed with the help of LIST,
SHOW, and REPORT commands. RMAN repository data is stored in the control file of the
target database. The initialization parameter, CONTROL_FILE_RECORD_KEEP_TIME, is
responsible for controlling the time for how long the backup records are to be kept in the control
file after which those records can be re-used to hold information about more recent backups.
However, the repository can also be kept in a recovery catalog as mentioned earlier.
Backup Types in RMAN
[ Back To Top ]

With RMAN one can perform various types of backup as shown below.
         Open or closed – Open backup is the backup taken when the database is open: a
backup of online, read/write data files. Closed backup is the backup of any part of the
target database when it is mounted but not open.
         Full or incremental – A backup of type full is the back up of a data file that contains
every allocated block in the file being backed up. And an incremental backup is either a
level 0 backup or a level 1 backup.
         Consistent or inconsistent – A consistent backup is the backup taken when the database
is mounted but is not open after a normal shutdown. Whereas an inconsistent backup is
the backup taken of any part of target database when the database is open or when a
crash occurred, etc.
Backup database using RMAN
In non-archive mode, using dos prompt type:
RMAN

the RMAN prompt gets displayed.


Listing 1
RMAN>Connect Target 
Connect to target database:Xxx<Dbid:123456789>

This is using the database of target file rather than the recovery catalog.
A Dbid stands for Database Identifier which is a unique identifier and found in all datafile
headers and control files. It is used to identify a file belongs to which database.
A simple example of taking backup in non-archived mode:
Listing 2
shutdown immediate; //shuts down the database
startup mount;
backup database; //starts backing up the database
alter database open;

In archivelog mode, the same command can also be fired to backup the whole database.
Listing 3
backup database plus archivelog;

The backup command can backup the following type of files:


         Database (which includes all datafiles as well as the current control file and current
server parameter file)
         Tablespaces, except for locally-managed temporary tablespaces
         Current server parameter file
         Current control file
         Backup sets
         Current datafiles
         Archived redo logs
RMAN does not back up the following:
         Online redo logs
         Transported tablespaces before they have been made read/write
         Client-side initialization parameter files, etc
Restore database using RMAN
Restoring and recovering a database using RMAN uses even more simple commands than
backup.
Listing 4
restore database;
recover database;

RMAN has the intelligence to find out which datafiles are to be recovered or restored and the
location of backed up files.
Advantages
[ Back To Top ]

         Automatic detection of block corruption and its repairing-Block Media Recovery allows
fixing of a corrupted block, detected on backup, by RMAN while the datafile is online and
the non-affected files continue to be available for selecting, updating, etc. which results
in increased data availability and reduction in mean time to recover.
         Comprehensive reporting- Users can easily retrieve information about all the currently
executing and completed backup jobs, details on all backed up files and backup sets
which are not being used anymore using special V$ views.
         Intelligent monitoring of disk consumption- In Oracle database 10g Release 1, Flash
Recovery Area allows administrators to setup notifications on disk space usage and
automate obsolescence of expired backup sets, via RMAN client command-line or
enterprise manager interfaces.
         Optimization of performance and space-saving operations- RMAN provides high backup
and restores data streaming performance with the help of its intimate knowledge of
Oracle block structures. RMAN backs up only blocks that are in use or have ever been
used, by default, when creating backup sets and saves disk space by merging blocks
into as few backup pieces as necessary.
         Fine-granular data operations- RMAN provides fine-granular, on and offline backups at
the database, tablespace, datafile, control file, archive log, and block level.
Disadvantages
[ Back To Top ]

Some of the disadvantages of using RMAN are:


         If the location of the backup set is changed, it is required to register it using RMAN;
otherwise it would result in hanging situations when trying to restore backup.
         There is no relevant method to know whether during recovery, database restore is
going to fail because of missing archive log file.
         If tape backup is used, media management is compulsory.
         Incremental backups though used to consume less space, are often slower as they use
to read the whole database to find the changed blocks.
Conclusion
[ Back To Top ]

Backups were not so easy before Oracle 9i version. It was required to allocate a channel
compulsorily for taking backups. The syntax was also complex. RMAN provides a simple and
easy way of backing up the database without any complex syntax which is what makes it more
popular.
By Debjani Mallick

You might also like