You are on page 1of 6

Recovery Manager

Recovery Manager is a tool manages the process of creating backups and also manages the process
of restoring and recovering from them.

RMAN Functional Components:-

The RMAN environment consists of the utilities and databases that play a role in backing up our data.
At minimum the environment for RMAN must include the following:-

1. The target database to be backed up.


2. The RMAN client, which interprets backup and recovery commands.
3. Direct server sessions to execute those commands
4. Record our backup and recovery activity in the target database control file

Some environments will also use these operational components:-

1. FLASH RECOVERY AREA:- a disk location in which the DB can store and manage files
related to Backup and recovery. It is the automatic disk-based backup and recovery feature
simplifies managing disk space and files related to backup and recovery.

2. MEDIA MANAGEMENT SOFTWARE or LAYER:- required for RMAN to interface with


backup devices such as tape drives. To access sequential media devices like tape libraries,
RMAN uses third party media management software. A media manager controls these devices
during backup and recovery, managing the loading, labeling and unloading the media

3. RECOVERY CATALOG:- A separate database schema used to record RMAN activity against
One or more target databases. It holds the actual RMAN stored scripts, sequences of RMAN
commands for common backup tasks. Centralized storage of scripts in the recovery catalog can
be more convenient than working with command files.

PDF created with pdfFactory Pro trial version www.pdffactory.com


RMAN ClientàRecovery Catalog
|
| ---------------àFlash Recovery Area
|
Target Database.
|
|
BackUp---------------
| |
| |
MML Layer Disk
|
|
Tape.

Main Components

4. RMAN Client:- Is a command line oriented database client, much like SQL plus with its own
command syntax. From the RMAN client we can issue RMAN commands and SQL statements to
perform and report on backup and recovery operations.

5. RMAN Repository: RMAN maintains metadata about the target database and its backup and
recovery operations in the RMAN repository. RMAN repository data is always stored in the control
file of the target database. The CONTROL_FILE_RECORD_KEEP_TIME initialization parameter
controls how long backup records are kept in the control file.

HOW TO CONNECT TO TARGET DB USING RMAN


=========================================

C:\ set ORACLE_SID=HRTEST


C:\rman

RMAN> connect target;

PDF created with pdfFactory Pro trial version www.pdffactory.com


Connected to target database: HRTEST

Database backups with RMAN are actually quite easy. Your database can be in one of two modes,
ARCHIVELOG or NOARCHIVELOG mode. The mode your database is in determines what kinds of
backups you can perform on your database

Perform an Offline (Cold) Backup of your database with RMAN

It will show how to perform an offline (or cold) backup using RMAN. This will require that the
database be down (that’s why it’s called an offline backup).

Before we can use RMAN we need to configure a few settings.

The configuration is pretty basic. First, we need to configure a couple of database


parameters. These parameters will configure the Flash Recovery Area of the database.

This is the location that all the disk backups will be made to. To configure the flash
recovery area we will use the alter system command to set the value of two database
parameters:

* db_recovery_file_dest – Determines the location of the flash recovery area.

* db_recovery_file_dest_size – Determines how much space can be used by Oracle in


the flash recovery area.

NOTE:- You may need to assign your flash recovery area more space depending on the
following factors:

* The size of your database

* The number of backups you want to keep

* If you are running your database in ARCHIVELOG mode

Here is an example of configuring the flash recovery area for the settings:-

SQL>sqlplus /nolog
SQL>conn /as sysdba
SQL>connected
SQL>
SQL>
SQL>
SQL>

PDF created with pdfFactory Pro trial version www.pdffactory.com


SQL>
SQL> SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jul 26 09:06:12 2010

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

SQL> conn /as sysdba


Connected.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 70
Next log sequence to archive 72
Current log sequence 72
SQL>
SQL>
SQL> show parameter DB_RECOVERY

NAME TYPE VALUE


------------------------------------ ----------- ------------------------------
db_recovery_file_dest string C:\Apps\oracle\product\10.2.0\ flash_recovery_area
db_recovery_file_dest_size big integer 2G

SQL> Alter system set db_recovery_file_dest=’/ C:\Apps\oracle\product\10.2.0\ flash_recovery_area’

SQL> Alter system set db_recovery_file_dest_size=20G:

Now, we need to configure the retention policy to redundancy of 2.

RMAN> configure retention policy to redundancy 2;

Now, configure the automatic backup of Control File and SPFile

RMAN> configure controlfile autobackup on;

Now that RMAN and the database are configured, we are ready to proceed to backup the database.

RMAN Offline(Cold Backup)

Offline backup is a backup of the database while it is not running. Hence, to perform our backup we
will shutdown the database from RMAN and then mount the database. We will perform the backup.
Once the backup is complete we will restart the database again. Here is an example of this process:

Now connect to RMAN

PDF created with pdfFactory Pro trial version www.pdffactory.com


C:\set ORACLE_SID=HRTEST
C:\rman

RMAN>connect target;

Connnected to the target database : HRTEST

RMAN>Shutdown immediate
RMAN>Startup mount;
RMAN>backup database;

It will run some auto generated scripts on the screen and the backup will be done.

Once the backup gets over, then after

Go to SQL prompt again,

RMAN>exit

C:\set ORACLE_SID=HRTEST
C:\sqlplus /nolog

SQL>conn /as sysdba


SQL>startup
SQL>alter database open;

Once this process is complete, you have completed your first backup. Recall that we configured a
redundancy of 2 for the backups. RMAN will reclaim the space from the flash recovery area
automatically as required, removing all unneeded backups.

RMAN Online Backups

As the name implies, an online backup allows you to backup the database while users are
working.

First, you will need to put your database in ARCHIVELOG mode.

Here is the RMAN command that you will use to kick off a backup of your database:

RMAN>backup database plus archivelog delete input;

This command will backup your database. Along with the database backup, it will backup all the
archived redo logs that have been generated by your database. These archived redo logs are very
important to be able to recover your database so we back them up at the same time.

PDF created with pdfFactory Pro trial version www.pdffactory.com


You can backup archived redo logs by themselves from time to time by issuing this
command:

RMAN>backup archivelog all delete input;

Note in both examples the use of the delete input command. This will cause the source archive redo
logs to be removed once they are backed up. Don’t worry, the delete input command will not try to
delete your database or datafiles.

PDF created with pdfFactory Pro trial version www.pdffactory.com

You might also like