Understanding Recovery Manager
Understanding Recovery Manager
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 ]
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
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;
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 ]
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