RMAN is Oracle’s flagship B&R tool. RMAN is provided by default when you install the Oracle software (for both the Oracle Database 12C Standard Edition and Enterprise Edition). RMAN offers a robust and flexible set of B&R features. The following list highlights some of the most salient qualities:
- Easy-to-use commands for backup, restore, and recovery.
- Ability to track which files have been backed up and where to. Manages the deletion of obsolete backups and archive redo logs.
- Parallelization: Can use multiple processes for backup, restore, and recovery.
- Incremental backups that only back up changes since the previous backup.
- Recovery at the Oracle database 12C, tablespace, data file, table, or block level.
- Advanced compression and encryption features.
- Integration with media managers for tape backups.
- Backup validation and testing.
- Cross-platform data conversion.
- Data Recovery Advisor, which assists with diagnosing failures and proposing solutions.
- Ability to detect corrupt blocks in data files.
- Advanced reporting capabilities from the RMAN command line.
The goal of my blog is to present enough information about RMAN that you can make reasonable decisions about how to implement a solid backup strategy. The basic RMAN components are described first, after which you walk through many of the decision points involved in implementing RMAN.
RMAN consists of many different components. Figure 1 shows the interactions of the main RMAN pieces. Refer back to this diagram when reading through this section.
The following list describes the RMAN architectural components:
- DBA: Appears somewhat short and bald in the diagram, which isn’t far from the truth (in my case).
- Target database: The database being backed up by RMAN. You connect to the target database with the RMAN command-line TARGET parameter (see the next section for more details).
- RMAN client: The rman utility from which you issue BACKUP, RESTORE, and RECOVER commands. On most database servers the rman utility is located in the ORACLE_HOME/bin directory (along with all the other Oracle utilities, such as sqlplus and expdp).
- Oracle server processes: When you execute the rman client and connect to the target database, two Oracle server background processes are started. The first default server process interacts with the PL/SQL packages to coordinate the backup activities. The secondary polling process occasionally updates Oracle data dictionary structures.
- Channel(s): The Oracle server processes for handling I/O between files being backed up (or restored) and the backup device (disk or tape).
- PL/SQL packages: RMAN uses two internal PL/SQL packages (owned by SYS) to perform B&R tasks: DBMS_RCVMAN and DBMS_BACKUP_RESTORE.DBMS_RCVMAN accesses information in the control file and passes that to the RMAN server processes. The DBMS_BACKUP_RESTORE package performs most of RMAN’s work. For example, this package creates the system calls that direct the channel processes to perform B&R operations.
- Memory buffers (PGA or SGA): RMAN uses a memory area in the PGA (and sometimes in the SGA) as a buffer when reading from data files and copying subsequent blocks to back up files.
- Auxiliary database: A database to which RMAN restores target database data files for the purpose of duplicating a database, creating a Data Guard standby database, or performing a DBPITR.
- Backup/Back up: Can be either a noun or a verb. The physical files (backup) that store the backed up files; or, the act of copying and archiving (backing up) files. Backups can consist of backup sets and backup pieces or image copies.
- Backup set: When you run an RMAN BACKUP command, by default, it creates one or more backup sets. A backup set is a logical RMAN construct that groups backup piece files. You can think of the relationship of a backup set to a backup piece as similar to the relationship between a tablespace and a data file: one is a logical construct, the other is a physical file.
- Backup piece file: RMAN binary backup files. Each logical backup set consists of one or more backup piece files. These are the physical files that RMAN creates on disk or tape. They’re binary, proprietary format files that only RMAN can read or write to. A backup piece can contain blocks from many different data files. Backup piece files are typically smaller than data files, because backup pieces only contain blocks that have been used in the data files.
- Image copy: Initiated with the BACKUP AS COPY command. A type of backup in which RMAN creates identical copies of a data file, archive redo log file, or control file. Image copies can be operated on by OS utilities such as the Linux cp and mv commands. Image copies are used as part of incrementally updated image backups. Sometimes, it’s preferable to use image copies rather than backup sets if you need to be able to restore quickly.
- Recovery catalog: An optional database schema that contains tables used to store metadata information regarding RMAN backup operations. Oracle strongly recommends using a recovery catalog, because it provides more options for B&R.
- Media manager: Third-party software that allows RMAN to back up files directly to tape. Backing up to tape is desirable when you don’t have enough room to back up directly to disk or when disaster recovery requirements necessitate a backup to storage that can be easily moved offsite.
- FRA: An optional disk area that RMAN can use for backups. You can also use the FRA to multiplex control files and online redo logs. You instantiate a fast recovery with the Oracle database 12C initialization parameters DB_RECOVERY_FILE_DEST_SIZE and DB_RECOVERY_FILE_DEST.
- Snapshot control file: RMAN requires a read-consistent view of the control file when either backing up the control file or synchronizing with the recovery catalog (if it’s being used). In these situations, RMAN first creates a temporary copy (snapshot) of the control file. This allows RMAN to use a version of the control file that is guaranteed not to change while backing up the control file or synchronizing with the recovery catalog.
- Full backup: All modified blocks associated with the data file are backed up. A full backup is not a backup of the entire database. For example, you can make a full backup of one data file.
- Incremental level 0 backup: Backs up the same blocks as a full backup. The only difference between a level 0 backup and a full backup is that you can use a level 0 backup with other incremental backups, but not a full backup.
- Incremental level 1 backup: Backs up only blocks that have been modified since the previous backup. Level 1 incremental backups can be either differential or cumulative. A differential level 1 backup is the default and backs up all blocks that have been modified since the last level 0 or level 1 backup. A cumulative level 1 backup backs up all blocks that have changed since the last level 0 backup.
- Incrementally updated backup: First creates an image copy of the data files, after which subsequent backups are incremental backups that are merged with the image copy. This is an efficient way to use image copies for backups. Media recoveries using incrementally updated backups are fast because the image copy of the data file is used during the restore.
- Block change tracking: Database feature that keeps track of blocks that have changed in the Oracle database 12C. A record of the changed blocks is kept in a binary file. RMAN can use the contents of the binary file to improve the performance of incremental backups: instead of having to scan all modified blocks in a data file, RMAN can determine which blocks have changed from the binary block change tracking.
Now that you understand the RMAN architectural components and the types of backups you can make, you’re ready to start up RMAN and configure it for your environment.