Download - Oracle Backup and Recovery Using RMAN
![Page 1: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/1.jpg)
Oracle Backup and Recovery Using RMAN
Mark RankDBA
UW-Platteville
![Page 2: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/2.jpg)
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
![Page 3: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/3.jpg)
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
![Page 4: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/4.jpg)
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?
![Page 5: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/5.jpg)
DBA Motto
Thou shall not loose data!
![Page 6: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/6.jpg)
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
![Page 7: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/7.jpg)
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
![Page 8: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/8.jpg)
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
![Page 9: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/9.jpg)
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
![Page 10: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/10.jpg)
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
![Page 11: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/11.jpg)
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
![Page 12: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/12.jpg)
Executing RMAN• To invoke RMAN without a
repository...
cmd> rman target=[conn_string]
![Page 13: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/13.jpg)
Viewing Configuration• To view the configuration
RMAN> show all;
• To set parametersRMAN> configure [parameter syntax];
• See the reference manual for parameter syntax
![Page 14: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/14.jpg)
Some key parameters• RETENSION POLICY• CONTROLFILE AUTOBACKUP• CONTROLFILE AUTOBACKUP FORMAT• CHANNEL 1 DEVICE TYPE DISK
FORMAT
![Page 15: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/15.jpg)
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;
![Page 16: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/16.jpg)
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…
![Page 17: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/17.jpg)
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
![Page 18: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/18.jpg)
Incremental Backup
Day Sun Mon Tues Wed Thur Fri SunLevel 0 2 2 1 2 2 0
![Page 19: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/19.jpg)
Incremental Backup Syntax
• To execute an incremental backupRMAN> backup incremental level=[int] database plus archivelog;
![Page 20: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/20.jpg)
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
![Page 21: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/21.jpg)
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…
![Page 22: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/22.jpg)
Managing the Catalog• Setting the retention policy
RMAN> configure retention policy redundancy 2;
• Reporting obsoleteRMAN> report obsolete;
• Deleting obsoleteRMAN> delete obsolete;
![Page 23: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/23.jpg)
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”
![Page 24: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/24.jpg)
Recovering a Tablespace
A Demo
![Page 25: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/25.jpg)
Using RMAN to Clone• An easy way to clone databases• A good way to validate your backup• A good way to practice recovery
![Page 26: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/26.jpg)
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
![Page 27: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/27.jpg)
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
![Page 28: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/28.jpg)
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
![Page 29: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/29.jpg)
What that looks likerun {
set until time =
“to_date(‘20051012’,’yyyymmdd’)”;
duplicate target database to LSTA
pfile = \\rhea\apps\db\lsta\initlsta.ora;
}
![Page 30: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/30.jpg)
For more details• See Chapter 16 of “Oracle9i RMAN
Backup & Recovery”
![Page 31: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/31.jpg)
A Word about Compatibility
• In general executable must match target database
• See Appendix B of the RMAN Reference for details.
![Page 32: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/32.jpg)
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
![Page 33: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/33.jpg)
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
![Page 34: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/34.jpg)
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
![Page 35: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/35.jpg)
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
![Page 36: Oracle Backup and Recovery Using RMAN](https://reader036.vdocuments.mx/reader036/viewer/2022081502/552883bb5503467a588b47f1/html5/thumbnails/36.jpg)
More Resources• Oracle Training
– Enterprise DBA Part 1B: Backup and Recovery
• MetaLink Forum – Oracle Server Backup and Recovery/RMAN