Friday, August 23, 2013

All about RMAN backup


RMAN stands for Recovery Manager, is the backup and recovery solution of Oracle database. It is the preferred method for backup and recovery. The best part about RMAN is that it detects block corruption while performing backup. It can be accessible through command line or Oracle Enterprise Manager. Since RMAN is the feature of Oracle so no separate installation is required for it. It comes with some advanced features like parallelization of backup/restore; keep history of all backup and many more. You can backup following files through RMAN:



  1. Archive redo log file
  2. Data files
  3. Control files
  4. SPFILES.

Types of backup in RMAN:-
  1. Full backup: It is used to backup whole database block by block.
  2. Incremental backup: It can be of two types, either a 1 or 0 levels backup.
  • Level 1 backup: It backups 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: It is performed when database was shutdown using SHUTDOWN command.
  2. Inconsistent backup: It is performed when database is open or failed after crash.
  3. Open backup: It is performed when database is in online mode.
  4. Closed backup: It is performed when database is in offline mode.

How to perform backup with RMAN?
To backup whole database: Use following 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 a 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; (It shows all the RMAN parameters of the database.
RMAN> backup database; (To perform database backup)
RMAN> delete expire backup; (To remove archive log)
RMAN> report obsolete; (To delete obsolete backup)
RMAN> alter database; (To mount a database)
RMAN> delete; (To delete backup copy of database)
RMAN> exit; (To exit 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.) and list can go on....

No comments:

Post a Comment