Managing Backups with RMAN
Recovery Manager (RMAN) is a client application that performs backup and recovery operations on databases. The RMAN environment may consist of components like a target database, RMAN client, recovery catalog, recovery catalog schema, standby database, media management application, media management catalog, and the OEM. Of these components, the target database and RMAN client are necessary for RMAN operation.
The RMAN client application uses database server sessions to perform all backup and recovery tasks. When you connect the RMAN client to a target database, RMAN gets server sessions on the target instance to perform the necessary operations. The RMAN client uses internal PL/SQL packages to communicate with the target database and recovery catalog.
Start RMAN from the (UNIX) command prompt and then type the following commands at the RMAN command line:
>rman Target_DB SYS/oracle@Target CATALOG rman/cat@catalogdb
After the RMAN prompt is displayed, enter the following command:
RMAN> BACKUP DATABASE;
You can also run a command file (BackUpCmds.rcv) with a list of commands and get the output into the log file (BckUpLog.log) as follows:
>rman Target_DB SYS/oracle@Target CATALOG rman/cat@catalogdb CMDFILE BackUpCmds.rcv LOG BckUpLog.log
When you run RMAN in command-line mode, the output will be sent to the terminal if the LOG option is not specified. The output from currently executing RMAN jobs is also written to the V$RMAN_OUTPUT view.
The RMAN repository has the metadata on target databases. RMAN always stores this information in records in the control file. You can create a recovery catalog in an external Oracle database to store this information. The advantage of an external recovery catalog is longer history retention for metadata compared to the smaller size of control file.
For Oracle Database 10g Release 2, the FLASHBACK DATABASE command has been improved to quickly return a database to a prior time without restoring data files and performing media recovery. Also the reporting on RMAN through OEM has been improved.
RMAN creates database backups, which could be stored as image copies or backup sets. Image copies are exact byte-for-byte copies of the files, while backup sets are logical entities consisting of several physical files called backup pieces.
When you create image copy backups through RMAN or OEM, RMAN will create a record of those image copies in the RMAN repository. RMAN uses these copies during database restore and recovery. RMAN will only use those files in the RMAN repository for restore operations.
Backup pieces use an Oracle proprietary format to store the file contents. They can be accessed only as part of backup sets and not individually.
When you back up data files into backup sets, free data blocks (with no data) are not written into the backup pieces in order to save space. This process is known as unused block compression. These backup sets can be compressed using an additional binary data compression algorithm during the writing stage to save some more space. The additional compression will affect the CPU and database performance and should be used if disk space is preferred over backup speed.
RMAN uses server sessions to perform backup and restore tasks. It supports parallelism, and you can have multiple channels and sessions to speed up the backup process.
You can set up the device properties, parallelism, backup type, and location from OEM -under Database Home page > Maintenance property > Backup/Recovery.
Important Points on RMAN During Database Upgrade
Refer to the RMAN compatibility matrix before you do a database upgrade. Each component in the RMAN environment has a release number associated with it. The following components are usually present: RMAN executable, recovery catalog database, recovery catalog schema in the recovery catalog database, target database, and auxiliary database (duplicate or standby database).
When you upgrade a database, make sure that the RMAN catalog schema version is greater than or equal to the catalog database version. The catalog schema version is the version of dbms_rcvcat, dbms_rcvman packages, and catalog tables and views in the schema. The RMAN executable version should be the same as the target database version. The RMAN catalog is backward-compatible with target databases from earlier releases.
RMAN will give the following errors when components are not compatible as per the matrix:
- RMAN-6186: PL/SQL package %s.%s version %s in %s database is too old
- RMAN-6429: %s database is not compatible with this version of RMAN
If your recovery catalog is older than that required by the RMAN client, then you must upgrade it. You will get an error if the recovery catalog version is higher than the RMAN client requirements.
To upgrade the recovery catalog, do the following:
Grant TYPE privilege to RMAN:
sqlplus> connect sys/oracle@catdb as sysdba; sqlplus> grant TYPE to rman;
- Connect to the target and recovery catalog databases using RMAN.
Once connected, issue the UPGRADE CATALOG; command. You’ll be prompted to enter the UPGRADE CATALOG; command again to confirm; do so. Oracle will process the command and show the results as follows, where XX is the new version number:
recovery catalog upgraded to version XX DBMS_RCVMAN package upgraded to version XX DBMS_RCVCAT package upgraded to version XX
Unregister a Target Database
Beginning with Oracle Database 10g, you can unregister a target database from the recovery catalog by using a new RMAN command (unregister) in one of the following ways (where <database_name> is the name of the target database to be unregistered and noprompt implies that RMAN should not prompt for confirmation before unregistering):
rman> unregister database <database_name>; rman> unregister database <database_name> noprompt;
If RMAN is connected to the target database where it is registered, you need not specify this name. If the database name is unique, provide the database_name argument to identify the database to unregister. If RMAN is not connected to the target database and the database_name is not unique in the recovery catalog, use SET DBID to identify the database.
Glimpse of Oracle Database 10g Release 2
This section includes a quick summary of the feature improvements in Oracle Database 10g Release 2.
- Oracle Database 10g Release 2 has improved the JDBC standards support and the dynamic load balancing of connections in RAC and grid environments, and enhanced the HTML DB user interface, PL/SQL gateway, and SQL.
- For XML application development, the Enterprise Developer’s Kit supports XMLType in Java, C++, and C, and offers XPATH Rewrite feature of XML DB.
- The Data Guard provides a Fast-Start failover feature to rapidly failover to the standby database, automatically convert the primary to standby database on failover, and offers improved redo transmission to standby databases.
- For RAC and grid support, you can have as many as 1,055 instances in a control file, although practically you may not encounter such a scenario.
- Oracle Backup is tightly integrated with RMAN, providing media management and avoiding any need for third-party backup software.
- Release 2 also has improved ASM to support multiple Oracle database versions, offering the functionality of the lowest database version as well as OS level file system manipulation commands.
- The Database Upgrade Assistant will ease the upgrade process to 10.2 from older versions and from 10.1.