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:
- Archive redo log file
- Data files
- Control files
Types of backup in RMAN:-
- Full backup: It is used to backup whole database block by block.
- 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.
- Consistent backup: It is performed when database was shutdown using SHUTDOWN command.
- Inconsistent backup: It is performed when database is open or failed after crash.
- Open backup: It is performed when database is in online mode.
- 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
- Data Recovery Advisor Data Recovery Advisor automatically detects corruption and data failures. It repairs block corruption, data dictionary corruptions and many more.
- Cloning of database: You can easily clone your database without requiring existing backups.
- 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.
- 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:
- 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.
- 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.
- It provides automatic backup of controlfile and spfile.
- You can also perform encrypted backup using RMAN which is not possible in traditional backups.
- Using RMAN you can easily check any backup that whether it is recoverable or not.
- In RMAN backup compression there is a feature by which you can skip unused blocks.
- RMAN can work fairly well with third party tools.
- RMAN backup is much faster than other traditional backups.
- RMAN has a highly advanced feature named Data Recovery Advisor that automatically detects and repair block corruption.
- RMAN automatically deletes expired or unnecessary backup of data file from disk.
- 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
- 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.
- 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.
- 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:
- If you want to backup flash recovery area using RMAN then you need to set the Configure backup optimization command to ON.
- 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....