Recovery Manager
Recovery Manager (RMAN) is an Oracle provided utility for backing-up, restoring and recovering Oracle Databases. RMAN ships with the Oracle database and doesn't require a separate installation. The RMAN executable is located in your ORACLE_HOME/bin directory. In fact, RMAN, is just a Pro*C application that translates commands to a PL/SQL interface. The PL/SQL calls are statically linked into the Oracle kernel, and does not require the database to be opened (mapped from the ?/rdbms/admin/recover.bsq file).
Benefits of RMAN
Some of the benefits provided by RMAN include:
- Backups are faster and uses fewer tapes (RMAN will skip empty blocks)
- Less database archiving while database is being backed-up
- RMAN checks the database for block corruptions
- Automated restores from the catalog
- Files are written out in parallel instead of sequentially
Getting started
RMAN can be operated from Oracle Enterprise Manager, or from command line. Here are the command line arguments:
Argument Value Description ----------------------------------------------------------------------------- target quoted-string connect-string for target database catalog quoted-string connect-string for recovery catalog nocatalog none if specified, then no recovery catalog cmdfile quoted-string name of input command file log quoted-string name of output message log file trace quoted-string name of output debugging message log file append none if specified, log is opened in append mode debug optional-args activate debugging msgno none show RMAN-nnnn prefix for all messages send quoted-string send a command to the media manager pipe string building block for pipe names timeout integer number of seconds to wait for pipe input -----------------------------------------------------------------------------
Here is an example:
[oracle@localhost oracle]$ rman Recovery Manager: Release 10.1.0.2.0 - Production Copyright (c) 1995, 2004, Oracle. All rights reserved. RMAN> connect target; connected to target database: ORCL (DBID=1058957020) RMAN> backup database; ...
Using a recovery catalog
Start by creating a database schema (usually called rman). Assign an appropriate tablespace to it and grant it the recovery_catalog_owner role. Look at this example:
sqlplus sys/ as sysdba SQL> create user rman identified by rman; SQL> alter user rman default tablespace tools temporary tablespace temp; SQL> alter user rman quota unlimited on tools; SQL> grant connect, resource, recovery_catalog_owner to rman; SQL> exit;
Next, log in to rman and create the catalog schema. Prior to Oracle 8i this was done by running the catrman.sql script.
rman catalog rman/rman RMAN> create catalog tablespace tools; RMAN> exit;
You can now continue by registering your databases in the catalog. Look at this example:
rman catalog rman/rman target backdba/backdba RMAN> register database;
Writing to tape
RMAN can do off-line and on-line database backups. It cannot, however, write directly to tape. A MML (Media Manager Layer) is required to interface between RMAN and the tape drive/library. Various 3rd-party tools (like Veritas Netbackup, Data Protector, TSM, etc) are available that can integrate with RMAN to handle the tape library management.
To see what tapes were used for a particular backup, run this query against the RMAN catalog database:
SELECT media, start_time, completion_time FROM rc_backup_piece WHERE db_id = (SELECT db_id FROM rc_database WHERE UPPER(name) = 'ORCL') AND completion_time BETWEEN TO_DATE('27-DEC-2007 12:38:36','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('28-DEC-2007 01:39:27','DD-MON-YYYY HH24:MI:SS') /