Oracle Backup and Recovery Using RMAN

Mark Rank DBA UW-Platteville

Intr odu ction
• 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

Ou tli ne
• 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 q uiz befo re w e star t
• 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?

DB A M otto

Thou shall not loose data!

Wh y d o we b acku p?
• 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 Con si der
• Legislation or Organizational policies • Time to backup • Time to recover • Redundancy of your system • Criticality of the data • Monitoring • System availability during backup

Some B est Prac tices
• 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

Wh at is RM AN ?
• 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 Repos itor y
• 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 with ou t R epos itory
• 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

Execu tin g RM AN
• To invoke RMAN without a repository... cmd> rman target=[conn_string]

Viewin g Con figu ration
• To view the configuration
RMAN> show all;

• To set parameters
RMAN> configure [parameter syntax];

• See the reference manual for parameter syntax

Some ke y par ame ters

A Not e Ab ou t DB ID’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;

• To backup the database without the archive logs
RMAN>backup database;

Perfor min g an O nlin e Backu p

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

• Now for a demo…

Increme ntal Backu p
• 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

Increme ntal Backu p

Day Level

Sun 0

Mon 2

Tues 2

Wed 1

Thur 2

Fri 2

Sun 0

Incr emen ta l Backu p Syntax
• To execute an incremental backup
RMAN> backup incremental level=[int] database plus archivelog;

Reten tion Po licy
• 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

Rep ortin g on the Catalog
• To get a summary of the backups
RMAN>list backupset summary;

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

• Now for a demo…

Man agin g the Catalog
• Setting the retention policy
RMAN> configure retention policy redundancy 2;

• Reporting obsolete
RMAN> report obsolete;

• Deleting obsolete
RMAN> delete obsolete;

• 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”

Reco ver in g a Ta bles pac e

A Demo

Usin g R MAN to Clon e
• An easy way to clone databases • A good way to validate your backup • A good way to practice recovery

Outlin e of th e Pr oced ure
• 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 not e abou t f iles
• 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 not e abo ut tim e
• 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

Wh at th at l ooks lik e
run { set until time = “to_date(‘20051012’,’yyyymmdd’)”; duplicate target database to LSTA pfile = \\rhea\apps\db\lsta\initlsta.ora; }

For more d et ail s
• See Chapter 16 of “Oracle9i RMAN Backup & Recovery”

A Wor d ab out Compatib ili ty
• In general executable must match target database • See Appendix B of the RMAN Reference for details.

On e Par tin g 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

Summar y
• Background
– General Backup and Recovery – Overview of RMAN

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

• Recovery using RMAN • Cloning using RMAN

Bi bli ograp hy
• 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 R esou rc es
• 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 Resou rces
• Oracle Training
– Enterprise DBA Part 1B: Backup and Recovery

• MetaLink Forum
– Oracle Server Backup and Recovery/RMAN

Q& A
UW-Platteville Development E-mail address

Sign up to vote on this title
UsefulNot useful