You are on page 1of 32

2

Configuring Recovery Manager

Copyright 2008, Oracle. All rights reserved.

Objectives
After completing this lesson, you should be able to do
the following:
Describe the RMAN repository and recovery
catalog
Describe the Media Management Library interface
Configure database parameters that affect RMAN
operations
Connect to the three different types of databases
by using RMAN
Configure two types of retention policies
Change RMAN default settings with CONFIGURE

2-2

Copyright 2008, Oracle. All rights reserved.

Backup and Recovery: Review


The major backup and recoveryrelated topics covered
in the Database Administration I Course are:
Types of failure that can happen
Statement, session, instance, media, and so on

2-3

How
How
How
How

to configure ARCHIVELOG mode


to automate backups
to do incremental backups
to perform and tune instance recovery

Copyright 2008, Oracle. All rights reserved.

Features of Recovery Manager


RMAN provides a flexible way to:
Back up the database including data files, control
files, and archived redo logs
Manage backup and recovery tasks
Perform incremental block-level backup and blocklevel media recovery
Detect corrupted blocks during backup
Use binary compression when creating backups

2-4

Copyright 2008, Oracle. All rights reserved.

Recovery Manager Components

Server
session

Target
database

Recovery
Manager
(RMAN)

Options
Auxiliary
database

Channel

Channel

Enterprise
Manager
Server
session

Channel
MML

Disk

2-6

Flash recovery
area

Copyright 2008, Oracle. All rights reserved.

Recovery
catalog
database

Auxiliary database: An auxiliary database is used when creating a duplicate database


or performing tablespace point-in-time recovery (TSPITR). For the tasks, the auxiliary
database serves as the destination of the new copy of the database or the recovered
tablespaces. An auxiliary database can reside on the same host as its parent or on a
different host.
Channel: A channel represents one stream of data to a device type. To perform and
record backup and recovery operations, RMAN requires a link to the target database. A
channel establishes this link by creating a session in the target database that is able to
interface with the host file system (to interface with disks) and the Media Management
Library (to interface with tapes). You can allocate channels manually or preconfigure
channels by using automatic channel allocation.
RMAN repository: RMAN maintains metadata about the target database and its
backup and recovery operations in the RMAN repository. Among other things, RMAN
stores information about its own configuration settings, the target database schema,
archived redo logs, and all backup files that are on disk or tape. RMAN repository data
is always stored in the control file of the target database.
Media Management Library: The Media Management Library (MML) is used by RMAN
when writing to or reading from tapes. The additional media management software
required for using the tape medium is provided by media and storage system vendors.
Also, the Oracle Secure Backup product allows RMAN to back up to tape without
requiring third-party tools.

2-8

Copyright 2008, Oracle. All rights reserved.

Steps for Configuring RMAN


1. Determine the repository location: control file or
recovery catalog.
2. Define database and environment variables.
3. Start RMAN and connect to the target and,
optionally, the recovery catalog databases.
4. Configure persistent settings.

2-9

Copyright 2008, Oracle. All rights reserved.

RMAN Repository Data Storage:


Comparison of Options
Control file:

Recovery catalog:

Simpler administration
Default

Replicates control file data


Has room for more data
Can service many targets
Can store RMAN scripts

Metadata
Backup set list
Image copy list
.
.
.

2 - 10

Copyright 2008, Oracle. All rights reserved.

Backup Destinations
Backups can be written to:
Disk directory
Media Management Library (tape device)
Typically used for disaster recovery, when disk
backups are lost

Flash recovery area


This is a disk area set aside for backup and recovery
and flashback database purposes.
You define the location and the size.
Files are automatically named by using Oracle
Managed Files.
Files are automatically retained and deleted as
necessary.

2 - 12

Copyright 2008, Oracle. All rights reserved.

Media Management
Server
session
(channel)

Recovery
Manager

Oracle Secure
Backup with
built-in MML

2 - 13

Or

Media
management
library
Media
management
server software

Copyright 2008, Oracle. All rights reserved.

Using a Flash Recovery Area with RMAN


You can configure RMAN to use the flash recovery
area.

RMAN backup
process
Database area

Flash recovery area

DB_RECOVERY_FILE_DEST = '/u01/oracle/fra'
DB_RECOVERY_FILE_DEST_SIZE = 2G

2 - 15

Copyright 2008, Oracle. All rights reserved.

Monitoring the Flash Recovery Area


with EM

2 - 17

Copyright 2008, Oracle. All rights reserved.

Flash Recovery Area Space Usage

2 - 18

Configure the retention policy to the minimum


value appropriate for your database.
Back up the archive log files regularly and delete
the files upon completion of the backup.
Use the RMAN REPORT OBSOLETE and DELETE
OBSOLETE commands to remove backups and file
copies that are not required.

Copyright 2008, Oracle. All rights reserved.

V$FLASH_RECOVERY_AREA_USAGE
You can query V$FLASH_RECOVERY_AREA_USAGE to
view the flash recovery area disk space usage.
SQL>
2
3
4
5

SELECT file_type,
percent_space_used AS used,
percent_space_reclaimable AS reclaimable,
number_of_files AS number
FROM v$flash_recovery_area_usage ;

FILE_TYPE
USED RECLAIMABLE FILES
----------------- --------- ----------- ------

2 - 19

Copyright 2008, Oracle. All rights reserved.

V$FLASH_RECOVERY_AREA_USAGE
Output from the V$FLASH_RECOVERY_AREA_USAGE
query
FILE_TYPE
USED RECLAIMABLE
FILES
------------ ---------- ----------- ---------CONTROLFILE
0
0
0
ONLINELOG
0
0
0
ARCHIVELOG
69.13
0
593
BACKUPPIECE
0
0
0
IMAGECOPY
0
0
0
FLASHBACKLOG
1.77
0
37

2 - 20

Copyright 2008, Oracle. All rights reserved.

Backing Up the Flash Recovery Area

RMAN> BACKUP RECOVERY FILES;

2 - 21

Copyright 2008, Oracle. All rights reserved.

Benefits of Using a Flash Recovery Area


Using the flash recovery area for recovery-related files:
Simplifies the location of database backups
Automatically manages the disk space allocated
for recovery files
Does not require changes to existing scripts
Puts database backups, archive logs, and control
file backups in the flash recovery area

2 - 22

Copyright 2008, Oracle. All rights reserved.

Setting Parameters That Affect RMAN

Database initialization parameters


CONTROL_FILE_RECORD_KEEP_TIME
DB_RECOVERY_FILE_DEST and
DB_RECOVERY_FILE_DEST_SIZE, if using the flash
recovery area

Environment variables
NLS_DATE_FORMAT
NLS_LANG

2 - 23

Copyright 2008, Oracle. All rights reserved.

RMAN Usage Considerations

Resources: Shared memory, more processes


Privileges given to users:
Database: SYSDBA
Operating system: Access to devices

Remote operations:
Set up the password file
Ensure that the password file is backed up

2 - 25

Copyright 2008, Oracle. All rights reserved.

Connection Types with RMAN

Target
database

Recovery
catalog DB

Recovery
Manager

2 - 26

Copyright 2008, Oracle. All rights reserved.

Auxiliary
database

Starting RMAN

Starting RMAN locally

UNIX: $ ORACLE_SID=DB01; export ORACLE_SID


$ rman target /
Windows NT: C:\> set ORACLE_SID=DB01
C:\> rman target /

Starting RMAN remotely


rman target sys/password@DB01

2 - 27

Copyright 2008, Oracle. All rights reserved.

Additional RMAN
Command-Line Arguments

Writing RMAN output to a log file

$ rman TARGET sys/oracle


LOG=$HOME/oradata/u03/rman.log APPEND

Executing a command file when RMAN is invoked

$ rman TARGET sys/oracle


CMDFILE=$HOME/scripts/my_rman_script.rcv

Establishing database connections on RMAN


startup

$ rman TARGET SYS/sys_pwd@orcl CATALOG


rman/rman@rcat

2 - 28

Copyright 2008, Oracle. All rights reserved.

Configuring Persistent Settings for RMAN

RMAN is preset with default configuration settings


Use the CONFIGURE command to:

2 - 29

Configure automatic channels


Specify the backup retention policy
Specify the number of backup copies to be created
Set the default backup type to BACKUPSET or COPY
Limit the size of backup sets
Exempt a tablespace from backup
Enable and disable backup optimization
Configure automatic backups of control files

Copyright 2008, Oracle. All rights reserved.

Configuring RMAN Settings by Using EM

2 - 30

Copyright 2008, Oracle. All rights reserved.

Control File Autobackups

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;

Best practice: Oracle recommends that you enable


control file autobackup.

2 - 31

Copyright 2008, Oracle. All rights reserved.

Retention Policies

A retention policy describes which backups will be


kept and for how long.
There are two types of retention policies:
Recovery window: Establishes a period of time within
which point-in-time recovery must be possible
File2

File1

Now

File2 needs
to be backed up:
Seven-day retention

Redundancy: Establishes a fixed number of backups


that must be kept

2 - 33

These policies are mutually exclusive and can be


set with the CONFIGURE command.
Copyright 2008, Oracle. All rights reserved.

Managing Persistent Settings

Use the SHOW command to list current settings:

RMAN> SHOW CONTROLFILE AUTOBACKUP FORMAT;


RMAN> SHOW EXCLUDE;
RMAN> SHOW ALL;

Use the CLEAR command to reset any persistent


setting to its default value:

RMAN> CONFIGURE BACKUP OPTIMIZATION CLEAR;


RMAN> CONFIGURE MAXSETSIZE CLEAR;
RMAN> CONFIGURE DEFAULT DEVICE TYPE CLEAR;

2 - 35

Copyright 2008, Oracle. All rights reserved.

Channel Allocation

Target
database

2 - 36

Server
session

Channel
(DISK)

Server
session

Channel
(SBT)

Copyright 2008, Oracle. All rights reserved.

RMAN

BACKUP
RESTORE
RECOVER

Automatic and Manual Channel Allocation

An automatic channel is one that is preconfigured


and used for subsequent commands. To change the
default device type for automatic channel allocation,
use:
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;

A manually allocated channel is one that overrides


the automatic channel setting. This channel overrides
the automatic channel for this run block:
RMAN> RUN {
2> ALLOCATE CHANNEL c1 DEVICE TYPE disk;
3> BACKUP DATAFILE '/u01/oradata/user01.dbf';
4> }

2 - 37

Copyright 2008, Oracle. All rights reserved.

Channel Control Options

Configure parallelism:

RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 3;

Specify the maximum backup piece size:

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK


2> MAXPIECESIZE 2G;

Format the name of generated backup files:

RMAN> RUN {
2> ALLOCATE CHANNEL d1 DEVICE TYPE DISK
3> FORMAT '/disk1/backups/%U';
4> BACKUP DATABASE PLUS ARCHIVELOG; }

2 - 38

Copyright 2008, Oracle. All rights reserved.

Summary
In this lesson, you should have learned how to:
Use either the control file or a recovery catalog for
the RMAN repository
Change RMAN default settings with CONFIGURE
Use the flash recovery area for RMAN operations
Monitor the flash recovery area by using v$ views
and Enterprise Manager
Implement recovery window and redundancy
retention policies
Implement manual and automatic channel
allocation

2 - 40

Copyright 2008, Oracle. All rights reserved.

Practice Overview: Configuring RMAN


This practice covers the following topics:
Using Recovery Manager to connect to a target
database in default NOCATALOG mode
Displaying the default RMAN configuration
settings
Configuring control file autobackups
Altering the backup retention policy for a database

2 - 41

Copyright 2008, Oracle. All rights reserved.

You might also like