Basic Understanding of RMAN:
- Recovery Manager (RMAN) is an Oracle utility that helps you manage the backup, restore, and recovery operations on Oracle databases.
- Recovery Manager has a command-line interface. Oracle Enterprise Manager also provides a graphical user interface for the Recovery Manager.
- You can detect block corruption. The information relating to the block corruption that is detected during backup can be obtained by using the dynamic views V$BACKUP_CORRUPTION and V$COPY_CORRUPTION.
RMAN Configuration Settings:
RMAN is pre-set with default configuration settings which apply to all RMAN sessions. You can use the CONFIGURE command to configure persistent settings for RMAN backup, restore, duplication, and maintenance jobs. These settings are in effect for any RMAN session until the configuration is cleared or changed.
Configure automatic channels:
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT ’/db01/BACKUP/%U’;
Implement retention policy by specifying a recovery window:
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 days;
Implement retention policy by specifying redundancy:
RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
You can implement a retention policy in one of the following mutually exclusive ways:
• Specify a recovery window, which is a period of time that begins with the current time and extends backward in time to the point of recoverability. In the example, the CONFIGURE command ensures that for each datafile, one backup that is older than the point of recoverability (7 days) must be retained.
• Specify a redundancy value, which indicates that any number of backups or copies beyond a specified number need not be retained. The default value is 1 day.
Configure duplexed backup sets:
RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE disk TO 2;
Use the CLEAR option to return to the default value:
RMAN> CONFIGURE RETENTION POLICY CLEAR;
RMAN> CONFIGURE CHANNEL DEVICE TYPE sbt CLEAR;
Configure backup optimization:
RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
You set backup optimization on so that the BACKUP command does not back up files to a device type if the identical file has already been backed up to the device type. For two files to be identical, their content must be exactly the same. The default value for backup optimization is OFF.
The SHOW Command:
The SHOW command is used to display persistent configuration settings specified with the CONFIGURE command. These settings are configured for use with any RMAN session.
You can use the SHOW command to display the following:
• Automatic channel configuration settings
SHOW DEVICE TYPE;
SHOW DEFAULT DEVICE TYPE;
• RMAN retention policy configuration settings
SHOW RETENTION POLICY;
• Number of backup copies
SHOW DATAFILE BACKUP COPIES;
• Maximum size for backup sets
• Tablespaces excluded from whole database backups
• Status of backup optimization
SHOW BACKUP OPTIMIZATION;
The LIST Command:
List backups of all files in the database:
List all backup sets containing the users01.dbf datafile:
RMAN> LIST BACKUP OF DATAFILE “/db01/ORADATA/u03/users01.dbf”;
RMAN> LIST BACKUP OF DATABASE;
List all copies of datafiles in the SYSTEM tablespace:
RMAN> LIST COPY OF TABLESPACE “SYSTEM”;
The Report Command:
This command helps you analyze information in the RMAN repository in more detail.
Reports can be produced for a variety of questions, such as:
- What is the structure of the database?
RMAN> REPORT SCHEMA;
- Which files need to be backed up?
RMAN> REPORT NEED BACKUP …;
- Which backups can be deleted (that is, are obsolete)?
RMAN> REPORT OBSOLETE;
- Which files are not recoverable because of unrecoverable operations?
RMAN> REPORT UNRECOVERABLE …;
The Report Need Backup Command:
The REPORT NEED BACKUP command is used to identify all data files that need a backup. The report assumes that the most recent backup would be used in the event of a restore.
There are three options:
- Incremental: An integer specifies the maximum number of incremental backups that should be restored during recovery. If this number, or more, is required, then the data file needs a new full backup.
For example, to report files needing three or more incremental backups for recovery:
RMAN > REPORT NEED BACKUP incremental 3 database;
• Days: An integer specifies the maximum number of days since the last full or incremental backup of a file. The file needs a backup if the most recent backup is equal to or greater than this number.
For example, to report what system files have not been backed up for three days:
RMAN > REPORT NEED BACKUP days 3 tablespace system;
- Redundancy: An integer specifies the minimum level of redundancy considered necessary. For example, redundancy level two requires a backup if there are not two or more backups.
Recover Manager Packages:
Two packages, DBMS_RCVCAT and DBMS_RCVMAN, are used by RMAN to perform its tasks.
- DBMS_RCVCAT is used by Recovery Manager to maintain information in the recovery catalog.
- DBMS_RCVMAN queries the control file or recovery catalog.
- DBMS_BACKUP_RESTORE: It is used to interface with Oracle and the operating system to create, restore, and recover backups of datafiles and archived redo log files.