RMAN Concepts
Overview
The main Oracle tool for database backup and recovery is Recovery Manager (RMAN). RMAN is a superb tool for both backing up and restoring your database. You should be using this because no one knows how to backup and restore an Oracle database better than Oracle. Plus it is free. If you ever have an event where you will need to contact Oracle support to restore or recover data, in most cases they will require a standard and recent RMAN backup of your database.
With RMAN it is vital to ensure two things before you ever need to perform a restore operation:
- The records required to do this will still be in your control file.
- The corresponding backupset files are available on the backup media.
The spfile CONTROL_FILE_RECORD_KEEP_TIME (CFRKT) parameter determines how long RMAN backup records are stored (in the control file). The RMAN setting for the RETENTION POLICY TO RECOVERY WINDOW OF n DAYS determines when backup set files will become OBSOLETE and can be deleted from disk or tape.
Control files in an Oracle databases contain a circular reuse area. It is in this area that RMAN information is stored. The control file will grow in size as needed to retain information in this area based on your CFRKT settings. For extreme control of long term backups a dedicated Oracle Management Server (OMS) can be created. With an OMS a "catalog" is used in addition to the control file.
Traditional RMAN backups do not automatically delete backupset files from disk or tape. To delete them in a way that RMAN "knows" about, you must use the DELETE OBSOLETE command routinely. This will delete all physical backup set files that are older than your RETENTION POLICY TO RECOVERY WINDOW value and update the control file accordingly.
To ensure that your control file is in sync with those files already actually on disk, you must issue the corresponding CROSSCHECK command. If your RMAN backups go to disk, and are also backed up via an OS backup to tape, then you have to run a CROSSCHECK after restoring the backupset files from tape.
Essential RMAN Concepts
RMAN Executable
ORACLE_HOME\bin\rman target / nocatalog
Backup Piece
A physical binary file created by RMAN during a backup. They contain blocks from the target database's data files, archived redo log files and control files.
CFRKT
The CONTROL_FILE_RECORD_KEEP_TIME (CFRKT) is used to determine when records in the control file can be overwritten. This would happen if space was needed in the control file to add new records and there were records eligible to be overwritten. The control file will expand in size automatically if required. This parameter only applies to records in the control file circular reuse area. 10g Default=7 (days) 11g Default=8 (days)
Channels
RMAN server process started when there is a need to communicate with and I/O device.
Configure Command
Used to set RMAN configuration values. Default Values:
RMAN> show all; CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0.2/dbhome_1/dbs/snapcf_dnat1.f'; #default
SNAPSHOT CONTROLFILE NAME cannot be on an NFS mounted disk.
Crosscheck Command
Determines whether a backup set and its related pieces still exist on your storage media (disk, tape etc.). It is a good idea to perform a crosscheck before any restoration operation. This will confirm that all the pieces required exist where RMAN expects them to be.
MML
Media Management Layer, a third party piece of software that manages the reading and writing of files from an external device like a tape drive (SBT).
Recovery Catalog
An optional repository used by RMAN to record information concerning backup and recovery activities performed on the target database. Note: RMAN uses the control file to store RMAN backup information by default.
Restore vs. Recover
A RESTORE operation restores files from backup sets to the default or new location. A RECOVER operation applies redo logs and\or incremental backups to a restored database in order to bring it to a specific point-in-time.
RETENTION POLICY TO RECOVERY WINDOW OF n DAYS;
The RMAN policy for how long a backup set should be retained, i.e. before it becomes OBSOLETE. Default = 1 (days)
Target Database
The database on which RMAN performs actions.
Block Change Tracking
Block Change Tracking can dramatically improve the performance of incremental backups. With Block Change Tracking RMAN no longer needs to scan all the blocks in the datafiles to find changed blocks. This is because it uses a tracking file to identify changed blocks for incremental backups. Enabling this starts a new background process called Change Tracking Writer (CTWR) that manages the tracking file. This feature requires the Enterprise Edition.