Apress Expert Oracle9i Database Administration Apr 2003 ISBN 1590590228

  Expert Oracle9i Database Administration

  ISBN:1590590228

  by Sam R. Alapati Apress

  © 2003

  This guide provides users with the foundation necessary to progress to the level of an expert

Oracle DBA. It also provides a primer on

Oracle9i SQL and PL/SQL, as well as an

introduction to UNIX.

  Table of Contents - Database Basics, Data Modeling, and UNIX/Linux

   - Creating an Oracle Database

  

- Managing Oracle Databases on Windows and Linux Systems

  

  Back Cover

This is the only real Oracle 9i Database Administration

book on the market! This 1,000 page book enables a beginner or intermediate level Oracle DBA of Oracle Developer/Manager to master the art of building and managing complex Oracle 9i databases. Expert Oracle9i Database Administration is thorough in covering all aspects of the 9i database and also includes a UNIX primer, as well as an introduction to SQL and PL/SQL. Sam R. Alapati covers the entire spectrum of the new Oracle 9i RDBMS software and

clearly explains how to use all of its powerful features.

Currently, there is no one book that combines the necessary UNIX administration, Windows NT

management, and SQL backgrounds and the necessary

database administration principles. Sam R. Alapati's book fills that gap well, by providing all the necessary

material in one comprehensive volume. Expert Oracle9i

Database Administration is designed as the most complete Oracle 9i database text available today. It takes several courses, as well as mastery of several Oracle manuals, to become a proficient DBA. A major

focus of this book is on the most important features of

the Oracle 9i database. Readers will be able to become

expert Oracle DBAs by using this book.

  

About the Author Sam R. Alapati is an experienced Oracle Database Administrator, who holds the Oracle OCP DBA certification and the Hewlett Packard UNIX System Administrator certification. He currently manages Oracle databases at the Boy Scouts of America

National Headquarters in Los Colinas, Texas. Alapati

has been dealing with databases for a long time,

including the Ingres RDBMS in the mid 1980s. He is

also well versed in the Microsoft SQL Server, Sybase,

and the IBM DB2 database management systems.

Expert Oracle9i Database Administration SAM R. ALAPATI

  Copyright © 2003 by Sam R. Alapati All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher.

  ISBN (pbk): 1-59059-022-8 Printed and bound in the United States of America 1098765432 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark.

  Technical Reviewer: Kee Heng Tiow

Editorial Directors: Dan Appleman, Gary Cornell, Simon Hayes, Martin

  Streicher, Karen Watterson, John Zukowski

  Assistant Publisher: Grace Wong Project Manager: Alexa Stuart Development Editor: Tracy Brown Collins Copy Editor: Nicole LeClerc Production Editor: Laura Cheu Compositor: Diana Van Winkle, Van Winkle Design Group

  Indexer: Julie Kawabata Artist and Cover Designer: Kurt Krames Production Manager: Kari Brooks Manufacturing Manager: Tom Debolski

  Distributed to the book trade in the United States by Springer-Verlag New York, Inc., 175 Fifth Avenue, New York, NY, 10010 and outside the United States by Springer-Verlag GmbH & Co. KG, Tiergartenstr. 17, 69112 Heidelberg, Germany.

  In the United States: phone 1-800-SPRINGER, email

  

  For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, email , or visit

  

  The information in this book is distributed on an "as is" basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work.

  To my mother, Swarna Kumari, And my father, Appa Rao, For all the love, affection, and sacrifice. To the memory of my sister, Usha Rani, Your words of praise still ring in my ears.

  To my wife, Valerie, For your selfless support and help.

  About the Author Sam R. Alapati is an experienced Oracle DBA who holds the Oracle

  OCP DBA certification and the Hewlett-Packard UNIX System Administrator certification. He currently manages Oracle databases at the Boy Scouts of America's national office in Los Colinas, Texas. Previously, Alapati worked for AMR Holdings (Sabre) and the Blanch Company in Dallas. Alapati was a senior principal consultant for Oracle Corporation in New York and worked at NBC and Lehman Brothers on behalf of Oracle.

  Alapati's other DBA experience, which includes Sybase and DB2 databases, consists of assignments with Lewco Securities and AT&T in New Jersey.

  About the Technical Reviewer

  Kee Heng Tiow is a consultant at Procase Consulting Inc., taking the

  role of technical project manager at workopolis.com, the biggest job site in Canada. Prior to joining Procase Consulting Inc., Kee Heng worked in different Oracle Corporation Canada departments, including Oracle Consulting and Oracle University. He was involved in various consulting projects for many clients using Oracle products, primarily the Oracle database, Oracle Designer/Developer/Discoverer, and PL/SQL. Currently, Kee Heng is an instructor for Oracle technology training courses at Learning Tree International. He graduated with a bachelor's degree (with honors) in computer science from the University of Toronto, Canada.

  Acknowledgments

  I have had the idea of writing a book such as this for a long time, and the book would have remained just thatan idea—but for two people: my father, Dr. Appa Rao, who encouraged me to go ahead with the plan and explained why it was a good idea, and my wife, Valerie, who not only supported the idea, but also backed it up with a lot of sacrifice over the last year. I'm grateful to both for helping make my idea a reality.

  This book has benefited from the suggestions of several good technical reviewers. Sheldon Barry reviewed the first half of the book and Martin Reid reviewed some of the early chapters. Thanks to both of you, Sheldon and Martin. The reviewer who spent the most time on this book, however, was Kee Heng Tiow. Kee, thank you for your painstaking

  You were on the mark all the time, and I'm grateful for your conscientious effort. Karen Watterson, editorial director at Apress, has been instrumental in bringing this book about, and I'm grateful for her suggestions and support throughout the writing process. Karen, thanks also for reviewing the entire book and for your enormous patience and the grace you have shown throughout. Several people at Apress have contributed significantly to the book. I've had the great fortune of having a most unique and talented team work on this book. Alexa Stuart, the book's project manager, showed tremendous organizational skill in shepherding the book through to publication. It's simply amazing how she kept up with the monumental task of keeping everything moving in an orderly fashion. The book has benefited tremendously from great developmental editing by Tracy Brown Collins. Tracy's graceful handling of many difficult issues made the developmental review process a lot of fun. The magical touch of "copy editor extraordinaire" Nicole LeClerc made the book far better than it was in its original form. I'm simply astonished at how Nicole could time and again improve a highly technical sentence or paragraph without changing its meaning. Alexa, Tracy, and Nicole, I'm grateful for the extraordinary work and care you devoted to my book. My thanks to Apress's marketing director, Simon Hayes, who helped with several issues dealing with the publication of this book. Laura Cheu, the book's production editor, displayed tremendous skill in dealing with the minutiae while keeping the production process moving along. Production manager Kari Brooks took over as production editor toward the very end, and thanks to you, Kari, for seeing the project through. Diana Van Winkle of the Van Winkle Design Group has been a most skillful and fast compositor. Although I didn't deal with them directly, Grace Wong, Apress's assistant publisher, and Gary Cornell, Apress's publisher, helped the project at critical times with answers to important questions about the publication process. Apress's manufacturing manager, Tom Debolski, helped tremendously several times by providing fast and accurate answers to difficult questions. Thanks to all of you for your help.

  Several people have indirectly played a role in the publication of this book because of the role they have played in my life. Thanks to Brother Roberts of All Saints High School for lending all those books to me. I'm grateful to Professor Janardhana Reddy for helping me come to the United States when it wasn't easy to do so. Thanks to Madan Mohan Rao for helping me when I first came to the United States and for years after that, in so many ways. I thank Eddie Colon of New Brunswick, New Jersey, from the bottom of my heart for helping me when I really needed it. I wouldn't have been an Oracle DBA but for Jayesh Patel's help—thank you, Jayesh, for all you've done for me. I wish to thank Yuri for helping me learn the UNIX operating system and unravel the mysteries of databases. My thanks to Anil Sinha and J. Ram for their help while I worked with them. I owe a special debt of gratitude to my good friend Rajanna (Rajeshwara Rao) for explaining why ideas are so important. Yes, Bishop Berkeley did have a point. Several colleagues at the Boy Scouts of America were helpful during the course of writing this book. My colleague Mark Potts has helped me in several ways, including letting me use his PC when I was having problems with mine. Thanks, Mark, for all the help at work and outside. My thanks also to Stan Galbraith, who somehow managed to provide space on the server for the Oracle9i test databases. Thanks to Lance Parkes, who helped with some questions I had during the installation process. I'm also thankful to Rob Page for all the kindness and help at work. I wish to thank my friend Don Rios for helping me with answers to several difficult Oracle programming questions. I'm appreciative of Dan Nelson's encouragement and support for my endeavors. I'm thankful to Linda Almanza for her consistent support and help in various matters at work. I'm extremely grateful for having two remarkable people, David Jeffress and Dave Campbell, as my managers at the Boy Scouts of America. David's wide technical knowledge coupled with his exquisite sense of humor helps us keep our perspective and stay on top of things. My thanks to Dave, whose compassion for people coupled with his technical savvy is a source of inspiration for our group. Information Systems Division Director Nathan O. Langston encourages us to strive for higher goals and shows the way by leading from the front. By focusing relentlessly on efficient customer service, Nate helps us understand the true mission of an information technology professional. I would like to thank my mother and father for all they have done for their children. No parents have been more loving or more giving than you, and I'm grateful for everything. I'm grateful for the kindness and affection shown throughout my life by my two brothers, Hari and Bujji. I'm also appreciative of the affection shown by my sisters-in-law, Aruna and Vanaja. I'm lucky to have wonderful nieces like Aparna and Neelima and loving nephews like Ashwini and Teja. Special thanks to Shannon, my "number one" son, for all the love and affection. Thanks also to Keith, Shawn, and Dale for their love and support. I know you can't read this yet, but a whole lot of thanks to you, our magical twins, Nina and Nicholas, for all the fun, love, and cheer. I promise to make up for all the time I spent writing this book! Once again, thanks to my wife, Valerie, for all the support, encouragement, and sacrifice, which made this book possible.

Introduction

  GRATIANO ...As who should say 'I am Sir Oracle, And when I ope my lips, let no dog bark!'

  —The Merchant of Venice, act 1, scene 1 Oracle Corporation used to print the preceding quotation from Shakespeare at the beginning of one of its chapters in the Oracle database administrator (DBA) manual (the early versions). I always thought the quote was interesting. If you proceed a little further in the play, you'll find this quotation:

  BASSANIO Gratiano speaks an infinite deal of nothing, more than any man in all Venice. His reasons are as two grains of wheat hid in two bushels of chaff: you shall seek all day ere you find them ...

  —The Merchant of Venice, act 1, scene 1 Bassanio counters that, in truth, Gratiano speaks too much: From two bushels of chaff, two grains of wheat may be recovered. And that's the raison d'être for this book: to separate the wheat from the chaff. This second part of the quotation is more apt when you consider the difficulty of extracting the right database management procedures from the tons of material available on the Oracle9i Release 2 database. Oracle Corporation publishes copious material to help you manage its increasingly complex databases. Oracle Corporation also conducts several inperson and Web-based classes to explain the vast amount of subject matter that you need to understand to effectively work with the Oracle database today. Yet users will have a good deal of difficulty finding the essential material that they need to perform their jobs if they rely exclusively on Oracle's voluminous (albeit well-written) material in the form of the aforementioned manuals, class notes, videos, and so on.

How to Become an Oracle DBA Currently, you have several ways to become a proficient Oracle DBA

  First, you can take the whole series of Oracle classes, each of which lasts between 3 and 5 working days. You have to take all of these classes just to be able to perform the basic DBA duties. In addition, you need to peruse the Oracle manuals—there's an entire library of books that Oracle gives away freely on CD and on its Web site. Lastly, you may also wish to purchase books published by private publishers that impart various pieces of the knowledge it takes to become an accomplished Oracle DBA. Oh, and don't forget, you'll also need to acquire the necessary operating system knowledge somewhere. Because most of the large databases using Oracle are based on the UNIX (or Linux) operating system, you'll need to have a reasonably good understanding of UNIX. You can gain this understanding either by attending a class or two from the leading UNIX system vendors such as Hewlett-Packard and Sun Microsystems or by reading manuals and/or books about UNIX published by independent companies.

  As many of the new entrants to the Oracle9i database field find out, the Oracle DBA world is exhilarating, but alas, it's also exhaustive in its reach and scope. It isn't uncommon for many DBAs to have an entire shelf full of books, all explaining various facets of the DBA profession—for example, modeling books, UNIX texts, DBA handbooks, backup and recovery guides, performance tuning manuals, and networking and troubleshooting books. The amazing thing is, even after you run through the whole gauntlet of courses and books, you aren't really assured of success in the sense of being fully prepared to handle complex, day-to- day database administration chores. There are many, many people who have taken all the requisite classes to become an Oracle DBA who won't or can't be competent Oracle DBAs based solely on their training. The reason? Refer back to that quotation from Shakespeare at the beginning of this introduction: You need to separate the grain from the chaff, and all the coursework and manuals, while excellent in their content, can serve to muddy the waters further.

  The experienced Oracle DBA can well find his or her way through this baffling amount of material. But what about the newly initiated? That's where this book comes in. This text will not only educate you in the theory and principles involved in managing relational databases, but it will also help you in actually translating that theory into the useful, practical knowledge that will enable you to manage real-life databases with real- life data and real-life problems.

Why Read This Oracle9i Book?

  What sets this book apart from the others on the market is the constant adherence to the practical side of the DBA's work life. What does a new DBA need to know to begin work? How much and what SQL does the prospective candidate need to know? What UNIX, Windows Server, and Windows commands and utilities does the new DBA need to know? How does a DBA perform the basic UNIX system administration tasks? How does a DBA install the Oracle RDBMS software from scratch? This book provides the conceptual background and operational details for all the necessary topics a DBA needs to be familiar with. The following sections outline other reasons to choose this Oracle9i book.

Delivers a One-Volume Reference

  This book's specific purpose is to serve as a one-volume handbook for professional Oracle DBAs, a book with both the theory and practice of what DBAs need to know to learn their craft and practice it on a daily basis. As I mentioned before, most newcomers to the field are intimidated and bewildered by the sheer amount of material they're confronted with and the great number of administrative commands they need to have at their fingertips. Well, everything you need to know to run your databases efficiently is right here in this one book.

  How did I manage to achieve the difficult feat of providing comprehensive instruction in just one book? Well, although there's a lot of terrain to cover if you want to learn all the DBA material, you must learn to separate the critical from the trivial so you can identify what matters most and what you merely need to be aware of, at least in the beginning. I discuss how this book is organized and how you should read it in later sections of this introduction. I'm definitely not suggesting that this one book will supplant all of the Oracle material that you need to know. I strongly recommend that inquisitive readers make it a habit to refer to Oracle's documentation set for the 9i database, which is available on a CD bundled with most Oracle software. Optionally, you can obtain this documentation on the Web by getting a free membership to the Oracle Technology Network (OTN), which you can access through the Oracle Web site at .

   Reading the Oracle Manuals

  Whether you use this or some other DBA handbook, you still need to refer to the Oracle database manuals frequently to get the full details of complex database operations. I can't overemphasize the importance of mastering the fundamentals of the Oracle9i database that are presented in the "Oracle Concepts" manual. Mastering this volume is critical to understanding many advanced DBA procedures.

  The Oracle manuals are invaluable if you need an extreme amount of detail. For example, the chapters on backup and recovery are good starting points in your attempt to master the Oracle procedures in those areas. Oracle recommends a total of no less than five manuals to cover their backup and recovery material. Once you finish the two relevant chapters and

   in this book, you'll find going

  through those five manuals a pretty easy task, because you'll already have a good understanding of all the important concepts. This book provides a foundation on which you can build using the Oracle manuals and other online help available from Oracle.

  In addition to the online manuals, Oracle provides an excellent set of tutorials that contain step-by-step instructions on how to perform many useful Oracle9i data-base tasks. You can access these tutorials, the "Oracle9i by Example Series," by going to

  

  Emphasizes New Methods and When to Use Them

  One of the fundamental difficulties for a neophyte in this field is the ambiguity involved in adopting the right strategy for managing databases.

  Although the essential tasks of database management are pretty similar in Oracle9i Release 2 compared to earlier versions of the software, the database contains several innovative techniques that make a number of routine tasks easier to perform. Oracle Corporation, however, has shied away from firmly recommending the adoption of the new methods and techniques to manage databases. The reason for this is twofold. First, Oracle rarely discards current techniques abruptly between versions; features advertised as destined for obsolescence are made obsolete only after the passage of many years. Thus, old and new ways of performing similar tasks coexist in the same version. Second, Oracle isn't very effective in clearly communicating its guidelines regarding the choice between contending methods. Thus, you as a DBA have to exercise caution when you select the appropriate methods to use, when more than one method exists for performing a task.

  In this book, I clearly emphasize the newer features of Oracle that have been refined in the last 3 to 4 years and encourage you to move away from traditional techniques when the new innovations are clearly superior. I help you in formulating a solid strategy regarding the proper course to take when multiple choices are offered.

Covers UNIX, SQL, PL/SQL, and Data Modeling

  Some people who are motivated to become Oracle DBAs are stymied in their initial efforts to do so by their lack of training in UNIX and SQL. Also, sometimes DBAs are confused by the whole set of data modeling and the "logical DBA" techniques. This book is unique in that it covers all the essential UNIX, SQL, PL/SQL, and data modeling that a DBA ought to know to perform his or her job well. As a DBA, you need to be able to use a number of UNIX tools and utilities to administer an Oracle database. Unfortunately, up until now, many books haven't included coverage of these vital tools. This book remedies this neglect by carefully covering tools such as telnet, ftp, and the crontab. Many developers and managers want to have a better understanding of the UNIX system, including the use of the vi file editor, file manipulation, and basic shell script writing techniques. This book shows you how to write solid shell scripts to perform various tasks. Of course, you can take a specialized class or study a separate book in each of the previous areas, but that's exactly what you're trying to avoid by using this book.

  In addition to learning all the UNIX you need to start working with the UNIX operating system right away, you can get a good working knowledge of SQL and PL/SQL from a DBA's perspective in this book. Of course, I strongly recommend further study of both UNIX and SQL for strengthening your skills as an Oracle DBA as you progress in your career.

  

Note understand that some of you may not really need the UNIX

  background or the introduction to SQL and PL/SQL (presented in the Appendix). If this is the case, please skip those chapters and get to the main database management chapters.

Offers Hands-on Administrative Experience

  Although a number of books have been published in the last decade on the subject of database administration, there has been a surprising lack of the blending of the concepts of Oracle with the techniques needed to perform several administrative tasks. A glaring example is the area of backup and recovery, where it's difficult to find discussions of the conceptual underpinnings of the backup and recovery process. Consequently, many DBAs end up learning backup and recovery techniques without having a solid grasp of the underlying principles of backup and recovery. As you can imagine, this dichotomy of theory and practice proves expensive in the middle of a recovery operation, where fuzziness on the concepts could lead to simple mistakes. The success of a DBA is directly related to the amount of hands-on experience he or she has in conjunction with an understanding of the concepts behind the operation of the database. Readers can practice all the commands from this book on a UNIX-based or a Windows-based Oracle9i database. Oracle9i Release 2 is loaded with features that make it the cutting-edge database in the relational database market. This book contained in the Oracle9i version. Although it's a lot of fun for an experienced DBA to have the opportunity to use all the wonderful features of the new database, beginning- and intermediate-level DBAs will have more fun, because they're embarking on the great endeavor that is the mastery of Oracle database management.

Focuses on the Oracle9i Release 2 Database

  This book was written entirely with the Oracle9i Release 2 database in mind—it doesn't contain just an addition of Oracle9i features to a book written for earlier versions. The book was written for the express purpose of taking advantage of Oracle9i's new powerful features for database administration and making them an integral part of a working DBA's toolkit. Unlike the current practice in the market, this book takes a clear stand when alternative methods exist to perform the same task and advocates the use of the newer Oracle9i methods consistently. I consider it superfluous to continue to teach the old methods along with the more sophisticated new techniques. If you're a DBA who is currently managing Oracle 8.x databases, or if you've never managed databases and intend to master the management of the new Oracle9i databases, you can do so with the help of this book.

Who Should Read This Book?

  This book is primarily intended for beginning- and intermediate-level Oracle9i DBAs. Prior experience with Oracle databases isn't assumed. Oracle8i DBAs can also benefit from this book, but as I mentioned earlier in this introduction, this book isn't an Oracle8i book with a smattering of Oracle9i features. Consequently, you may not find any worthwhile discussion of some 8i features that have been supplanted by better methods in the Oracle9i version. More precisely, the audience for this book will fall into the following categories:

  Beginning Oracle DBAs who are just starting out Oracle developers and UNIX/NT administrators who intend to learn Oracle DBA skills Managers who intend to get a hands-on feel for database management Anybody who wants to learn how to become a proficient Oracle DBA on his or her own

A Note About UNIX

  I personally like the UNIX operating system and use it at work. I'm familiar with the Windows platform and I happen to think it's a good operating system for small enterprises. But my favorite operating system remains UNIX, which stands out for its reliability, scalability, and speed. For medium and large organizations, the UNIX system offers wonderful features and ease of use. As a result, you'll find this book heavily oriented toward the use of Oracle on UNIX systems. If you happen to admire the Linux system, there isn't a new learning curve involved, as most of the operating system commands will work the same way in the UNIX and Linux systems. For those of you who need to find out how to use the Oracle9i database on a Windows platform, here's some interesting news for you: The commands and methods work exactly the same way in both the UNIX and Windows environments. There are minor changes in syntax in a very few cases.

  differences and covers basic Windows system administration as it pertains to Oracle9i database management.

How This Book Is Organized

  I have organized the contents of this book with the new DBA in mind. My goal is to provide you with a decent background in data modeling, SQL, and UNIX, while providing a thorough course in the essentials of Oracle9i database management skills. I know it's unusual to provide UNIX and SQL background in an Oracle DBA book. But the inclusion is in line with the goal I set when I decided to write this book: There ought to be a single book or manual that has all the necessary background for a reader to start working as an Oracle9i DBA.

  I strove to write the chapters to mirror real-life practical training. For example, it's advisable to understand basic database modeling and UNIX systems to manage Oracle databases. I therefore start with a discussion of database modeling and UNIX first (inof the book). You'll also first install the Oracle database software before you create an actual database ( . After you install the software, you can create databases, create users, and establish connectivity . As you can see, the chapters follow a logical progression similar to the reallife precedence of the tasks covered by them.

  I advise beginning DBAs to start at the beginning of the book and keep going. A more experienced user, on the other hand, can pick the topics in any sequence he or she desires. The scripts that accompany the book will keep a DBA in good stead during routine operation of the database and during crisis situations when information needs to be communicated through paging. There's no reason why you can't keep the pager from going off during those early morning hours if you adopt the preventive maintenance scripts included in this book.

  I've tried throughout the book to provide detailed, step-by-step, tested examples to illustrate the use of several data connects and features of Oracle9i. I strongly recommend that you set up an Oracle9i database server on your PC and practice these how-to sections. Following along with these examples will teach you the relevant commands and help you build great confidence in your skill level. Plus, the examples are a whole book.

  

Part One: Database Basics, Data Modeling, and UNIX/Linux

provides a background on the Oracle DBA profession and

  offers an introduction to data modeling and the UNIX operating system. I discuss the role of the Oracle DBA in the organization, and I offer some advice on improving your skill set as a DBA. I then discuss the basics of relational databases. The data modeling chapter (

  introduction to both logical and physical database design, including the use of entity-relationship diagrams. You'll learn about the Oracle Flexible Architecture (OFA) with regard to disk layout. You'll then learn the basic UNIX commands and how to use the vi text processing commands. You'll also explore the essential UNIX system administration tasks for Oracle DBAs. This part finishes with coverage on disks and storage systems, including the popular RAID systems.

Part Two: The Oracle RDBMS

  covers installing the Oracle server and Oracle SQL and PL/SQL. You'll first learn how to install the new Oracle9i server software.

  You'll also learn about the processes and memory that constitute the Oracle server architecture. You'll then move on to cover the conceptual foundations of the Oracle database. The chapter covering schema management in Oracle9i (

   ) provides you

  with a good understanding of how Oracle databases conduct transaction processing.

Part Three: Database Creation, Connectivity, and User Management

  covers the creation of actual databases, connectivity issues,

  and user management. You'll go through a step-by-step discussion of database creation and then learn how to configure Oracle networking.

  Part Four: Data Loading, Backup, and Recovery

deals with loading data and performing backups and recovery.

  You'll learn how to use SQL*Loader and the export and import utilities to perform data loading and data exports from the Oracle9i database. The important topic of database backup comes next, and the final chapter in this section details the recovery of databases.

Part Five: Managing the Operational Oracle Database

  

  logs, and how to perform undo management.

Chapter 17 describes how to use Oracle Enterprise Manager (OEM). Part Six: Performance Tuning and Troubleshooting the Production Database Part Six covers Oracle9i performance tuning and troubleshooting issues. You'll first learn the basics of writing efficient SQL queries and then you'll

  see how to optimize the use of Oracle's memory and the operating system itself. The importance of mastering the Oracle data dictionary is discussed next, followed by an explanation of using the excellent packages supplied by Oracle. The final chapter of this section covers the management of Oracle9i databases on Windows and Linux systems.

Salud!

  I truly enjoy the Oracle database for its amazing range of capabilities and the intricate challenges it throws my way as I explore its wide-ranging capabilities. I hope you derive as much satisfaction and fulfillment from the Oracle database as I do. I leave you with the following section that I paraphrased from the introduction to the famous textbook by Paul A.

  

  Samuelson, the great economist and Nobel Laureate: [

  

I envy you, the beginning Oracle DBA, as you set out to explore the

exciting world of Oracle9i database management for the first time. This is a thrill that, alas, you can experience only once in a lifetime. So, as you embark, I wish you bon voyage!

  

  

  Samuelson, Paul A. and William D. Nordhaus. Economics, Seventeenth Edition. New York: McGraw-Hill, 1998.

  

Part One: Database Basics, Data Modeling, and

UNIX/Linux

  Chapter List

   Essential Unix (and Linux) for the Oracle DBA

Chapter 1: The Oracle DBA's World This chapter discusses the nature and role of the Oracle database

  administrator (DBA) in most organizations, as well as the training that Oracle DBAs typically need to receive to be successful. There are many types of Oracle databases, and there are many types of Oracle DBAs. In this chapter, you'll look at the daily routine of a typical DBA, which will give you an idea of what to expect if you're new to the field. This chapter also covers ways you can improve your skill level as an Oracle DBA and prepare for the optimal performance of the databases under your stewardship. Toward the end of the chapter, you'll find a list of resources and organizations that will help you in your quest to become a top-notch DBA.

The Oracle DBA's Role

  The main responsibility of a DBA is to make corporate data available to the end users and the decision makers of an organization. All other DBA tasks are subordinate and in support of that single issue, and almost everything DBAs do on a day-to-day basis is aimed toward meeting that single target. Without access to data, many companies and organizations would simply cease to function.

  Note Just think of the chaos that would ensue if a company such as

  Amazon.com no longer had access to their customer database, even for a short time. The entire company could cease to function. At a minimum, they would lose perhaps thousands of online orders. Business data should be viewed as a company asset, and as such, it has a monetary value. As a DBA, you have the keys to the safe, and your job is to protect the data.

  That's not to say that availability of data is the only thing DBAs have to worry about. DBAs are also responsible for other areas, such as

  

Security: Ensuring that the data and access to the data are

  secure

  Backup: Ensuring that the database can be restored in the event

  of either human or systems failure

  Performance: Ensuring that the database and its subsystems are

  optimized for performance

  Design: Ensuring that the design of the database meets the

  needs of the organization

  

Implementation: Ensuring proper implementation of new

  database systems and applications In addition to their standard roles, many DBAs are responsible for the accuracy of the actual data. However, in some organizations, this putting the onus on them to ensure that the data being input to the system is correct. Job responsibilities for Oracle DBAs do vary across organizations. In a small organization, a DBA could be managing the entire information technology (IT) infrastructure, including the databases, whereas in a large organization, a DBA could be one of a number of DBAs, each charged with managing a particular area of the system. However, there is a fundamental set of tasks that a DBA is expected to perform, whatever the organization type or size. The three most vital DBA tasks are as follows:

  Ensuring frequent backups are made (so data isn't lost) Securing the database from unauthorized use Minimizing downtime

  These tasks are definitely not the only ones that matter. I've emphasized these particular tasks only because a failure in any of these areas could prevent a firm or organization from carrying out its mission. The following sections discuss what you could consider the bare minimum level of performance expected of a DBA. Although this list seems long and daunting, it's really not that difficult in practice if you follow certain guidelines. Proper planning and testing as well as automating most of the routine tasks keep the drudgery to a minimum. All you're left with to do on a daily basis, then, are the really enjoyable things such as performance tuning or whatever else may appeal to you. You can put the tasks you'll perform as an Oracle DBA in the following three roles or categories:

  Security role System management role Database design role

  I discuss each of these broad roles in more detail in the following sections.

The DBA's Security Role

  As a DBA, you'll be involved in many different areas of system security, mainly focusing on the database and its data but not restricted to this single area. Several potential security loopholes are possible when you implement a new Oracle system out of the box, and you need to know how to plug these security loopholes thoroughly before the databases go live in a production environment. In

  management, you'll find a fuller discussion of standard Oracle security guidelines, as well as other Oracle security related issues. Oracle regularly issues Oracle Security Alerts for its databases, and you need to keep up with these as part of your job.

Protecting the Database

  For an Oracle DBA, no job requirement is more fundamental and critical than the protection of the database itself. The Oracle DBA is definitely the person the information departments entrust with safeguarding the organization's data. This involves timely and effective backups of the production data to keep it from being lost due to hardware problems, sabotage, or a natural disaster. The other aspect of the DBA's job as the keeper of the data is the security of the database itself, which involves preventing unauthorized use and access of the database. The DBA has several means to ensure the database's security, and based on the company's security guidelines, he or she needs to come up with and/or maintain the database security policy. A more complex issue is the authorization of users' actions within the database itself, after access has already been granted. I address this topic in depth in a later chapter.

  Note Some organizations don't have a general security policy in

  place. This is particularly true of smaller companies. In that case, it's usually up to the DBA to come up with the security policy and then enforce it within the database.

  Monitoring the System

  Once a database is actually in production, the DBA is expected to monitoring the system include the following: Monitoring space in the database to ensure it is sufficient for the system Checking that batch jobs are finishing as expected Monitoring log files for evidence of any errors or any unusual performance issues.

Creating and Managing Users

  Every database has users, and it's the DBA's job to create them based on requests from the appropriate people. A DBA is expected to help the users with the use of the database and ensure the database's security by using proper authorization schemes, roles, and privileges. Of course, when users are locked out of the database because of password expiration and related issues, the DBA needs to take care of them. Ultimately, the DBA's job is a service job, and by providing efficient service to the database servers, a DBA indirectly provides service to the customers of his or her applications.

The DBA's System Management Role

  Another of the DBA's major roles is the day-to-day management of the database and its subsystems. This daily monitoring is not really limited to the database itself. As a DBA, you need to be aware of how the system as a whole is performing. You need to monitor the performance of the servers that host the database and the network that enables connections to the database. The following sections describe the various facets of the system management part of the Oracle DBA's job.

Troubleshooting

  One of the Oracle DBA's main job responsibilities is troubleshooting the database to fix problems. " " is a catchall term, and it could consist of several parts of the job that I discuss in the following sections. Two important aspects of troubleshooting are knowing how to get the right kind of help from Oracle support personnel and how to use other Oracle resources to help you fix problems quickly.

Ensuring Performance Tuning

  Performance tuning is an omnipresent issue. It's a part of the design stage, the implementation stage, the testing stage, and the production stage. In fact, performance tuning is an ongoing task that constantly requires the attention of a good Oracle DBA. Depending on the organizational setup, the DBA may need to perform either database tuning or application tuning, or sometimes both. Generally, the DBA performs database tuning him- or herself and assists in the testing and implementation of the application tuning performed by the application developers. Performance requirements change for a living database constantly, and the DBA needs to continuously monitor the performance by applying the right indicators. For example, after my firm migrated from Oracle8i to the new Oracle9i, I found that several large batch programs weren't completing within the allotted time. After much frustration, I realized that this was because some of the code was using cost-based optimizer "hints" that were no longer optimal under the new version. A quick revision of those "hints" improved the performance of the programs dramatically. The moral of the story: Make sure you test all the code under the new version before you switch over to it.

Minimizing Downtime

  Providing uninterrupted service by eliminating (or at least minimizing) downtime is an important criterion by which you can judge a DBA's performance. Of course, if the downtime is the result of a faulty disk, the company's service level agreements (SLAs), if any, will determine how fast the disk is replaced. DBAs may or may not have control over the maximum time for service provided in the SLAs. For their part, however, DBAs are expected to be proactive and prevent avoidable downtimes (for example, due to a process running out of space).

  Only the DBA can estimate the operating system, disk, and memory requirements for a new project. The DBA is also responsible for coming up with growth estimates for the databases he or she is managing and the consequent increase in resource requirements. Although some of the decisions regarding physical equipment, such as the number of CPUs per machine and the type of UNIX server, may be made independently by system administrators and managers, the DBA can help during the process by providing good estimates of the database requirements.

  In addition to estimating initial requirements, the DBA is responsible for planning for future growth and potential changes in the applications. This is known as capacity planning, and the DBA's estimates will be the basis for funding requests by department managers.

Developing Backup and Recovery Strategies

  This is arguably the most important part of a DBA's job. The DBA needs to back up databases on a regular basis in order for those databases to survive a disaster, and the DBA is expected to test and implement a sound backup strategy. Further, the DBA is in charge of periodic recovery testing to ensure that the backup strategy will actually work. Adequate backups can prevent the catastrophic loss of an organization's vital business data. The Oracle DBA needs to come up with a proper backup strategy and test the backups for corruption. The DBA also needs to have recovery plans in place, and the best way to do this is to simulate several types of data loss. Proper testing of backup and recovery plans is a sorely neglected topic in many companies, in spite of its critical importance for the company. Loss of business data could not only lead to immediate monetary damage in the form of lost profits, but also cost customer goodwill in the long run. Unplanned database downtime due to a myriad of reasons reflects poorly on the firm's technical prowess and the competency of the management. A good example of this is the repeated stoppage of the successful online auction firm eBay during 1998 and 1999, which lost the company millions of dollars in revenue and cost them considerable embarrassment.