Read Oracle RMAN 11g Backup and Recovery Online
Authors: Robert Freeman
Acknowledgments
s we bring this book to a close, I stand in Hobbit land…also known as New Zealand, doing a presentation on RMAN. How amazing is it that I get to
do things like this. My life has been very positively impacted by the Oracle
A
Database product. I feel so lucky to be doing what I’m doing, and to have the opportunities that I have. There are so many people to thank who have helped me along on this journey and if I took the time to name each one, we would have yet another voluminous book on our hands that would cost at least twenty-five dollars just in shipping charges. So I’ll refrain from the typical naming of names, you know who you are and I thank you for everything you have done for me.
As for this book, there are a few people to thank. I want to thank my wife, Lisa, for putting up with me during the writing and editing process. I want to thank Lisa McClain and Meghan Riley for putting up with my terrible schedule, and Matthew as well. They really deserve a reward. Thanks to the rest of the team at McGraw-Hill Professional, including Janet Walden, Emilia Thiuri, Jan Jue, and Paul Tyler. Also thanks to you, the reader, for reading/buying this book.
—Robert G. Freeman
It seems to be getting harder and harder to get these books out the door, given the complex nature of the products, and the ever-changing landscape of the authors and contributors’ lives. Therefore, I want to first thank both Lisa McClain, and especially Meghan Riley, for not saying all of the completely deserved things I’m sure they wanted to say to me, and instead remaining focused on the outcome and driving us all toward it.
You both deserved better.
Second big thanks goes to Matt Arrocha, for, again, playing the part of the person who actually knows the most about RMAN and keeping us on track.
The contributors on this book, as always, worked hard to create extremely valuable chapters on media management that complete the book (and give it some of its legendary heft). Thanks to Emre Baransel, Scott Black, Alan Bort, Jeremiah Wilton, and Alisher Yuldashev for making this a complete book.
No book is complete without the sharp eyes and controlling hand of the copy editor, and Jan Jue had both in spades. Emilia Thiuri, the project editor, also suffered at the hands of this very-tardy author, and deserves special thanks for her patience.
This is Robert and my third collaboration, and I remain impressed with his enthusiasm and desire for completeness. Robert, good luck over there at the mothership. As always, my good friend Martin Ingram continues to provide the kind of personal and professional support that keeps me pushing hard, every day.
This book came at a time when I had no business writing another book, and to muscle it through to completion meant the kinds of sacrifices for which I must stand in awe of my wife and my kids, who have learned the hard way what it takes to make this sort of thing happen. I owe everything I’ve ever done well or right to them.
Thanks to you, the reader, for making the RMAN books such a great success and for reading yet another version.
—Matthew Hart
xxiii
This page intentionally left blank
Introduction
o, yet another edition of our RMAN backup and recovery book has hit
the shelves! Oracle Database 11
g
has proven to be quite the release to be sure. RMAN has new functionality and whizbang new features that
S
improve an already awesome product. RMAN has certainly evolved over the years, as anyone who started working with it in Oracle version 8 can attest to.
Answering the Question … and Asking a New One
In
Oracle9
i
RMAN Backup & Recovery
, we posed the following question in this same space: how can I balance availability with recoverability? We hoped to answer that question with a full coverage of Oracle’s backup and recovery solution, and the number of copies sold tells us that many people liked the answer. We introduced
Oracle9
i
RMAN
Backup & Recovery
at a time when people were really starting to adopt RMAN as a backup and recovery solution.
With the release of
Oracle Database 10
g
RMAN Backup & Recovery
, we found an audience of people more familiar with RMAN. At the same time, this audience was asking more complex questions, and trying to keep up with all the new features offered with Oracle Database 10
g
. With databases growing ever faster, and mean-time-to-recovery becoming the buzzword of the day, RMAN became an indispensable tool in the DBA’s day-to-day toolkit.
With the release of Oracle Database 11
g
, the trend continues. Complexity is an understatement these days, and DBAs struggle to keep up with the changes occurring.
From Grid computing to high availability and mean-time-to-recovery, the questions get more complex and so to do the answers. Still, we feel like RMAN comes out as the answer to such questions.
If you are not aware, RMAN comes with the Oracle database license. It’s installed when the database is installed and generally ready to go (with some minimal configuration which we talk about in depth in this book!). RMAN is ready to back up the smallest Oracle Database or the largest, most complex Oracle database. It can back up your single instance database sitting on a small server or your multinode RAC clustered database sitting on multiple servers. RMAN still has the old bells and whistles you are used to, but Oracle Database 11
g
offers a range of new features that improve its capabilities several fold.
A Book for the DBA and the Sys Admin
Perhaps the most frustrating part of formulating a solid, reliable backup strategy for an Oracle database is that it usually overlaps two different kinds of people: the database administrator and the system administrator. Formulating an RMAN strategy is no different.
Its tight integration with the Oracle RDBMS means a system administrator must establish a working knowledge of an Oracle database. But, the reliance on external tape storage systems and the network topology makes it critical that the DBA be able to administer networked computer systems. This makes for an interesting separation of duties and for headaches on each side.
xxv
xxvi
Oracle RMAN 11
g
Backup and Recovery
Furthermore, business demands are fusing the role descriptions of the DBA and the system administrator. Or, more precisely, DBAs are finding their work increasingly expanding into system administrator work, and system administrators find themselves spending more time learning SQL
commands.
This book addresses this overlap by offering how-to advice in the areas where the overlap is most acute: database backups.
RMAN: An Evolution into Excellence
RMAN was introduced in version 8.0.3, the first production release of Oracle8. Prior to this, the Oracle-provided interface for streaming backups directly to tape involved logical backups using the Export utility, or use of the Enterprise Backup Utility (EBU). Ah, EBU. May it rest in peace, and we promise this is the last time we will ever mention it.
Ever
.
As an initial release, RMAN had its pratfalls and quirks. But with every release since its rollout, new features have been added, bugs have been fixed, and the interface has been polished. The best way to visualize the progress is to think of the traditional poster showing the evolution of humans: at the far left, we see a monkey, walking on all fours. Then, moving to the right, we see an increasingly upright version of a human, until we arrive at the far right, where we see a fully upright, modern homo sapiens.
With the release of Oracle9
i
, RMAN reached a fully upright walking position. It has truly become a necessary component in any serious strategy for a highly available database system.
Now that RMAN has been through two 10
g
releases, it has moved beyond a simple upright position, and has picked up a tablet and learned to read. Belabored metaphor aside, RMAN has continued its evolution into a fully functional availability partner.
What This Book Covers
This handbook was written to utilize the latest features included in Oracle Database 11
g
Release 2.
It therefore takes advantage of the latest enhancements to the RMAN interface and explains the newest features available. All code examples and architectural explanations are based on the 11
g
R2
release of RMAN.
If you are still using earlier versions of Oracle and RMAN (Oracle8
i
, Oracle9
i
, Oracle Database 10
g
) this book will still be helpful, but you will find a number of features missing. You might want to also reference our previous RMAN books (
Oracle9
i
RMAN Backup & Recovery
or
Oracle Database 10
g
RMAN Backup & Recovery)
. The book you are currently reading makes no attempt to cover functionality as it existed in previous versions.
Using This Book Effectively
Like all technical manuals worth their weight, this book is meant to be readable, cover to cover, as a way to familiarize yourself with RMAN and its role in any high availability or disaster recovery solution. The topics are approached in a format that allows each complex subject to build on previous chapters, slowly working forward from principles, to setup, to backups, and then beyond backups to advanced functionality and practices.
As such, Part I is dedicated to an introduction to backup and recovery principles in the Oracle RDBMS. It gives an important conceptual understanding of RMAN and how it does that mojo that it does. These two chapters lay the foundation for all future chapters, and we encourage you to read them carefully and understand the concepts being discussed. If you can understand the concepts and internal workings, then the rest of the book will be a breeze.
Contents
xxvii
Part II is dedicated to setting up RMAN for initial usage. We cover all possible RMAN
configuration options. Then, we discuss the integration with a media manager, the layer that allows you to write your backups directly to a tape device. While there are many products on the market, we will discuss four of the media management products: Oracle’s own Secure Backup, VERITAS NetBackup, EMC NetWorker Module for Oracle, and IBM Tivoli Storage Manager.
In Part III, we provide the basics for RMAN usage, from the most basic backup operation to the most advanced recovery option. We discuss catalog maintenance and how to keep an eye on the catalog so that you can effectively manage the backups that are accumulating. Here is where we discuss using Oracle’s redesigned Enterprise Manager product and cover Flashback Technology for recovery from logical errors. Finally, there is a discussion on tuning RMAN backups and restores for optimal performance when it counts.
Part IV moves past backup and recovery, discussing how RMAN can assist you in tasks other than just simple backups. In this part, we run through how to use the RMAN backups to make a cloned copy of your database and how to use the backups to create a standby database for Oracle Data Guard. Then, we discuss using RMAN in a Real Application Clusters (RAC) environment, with its special needs and requirements. We end the section with a series of RMAN case studies that delve into common (and not so common) situations that require RMAN.
The appendixes in Part V include an RMAN syntax reference, for building a successful RMAN
command, and an exploration of the RMAN catalog, both in v$views in the database and rc_* views in the recovery catalog. In addition, Appendix C goes into some detail about how to set up an RMAN test environment to put this book to work with minimal busywork.
RMAN Workshops
Not everyone reads a book cover to cover. We know this. Sometimes that’s not the higher calling of a good technical book. A good book lives next to the computer, with pages dog-eared, sections highlighted, and little yellow Post-its hanging off the side.
This book is meant to be a reference guide in addition to a conceptual explanation. We’ve packed this thing with useful techniques and timesaving practices that you can implement now, even if you’re a little spotty on the architecture. Sometimes you just need to know
how to do it
, right? Especially when it comes to backup and recovery. No one wants to get stuck in the middle of a weekend recovery binge, trying to figure out the exact syntax for a particular restore operation while the production database sits idly by, bleeding revenue at a spectacular rate.
So, to help with the highlighting and dog-earing of pages, we utilize RMAN Workshop sections, which readers of our previous RMAN books will recognize. Whenever we provide useful code for performing a specific operation, or a series of steps to complete a certain project, we put it in an RMAN Workshop box. When you see this box, you know the following pages will be filled with the actual steps you need to follow to get your job done fast. Think of RMAN
Workshops as recipes, providing the ingredients and the mixing instructions for a quick and easy meal. And to make your life even easier, we’ve highlighted each RMAN Workshop, with its descriptive title and the page number, in the main Contents.