Вы находитесь на странице: 1из 31

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

How to configure ARCHIVELOG mode How to automate backups How to do incremental backups How to perform and tune instance recovery

2-3

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 block-level media recovery Detect corrupted blocks during backup Use binary compression when creating backups

2-4

Copyright 2008, Oracle. All rights reserved.

Recovery Manager Components

Target database

Server session

Recovery Manager (RMAN)

Enterprise Manager

Options Auxiliary database

Server session Channel MML

Channel

Channel

Disk

Flash recovery area

Recovery catalog database

2-6

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-8

Copyright 2008, Oracle. All rights reserved.

RMAN Repository Data Storage: Comparison of Options


Control file:
Simpler administration Default

Recovery catalog:
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-9

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 - 11

Copyright 2008, Oracle. All rights reserved.

Media Management
Recovery Manager Server session (channel)

Oracle Secure Backup with built-in MML

Or

Media management library Media management server software

2 - 12

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 - 14

Copyright 2008, Oracle. All rights reserved.

Monitoring the Flash Recovery Area with EM

2 - 16

Copyright 2008, Oracle. All rights reserved.

Flash Recovery Area Space Usage

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.

2 - 17

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 - 18

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 - 19

Copyright 2008, Oracle. All rights reserved.

Backing Up the Flash Recovery Area

RMAN> BACKUP RECOVERY FILES;

2 - 20

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 - 21

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 - 22

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 - 24

Copyright 2008, Oracle. All rights reserved.

Connection Types with RMAN

Target database

Recovery catalog DB

Auxiliary database

Recovery Manager

2 - 25

Copyright 2008, Oracle. All rights reserved.

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 - 26

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 - 27

Copyright 2008, Oracle. All rights reserved.

Configuring Persistent Settings for RMAN

RMAN is preset with default configuration settings Use the CONFIGURE command to:
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

2 - 28

Copyright 2008, Oracle. All rights reserved.

Configuring RMAN Settings by Using EM

2 - 29

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 - 30

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 File2 needs to be backed up: Seven-day retention File1 Now

Redundancy: Establishes a fixed number of backups that must be kept

2 - 32

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 - 34

Copyright 2008, Oracle. All rights reserved.

Channel Allocation

Server session Target database Server session

Channel (DISK)

RMAN

BACKUP RESTORE RECOVER


Channel (SBT)

2 - 35

Copyright 2008, Oracle. All rights reserved.

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 - 36

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 - 37

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 - 39

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 - 40

Copyright 2008, Oracle. All rights reserved.

Вам также может понравиться