oracle backup and recovery using rman

Post on 10-Apr-2015

3.202 Views

Category:

Documents

4 Downloads

Preview:

Click to see full reader

DESCRIPTION

Oracle Backup and Recovery Using RMAN - Mark RankDBAUW-Platteville

TRANSCRIPT

Oracle Backup and Recovery Using RMAN

Mark RankDBA

UW-Platteville

Introduction• Who am I?

– DBA and Manager of Development for UW-Platteville

• Oracle experience– Worked with Oracle for about 10 years – Worked with RMAN for 2 years– Using RMAN version 9.2 in production

for backup at UW-Platteville

Outline• Background

– General Backup and Recovery– Overview of RMAN

• Backup using RMAN– Configuration– Reporting and monitoring– Executing a backup

• Recovery using RMAN• Cloning using RMAN

A little quiz before we start

• Backing up Oracle data files using OS commands while the database is open will give a valid backup?

• Archiving the redo log files is done only for record retention reasons?

• If you have a backup of the database you can always recover the database?

• A database will have uncommitted transactions after recovery?

DBA Motto

Thou shall not loose data!

Why do we backup?• Manage Risk

– How much risk can we afford to accept?• Cost of backup systems• Loss of customer confidence

– How much risk are we allowed to accept?• Political Factors• Cultural Factors• Legal Factors

Factors to Consider• Legislation or Organizational policies • Time to backup• Time to recover• Redundancy of your system• Criticality of the data• Monitoring• System availability during backup

Some Best Practices• Have a documented backup procedure• Have a multilayer backup process if you can• Have people trained with the recovery tools• Monitor the backup processes regularly• Correct issues with backup promptly• Conduct Fire Drills of your backup processes

What is RMAN?• Stands for Recovery Manager• Oracle’s recommended way of doing

physical backups• Supports both online (hot) and offline

(cold) backups• Does backup at the block level

resulting in a “fine grain” backup

RMAN Repository• A database used by RMAN to store

configuration and record backup information

• Optional on 9i or greater• Still need to come up with a backup

method for the repository• Not going to cover RMAN with the

repository in this presentation

RMAN without Repository

• With 9i or greater, can use the control file to store the RMAN configuration and backup data

• Will cause the control file to get larger

• May want to set the CONTROL_FILE_RECORD_KEEP_TIME

Executing RMAN• To invoke RMAN without a

repository...

cmd> rman target=[conn_string]

Viewing Configuration• To view the configuration

RMAN> show all;

• To set parametersRMAN> configure [parameter syntax];

• See the reference manual for parameter syntax

Some key parameters• RETENSION POLICY• CONTROLFILE AUTOBACKUP• CONTROLFILE AUTOBACKUP FORMAT• CHANNEL 1 DEVICE TYPE DISK

FORMAT

A Note About DBID’s• When using RMAN without a repository,

need to inventory the DBID’s• Needed for recovery without a control

file• Create a script that inventories them

as part of your back strategy

SQL> select dbid from v$database;

Performing an Online Backup

• To backup the database without the archive logsRMAN>backup database;

• To backup the database with the archive logsRMAN> Backup database plus archivelog;

• Now for a demo…

Incremental Backup• RMAN does block level incremental

backups• Define levels of backup with level 0

being a full backup• A level 0 backup must always exist

before defining higher backups• Also an option to do cumulative

backups

Incremental Backup

Day Sun Mon Tues Wed Thur Fri SunLevel 0 2 2 1 2 2 0

Incremental Backup Syntax

• To execute an incremental backupRMAN> backup incremental level=[int] database plus archivelog;

Retention Policy• Recovery Window

– Latest possible date to recover database to

– Maintains information for a point-in-time recovery anywhere in the window

• Backup Redundancy– Maintains specified number of backups

including the most current

Reporting on the Catalog• To get a summary of the backups

RMAN>list backupset summary;

• To get the details of a backup setRMAN>list backupset [int];

• Now for a demo…

Managing the Catalog• Setting the retention policy

RMAN> configure retention policy redundancy 2;

• Reporting obsoleteRMAN> report obsolete;

• Deleting obsoleteRMAN> delete obsolete;

Recovery• Read the book “Oracle9i RMAN

Backup & Recovery” or attend one of Oracle’s classes

• Recovery using RMAN is straightforward, but it is also easy to trip yourself up

• “Practice, Practice, Practice”

Recovering a Tablespace

A Demo

Using RMAN to Clone• An easy way to clone databases• A good way to validate your backup• A good way to practice recovery

Outline of the Procedure• Establish a target database and bring

it up to NOMOUNT• Connect using RMAN to the source

database• Force a checkpoint and log switch• Duplicate the source to the target

using the DUPLICATE TARGET DATABASE command

A note about files• Unless the file structures are the same you

will need to put db_file_name_convert and log_file_name_convert commands in our INIT.ORA file

• Unless all of your archive logs are in the RMAN backup, you may have to do a manual recovery because of file name issues

A note about time• If you want your clone to a be as of a

point in time, use the SET UNTIL TIME function

• You can use the TO_DATE function to specify the date

What that looks likerun {

set until time =

“to_date(‘20051012’,’yyyymmdd’)”;

duplicate target database to LSTA

pfile = \\rhea\apps\db\lsta\initlsta.ora;

}

For more details• See Chapter 16 of “Oracle9i RMAN

Backup & Recovery”

A Word about Compatibility

• In general executable must match target database

• See Appendix B of the RMAN Reference for details.

One Parting Note• Test your backups

– Fire drill regularly– If possible use your backups as the

source for test databases

• Nothing worse than needing to recover and finding out the tape is blank

Summary• Background

– General Backup and Recovery– Overview of RMAN

• Backup using RMAN– Configuration– Reporting and monitoring– Executing a backup

• Recovery using RMAN• Cloning using RMAN

Bibliography• Where does this information come

from?– Oracle 9i RMAN Backup & Recovery– Oracle 9i New Features Overview Class– Oracle 8 Backup and Recovery

Workshop– My own experimentation

Some Resources• Oracle9i RMAN Backup & Recovery

– By Freeman and Hart – Published by Oracle Press

• Oracle Manuals– Recovery Manager Quick Reference– Recovery Manager Reference– Recovery Manager User's Guide

More Resources• Oracle Training

– Enterprise DBA Part 1B: Backup and Recovery

• MetaLink Forum – Oracle Server Backup and Recovery/RMAN

Q&A

UW-Platteville Developmenthttp://www.uwplatt.edu/oit/

development

E-mail addressrank@uwplatt.edu

top related