Friday, May 31, 2013

RMAN: Backup & Recovery solution


RMAN (Recovery Manager) is the backup and recovery solution of Oracle database. Oracle Corporation recommends RMAN as the preferred method of backup and recovery. The best part about RMAN is that it detects block corruption while performing backup. You can access RMAN through command line or Oracle Enterprise Manager. Since RMAN is the feature of Oracle so no separate installation is required. RMAN backup provides some advanced features like parallelization of backup/restore, keep history of all backup etc. You can backup following files through RMAN:

  1. Archive redo log file
  2. Datafiles, controlfiles and SPFILES.
Types of backup in RMAN
  1. Full backup: Full backup is used to backup the whole database block by block.
  2. Incremental backup: It can be of two types, either a 0 level backup or 1 level backup.
    • Level 1 backup: It backup only those blocks that have been changed since the last parent backup. Parent backup can be of 0 level or 1 level.
    • Level 0 backup: It is same as full backup. The only difference is that it does not backup empty blocks.
  1. Consistent backup: A consistent backup is taken when the database is shutdown using SHUTDOWN command.
  2. Inconsistent backup: An inconsistent backup is taken when the database is open or failed after crash.
  3. Open backup: It is taken when the database is in online mode.
  4. Closed backup: It is taken when the database is in offline mode.
How to perform backup with RMAN?
To backup whole database: Use below command to backup the whole database:
RMAN> BACKUP DATABASE;

RMAN new features in Oracle 11g
  1. Data Recovery Advisor: Data Recovery Advisor automatically detects corruption and data failures. It repairs block corruption, data dictionary corruptions and many more.
  2. Cloning of database: You can easily clone your database without requiring existing backups.
  3. Improvement in backup compression: In Oracle 11g, RMAN backup compression is done using ZLIB algorithm which is much faster than BZIP2 algorithm that is used in Oracle 10g.
  4. Check physical corruption: A new command is introduced in Oracle 11g to check database for physical corruption. The command is VALIDATE DATABASE.
Why use RMAN?
RMAN is the preferred method of backup and recovery. Since RMAN is supported by Oracle so while using it if you find any issue you can always rely on Oracle for support. Here are the advantages of using RMAN:
  1. RMAN automatically detects block corruption while performing backup. In RAMN you can recover only few corrupted block unlike traditional backups where you have to backup entire data file.
  2. RMAN also performs incremental backup. In incremental backup only those blocks are backed up that are changed since last backup. So it reduces recovery time because now you don't have to backup the entire database.
  3. It provides automatic backup of controlfile and spfile.
  4. You can also perform encrypted backup using RMAN which is not possible in traditional backups.
  5. Using RMAN you can easily check any backup that whether it is recoverable or not.
  6. In RMAN backup compression there is a feature by which you can skip unused blocks.
  7. RMAN can work fairly well with third party tools.
  8. RMAN backup is much faster than other traditional backups.
  9. RMAN has an highly advanced feature named Data Recovery Advisor that automatically detects and repair block corruption.
  10. RMAN automatically deletes expired or unnecessary backup of data file from disk.
  11. You can perform backup in online mode without putting the tablespace in hot backup mode.

RMAN backup best practices
If you are using RMAN as your backup strategy then follow best practices for performing backup. However RMAN is intelligent enough to automatically detect which files need to be restored and backup. Consider following factors while performing backup:
  1. Choose the backup option depending upon your business requirement: RMAN provide many type of backups. Choose the one that can provide fastest recovery for your business.
  2. Check validity of backup: Perform a media check on your backup storage. A disk to disk backup is considered as most reliable and fastest backup.
  3. Check the speed of backup: Check how long does it take to perform backup.
RMAN backup optimization
There are two commands in RMAN backup optimization. Here they are:
RMAN> configure backup optimization on;
RMAN> configure backup optimization off;

When backup optimization is On then BACKUP command will skip the backup of that file which has already been backed up to a specific device. RMAN check for identical files for example in case of datafile, it will check for checkpoint SCN, DBID, creation SCN to see if they are already backed up. By default backup optimization is off. Consider some of the key features of configure backup optimization On command:
  1. If you want to backup flash recovery area using RMAN then you need to set the configure backup optimization command to on.
  2. If you set backup optimization to On then RMAN will skip the backup of identical files.
Some of the useful commands of RMAN are:
RMAN> show all;
To show all the RMAN parameters of the database.

RMAN> backup database;
To perform backup of database.

RMAN> delete expire backup;
To remove any archive log.

RMAN> report obsolete;
To delete obsolete backup.

RMAN> alter database;
To mount a database.

RMAN> delete;
To delete the backup copy of database.

RMAN> exit;
To exit the RMAN executable.

RMAN>restore;
To restore files from backup to an new location.

RMAN> duplicate;
To create a duplicate database of target backup for testing purpose.

RMAN>show;
To show the current configuration settings.

1 comment:

  1. Best option Oracle Database Recovery Tool can has been skillfully built to repair the damaged or inaccessible DBF files. Hence, it restores Tablespaces, Tables, Nested Tables, Nested Object Types.

    See full details at: http://www.mannatsoftware.com/stellar-phoenix-oracle-database-recovery.html

    ReplyDelete