Oracle Backup and Recovery Using RMAN Mark Rank DBA UW-Platteville
• Who am I? – DBA and Manager of Development D evelopment 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
• Background – General Backup and Recovery – Overview of RMAN
• Backup using RMAN – Configuration – Reporting and monitoring – Executing a backup
• Recovery using RMAN • Cloning using RMAN
• 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?
Thou shall not loose data!
• 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
• Legislation or Organizational policies • Time to backup • Time to recover • Redundancy of your system • Criticality of the data • Monitoring • System availability during backup
• 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
• 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
• 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
• 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
• To invoke RMAN without a repository...
cmd> rman target=[conn_string]
• To view the configuration RMAN> show all; • To set parameters
RMAN> configure [parameter syntax]; • See the reference manual for parameter syntax
• RETENSION POLICY • CONTROLFILE AUTOBACKUP • CONTROLFILE AUTOBACKUP FORMAT • CHANNEL 1 DEVICE TYPE DISK FORMAT
• 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; • To backup the database with the archive logs RMAN> Backup database plus archivelog; • Now for a demo…
• RMAN does block level incremental backups • Define levels of backup with level 0 being b eing a full backup • A level 0 backup must always exist before defining higher backups • Also an option to do cumulative backups
Da y Le vel
S un 0
Mon 2
T ue s 2
Wed 1
T hu r 2
Fr i 2
S un 0
• To execute an incremental backup RMAN> backup incremental level=[int] database plus archivelog;
• 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
• 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…
• 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, Practice”
A Demo
• An easy way to clone databases • A good way to validate your backup • A good way to practice recovery
• 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
• 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
• If you want your clone to a be as of a point p oint in time, use the SET UNTIL TIME function • You can use the TO_DATE function to specify the date
run { set until time = “to_date(‘20051012’,’yyyymmdd’)”; duplicate target database to LSTA pfile = \\rhea\apps\db\lsta\initlsta.ora; }
• See Chapter 16 of “Oracle9i RMAN Backup & Recovery”
• In general executable must match target database • See Appendix B of the RMAN Reference for details.
• 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
• Background – General Backup and Recovery – Overview of RMAN
• Backup using RMAN – Configuration – Reporting and monitoring – Executing a backup
• Recovery using RMAN • Cloning using RMAN
• 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
• 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
• Oracle Training – Enterprise DBA Part 1B: Backup and Recovery
• MetaLink Forum – Oracle Server Backup and Recovery/RMAN
UW-Platteville Development http://www.uwplatt.edu/oit/development E-mail address
[email protected]