text:
# Expert Oracle Database 10g Administration

This is a unique, one-volume guide to the administration andmanagement of the Oracle database. Fully revised and updated from itsbest-selling 9i predecessor, this edition covers all new features,with fully field-tested examples&emdash;not just "showcase" examples.This book covers the new 10g management and performance tools andprovides essential primers on Unix, Linux and Windows NTadministration and on core SQL and PL/SQL programming techniques. Andit provides everything the new and aspring Oracle DBA needs to buildand admisiter complex Oracle 10g databases.
Categories: Computers\\Databases

ISBN 10: 0203209354
ISBN 13: 9780203289228
Series: Expert's Voice
File: PDF, 8.64 MB

You can write a book review and share your experiences. Other readers will always be interested in your opinion of the books you've read. Whether you've loved the book or not, if you give your honest and detailed thoughts then people will find new books that are right for them.
1

File: CHM, 9.77 MB
2

### Comprehensive Intellectual Capital Management: Step-by-Step

File: PDF, 3.01 MB
4517FM.qxd

8/19/05

10:24 AM

Page i

Expert Oracle Database

Sam R. Alapati

4517FM.qxd

8/19/05

10:24 AM

Page ii

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-451-7
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
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: John Watson
Development Editors: Robert Denn and Matthew Moodie
Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Tony Davis,
Jason Gilmore, Jonathan Hassell, Chris Mills, Dominic Shakeshaft, and Jim Sumser
Associate Publisher: Grace Wong
Project Manager: Beckie Stones and Tracy Brown Collins
Copy Edit Manager: Nicole LeClerc
Copy Editors: Andy Carroll, Marilyn Smith, and Susannah Pfalzer
Assistant Production Director: Kari Brooks-Copony
Production Editor: Ellie Fountain
Compositor: Dina Quan
Proofreaders: Lori Bring and Liz Welch
Indexer: John Collin
Interior Designer: Van Winkle Design Group
Cover Designer: Kurt Krames
Manufacturing Director: Tom Debolski
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or
visit http://www.springeronline.com.
CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com.
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.
The source code for this book is available to readers at http://www.apress.com in the Source Code section.

4517FM.qxd

8/19/05

10:24 AM

Page iii

To my grandfather, Alapati Pullayya, and grandmother, Bollu Seethamma,
for their love, affection, strength, and wisdom

4517FM.qxd

8/19/05

10:24 AM

Page iv

4517FM.qxd

8/19/05

10:24 AM

Page v

Contents

About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiii
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxiv
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxvii

PART 1
■CHAPTER 1

■■■

Background, Data Modeling, and
UNIX/Linux

The Oracle DBA’s World

........................................3

The Oracle DBA’s Role . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Different DBA Job Classifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Types of Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Background and Training . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
The Daily Routine of a Typical Oracle DBA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Some General Advice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

■CHAPTER 2

Relational Database Modeling and Database Design

. . . . . . . 19

Relational Databases: A Brief Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
The Relational Database Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Relational Database Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Reverse-Engineering a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Object-Relational and Object Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

■CHAPTER 3

Essential UNIX (and Linux) for the Oracle DBA

. . . . . . . . . . . . . . 43

Overview of UNIX and Linux Operating Systems . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Understanding the UNIX Shell(s) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Overview of Basic UNIX Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Navigating Files and Directories in UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Writing and Editing Files with the vi Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Extracting and Sorting Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Shell Scripting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Dealing with UNIX Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
UNIX System Administration and the Oracle DBA . . . . . . . . . . . . . . . . . . . . . . . . . 75

v

4517FM.qxd

vi

8/19/05

10:24 AM

Page vi

■CONTENTS

Disks and Storage in UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
RAID Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
New Storage Technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92

PART 2 ■ ■ ■ Oracle Database 10g Architecture,

Schema, and Transaction Management
■CHAPTER 4

Introduction to the Oracle Database 10g Architecture

. . . . . 99

Oracle Database Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Oracle Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Oracle Memory Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
A Simple Oracle Database Transaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Data Consistency and Data Concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Backup and Recovery Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
The Oracle Data Dictionary and the Dynamic Performance Views . . . . . . . . . . 135
Talking to the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Oracle Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Scheduling and Resource-Management Tools . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Automatic Database Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Common Manageability Infrastructure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Efficient Managing and Monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

■CHAPTER 5

Schema Management

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

Types of SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
Oracle Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
Creating and Managing Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Oracle Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
Special Oracle Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Oracle Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Managing Database Integrity Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
Using Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
Using Materialized Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
Using the SQL Access Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
Using Synonyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Using Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Using Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Viewing Object Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224

4517FM.qxd

8/19/05

10:24 AM

Page vii

■CONTENTS

■CHAPTER 6

Oracle Transaction Management

. . . . . . . . . . . . . . . . . . . . . . . . . . . . 225

Oracle Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Transaction Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
Transaction Concurrency Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Isolation Levels and the ISO Transaction Standard . . . . . . . . . . . . . . . . . . . . . . . 231
Oracle’s Isolation Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
Implementing Oracle’s Concurrency Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
Using Undo Data to Provide Read Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Flashback Error Correction Using Undo Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
Flashback Using the DBMS_FLASHBACK Package . . . . . . . . . . . . . . . . . . . . . . . 256
Flashback Transaction Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
Discrete Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Autonomous Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
Resumable Space Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Managing Long Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

PART 3 ■ ■ ■ Installing Oracle Database 10g, and

■CHAPTER 7

Installing the Oracle Database 10g RDBMS

. . . . . . . . . . . . . . . . 279

Installing Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Following the Optimal Flexible Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Performing Preinstallation Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
A Final Checklist for the Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
After the Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
Uninstalling Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312

■CHAPTER 8

. . . . . . . . . . . . . . . . . . . . . . . . . . 315

Routes to Oracle Database 10g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Upgrade Methods and Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Upgrading with the DBUA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
Upgrading Manually . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
After the Upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328

■CHAPTER 9

Creating an Oracle Database

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

Getting Ready to Create the Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
Creating the Parameter File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Creating a New Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
Using a Server Parameter File (SPFILE) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374
Starting Up and Shutting Down the Database from SQL*Plus . . . . . . . . . . . . . . 378

vii

4517FM.qxd

viii

8/19/05

10:24 AM

Page viii

■CONTENTS

PART 4

■■■

■CHAPTER 10

Connectivity and User Management

Connectivity and Networking

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391

Oracle Networking and Database Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . 391
Networking Concepts: How Oracle Networking Works . . . . . . . . . . . . . . . . . . . . 393
Establishing Oracle Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
The Oracle Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
The Instant Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
The Listener and Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
Naming and Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Oracle and Java Database Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416

■CHAPTER 11

User Management and Database Security . . . . . . . . . . . . . . . . . . 421
Managing Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
The Database Resource Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
Controlling Access to Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
Auditing Database Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Authenticating Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Enterprise User Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
Database Security Dos and Don’ts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482

■CHAPTER 12

Using SQL*Plus and iSQL*Plus

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491

Starting a SQL*Plus Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Exiting SQL*Plus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
SQL*Plus and SQL Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
Key SQL*Plus “Working” Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
Commands for Formatting SQL*Plus Output and Creating Reports . . . . . . . . . . 512
Creating Command Files in SQL*Plus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
Editing Within SQL*Plus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
Key SQL*Plus Database Administration Commands . . . . . . . . . . . . . . . . . . . . . . 524
Using SQL to Generate SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
iSQL*Plus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 526

■CHAPTER 13

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539

An Overview of Extraction, Transformation, and Loading . . . . . . . . . . . . . . . . . . 539
Using the SQL*Loader Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Using External Tables to Load Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559

4517FM.qxd

8/19/05

10:24 AM

Page ix

■CONTENTS

Transforming Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
Using Oracle Streams for Replication and Information Sharing . . . . . . . . . . . . . 583

■CHAPTER 14

Using Data Pump Export and Import

. . . . . . . . . . . . . . . . . . . . . . . . 589

Introduction to the Data Pump Technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
Performing Data Pump Exports and Imports . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
Monitoring a Data Pump Job . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
Using the Data Pump API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622
Transportable Tablespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623

■CHAPTER 15

Backing Up Databases

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631

Backing Up Oracle Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631
Examining the Flash Recovery Area . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
The Recovery Manager (RMAN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 648
Backing Up the Control File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
The Oracle Backup Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
User-Managed Backups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 686
Database Corruption Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692
Enhanced Data Protection for Disaster Recovery . . . . . . . . . . . . . . . . . . . . . . . . 695

■CHAPTER 16

Database Recovery

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699

Types of Database Failures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
The Oracle Recovery Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
Performing Recovery with RMAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
Typical Media Recovery Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
Cloning a Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726
Techniques for Granular Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 730
Flashback Techniques and Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736
Using Restore Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750
Repairing Data Corruption and Trial Recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . 752
Troubleshooting Recovery Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 754

PART 6

■■■

■CHAPTER 17

Managing the Operational Oracle
Database

Automatic Management and Online Capabilities

. . . . . . . . . . 759

The Automatic Database Diagnostic Monitor (ADDM) . . . . . . . . . . . . . . . . . . . . . 759
Automatic Shared Memory Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 774
Automatic Optimizer Statistics Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 780

ix

4517FM.qxd

x

8/19/05

10:24 AM

Page x

■CONTENTS

Automatic Storage Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783
Automatic Space Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 799
Online Capabilities of Oracle Database 10g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811

■CHAPTER 18

Managing and Monitoring the Operational Database

. . . . . . 823

Types of Oracle Performance Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 823
Server-Generated Alerts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 828
The Automatic Workload Repository (AWR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 834
Active Session History (ASH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 845
The Management Advisory Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 849
Working with the Undo and the MTTR Advisors . . . . . . . . . . . . . . . . . . . . . . . . . . 854
Managing the Online Redo Logs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855
Managing Database Links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858
Copying Files with the Database Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 860
Mapping Oracle Files to Physical Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 862
Using the Oracle Scheduler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 863

■CHAPTER 19

Using Oracle Enterprise Manager

. . . . . . . . . . . . . . . . . . . . . . . . . . . 883

Oracle Enterprise Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 883
OEM Architecture and Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886
OEM Database Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 886
OEM Grid Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 899

■CHAPTER 20

Managing Oracle Databases on Windows and
Linux Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 909
Oracle Database 10g and Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 909
Essential Differences Between Managing Oracle on Windows and UNIX . . . . . 912
Installing Oracle Database 10g on a Windows System . . . . . . . . . . . . . . . . . . . . 919
The Windows Registry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 920
Managing Oracle on Windows Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921
Uninstalling Oracle on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 930
Oracle and Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 931

PART 7

■■■

■CHAPTER 21

Performance Tuning

Improving Database Performance:
SQL Query Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 937
An Approach to Oracle Performance Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 937
Optimizing Oracle Query Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 939
Query Optimization and the Oracle Cost-Based Optimizer . . . . . . . . . . . . . . . . . 943

4517FM.qxd

8/19/05

10:24 AM

Page xi

■CONTENTS

Writing Efficient SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 957
How the DBA Can Help Improve SQL Processing . . . . . . . . . . . . . . . . . . . . . . . . 967
SQL Performance Tuning Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 974
Using the EXPLAIN PLAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 974
The SQL Tuning Advisor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 994
A Simple Approach to Tuning SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . 999

■CHAPTER 22

Performance Tuning: Tuning the Instance

. . . . . . . . . . . . . . . . . 1001

An Introduction to Instance Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1001
Automatic Performance Tuning vs. Dynamic Performance Views . . . . . . . . . . 1003
Tuning Oracle Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1004
Evaluating System Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1024
Measuring I/O Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1030
Measuring Instance Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1032
A Simple Approach to Instance Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1066

PART 8 ■ ■ ■ The Data Dictionary, Dynamic Views,

and the Oracle-Supplied Packages
■CHAPTER 23

The Oracle Data Dictionary and the
Dynamic Performance Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1083
The Oracle Data Dictionary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1083
Using the Static Data Dictionary Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1084
Using the Dynamic Performance Views . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1115

■CHAPTER 24

Using Oracle PL/SQL Packages

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1145

Overview of the Oracle-Supplied PL/SQL Packages . . . . . . . . . . . . . . . . . . . . . 1145
DBMS_FILE_TRANSFER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1146
DBMS_MONITOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1148
UTL_COMPRESS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1148
UTL_MAIL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1149
DBMS_TDB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1150
DBMS_JOB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1151
DBMS_APPLICATION_INFO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1153
DBMS_CRYPTO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1155
DBMS_SESSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1155
DBMS_SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1156
DBMS_OUTPUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1159
DBMS_REPAIR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1160
DBMS_OUTLN and DBMS_OUTLN_EDIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1162

xi

4517FM.qxd

xii

8/19/05

10:24 AM

Page xii

■CONTENTS

DBMS_SPACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1163
DBMS_SPACE_ADMIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1164
DBMS_PROFILER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1165
DBMS_ERRLOG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1167
UTL_FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1168
UTL_SMTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1172
DBMS_SHARED_POOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1173
DBMS_WM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1174
DBMS_RLMGR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1175
Oracle Packages in Earlier Chapters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1175

■APPENDIX A

Oracle Database 10g SQL and PL/SQL: A Brief Primer

. . . . 1183

The Oracle Database 10g Sample Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . 1183
Oracle Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1185
SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1186
Abstract Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1201
PL/SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1203
Using Cursors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1207
Procedures, Functions, and Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1209
Oracle XML DB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1210
Oracle and Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1214

■INDEX

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1217

4517FM.qxd

8/19/05

10:24 AM

Page xiii

■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. Sam can be reached at salapati@netbsa.org.

■JOHN WATSON was born, bred, and schooled in Oxford, England, and what he laughingly calls his
career has been in London, then Germany, and now he’s based in South Africa.
All John’s work has been in IT, starting with the PC revolution twenty years ago, but deep down
inside he’s still some sort of organic free-range hippy. John first came across Oracle with version 5,
but he couldn’t make it do anything, and it was only with version 7 that he really got to grips with it.
After seven years full time with Oracle Corporation, John now works for a small Oracle consulting
company and spends his time equally on teaching Oracle courses all over Africa and Europe; consulting; and research and development. But what he really likes is to be at home with his wife, cats,
dogs, and vegetable patch; they live on two acres outside Johannesburg.

xiii

4517FM.qxd

8/19/05

10:24 AM

Page xiv

Acknowledgments

M

xiv

y first debt in writing this book is to my father Dr. Alapati Appa Rao, who is responsible for my
love for education and books. This book is a direct outcome of the early scholarly interest nurtured
by him, as well as his support and encouragement for writing the Oracle 9i book, which is this
book’s predecessor.
John Watson, the Technical Reviewer for the book, did a superb job in not merely catching
technical errors, but also in prodding me to explain several concepts clearly and accurately. I’ve
gained immensely from John’s collaboration on this book.
I am indebted to the trailblazing Gary Cornell, Publisher of Apress, for taking the lead in publishing both the predecessor to this book as well as this one. Dominic Shakeshaft kindly helped sort
out various issues that came up during the writing of the book, and I appreciate his lending his considerable talents to this project. I am fortunate to have had the highly accomplished Tony Davis as
the Lead Editor for this book. Tony has provided masterly editorial support and pulled many a
chestnut out of the fire during the last year. Tony has the knack for synthesizing complex issues and
suggesting solutions with admirable efficiency and grace. Beckie Stones, Project Manager, cheerfully and very efficiently planned and implemented the project plan. Beckie had the unenvious task
of guiding this long book through several iterations of writing and editing. Thanks Beckie, for saving
the project from my tendency to write incessantly, and for letting the book see the light of day now,
rather than a year or so later! Thanks are also due to Tracy Brown Collins, who was the Project
Manager during an early stage.
Several people contributed to the editing of various sections of this book, and I thank them all
for their help in improving the book’s quality. Robert Denn, Development Editor, worked admirably
to make sure that the contents of all the chapters flowed together in a coherent fashion. Matthew
Moodie pitched in to help at a critical time by ably editing a few chapters. All three Copy Editors—
Andy Carroll, Marilyn Smith, and Susannah Pfalzer—did a marvelous job in improving the quality
of the book. While it’s not fair to single out one of these three for special mention, I feel obliged to
offer my special thanks to Andy, for working on the vast majority of the chapters with great diligence and acumen. Susannah worked extremely capably on several chapters as well, and I admire
her devotion to accuracy and quality. This book is a much better offering due to the conscientious
efforts of Andy and Susannah. Although I didn’t deal with them directly this time around, I’m sure
the book benefited in several ways from the contributions of Nicole LeClerc, Copy Edit Manager,
and Grace Wong, the Associate Publisher.
Ellie Fountain, the Production Editor, has been simply superb in the way she managed her
task. Ellie deserves thanks for enhancing the production quality of the book and working towards
minimizing errors. I’m very appreciative of the diligent efforts of Assistant Production Director Kari
Brooks-Copony, Compositor Dina Quan, and Indexer John Collin. The Proofreaders, Lori Bring and
Liz Welch, saved me from some particularly insidious errors. My thanks to Kurt Krames for designing the beautiful cover, and to Manufacturing Director Tom Debolski, who is responsible for
numerous issues during the printing of the book.
My special thanks to my colleagues at the Boy Scouts of America national office in Texas. Nate
Langston, Director of the Information Systems Division, has consistently encouraged us to stay at
the forefront of technological change. By stressing the adoption of the most advanced technology
available (including Oracle Database 10g!) in his role as the CIO, Nate has propelled the Boy Scouts
into the ranks of the leading organizations in the United States in the use of information technology.
I am very thankful to Dave Cambell, Director of Technical Services, for his confidence in me and for

4517FM.qxd

8/19/05

10:24 AM

Page xv

■ACKNOWLEDGMENTS

consistent encouragement and support. David Jeffress, Manager of Operations, has always been
helpful and supportive regarding any issues. David’s great sense of humor has brightened many a
day for me during the long course of writing this book.
As usual, my colleague and friend Mark Potts has helped me during the course of the book, and
I appreciate his help during the last year. I’m also fortunate to be working with a very supportive
and friendly group at work, with my team members Lance Parkes, Rob Page, and Stan Galbraith.
I want to acknowledge help from Linda Almanza, who has been a friend and a source of support.
Thanks also to Myra Riggs, Sabrina Kirkpatrick, and Jan Haase, who’ve always been wonderful colleagues. Don Rios and Robert Hernandez are thoughtful friends who’ve helped me. I’m grateful for
the support shown by Dan Nelson and Jerry Hastings.
My family in India has been a source of strength and inspiration in writing this book. I am
thankful to my mother Swarna Kumari for her enormous love and kindness, and my brothers Hari
and Sivasankar for their affection and support. Thanks also to Aruna and Vanaja for all the support
over the years. My thanks to Ashwin, Teja, Aparna, and little Soumya for their affection and
generosity.
As before, much of the burden of writing this book has fallen on members of my immediate
family—Valerie, Shannon, Nina, and Nicholas. I don’t see how I could have written this book without their sacrifices and support. My children Shannon, Nina, and Nicholas, as usual, have been very
graceful and kind about my absences during the long stretch of writing the book. I admire their
ability to understand and indulge my need to spend all my spare time on the book. They have made
for a lot of happy moments in the little time that I did manage to spend with them, and I’m most
grateful for those moments. My deepest thanks go to my wife, Valerie, who has carried a heavy
burden for the last year while I was writing my book. She consistently supported my efforts, and
nothing would have been possible without her selfless affection, love, and support.

xv

4517FM.qxd

8/19/05

10:24 AM

Page xvi

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 (Oracle 6). 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 for the
Oracle Database 10g database. Oracle Corporation publishes copious material to help you manage
its increasingly complex databases. Oracle Corporation also conducts a variety of in-person 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 for performing their jobs if they rely exclusively on Oracle’s voluminous
(albeit well-written) material in the form of manuals, class notes, Web-based seminars, and so on.
The goal of this book is to provide you with a single source for most of your day-to-day Oracle
database management tasks. Of course, it isn’t feasible to cover each and every DBA topic in detail.
What I’ve done in this book is focus on the topics that are common to most enterprises, such as
installing the Oracle Database 10g software, creating and upgrading databases, exporting and
importing data, backing up and recovering data, and performance tuning. I place a lot of emphasis
in this book on explaining all of Oracle’s automatic management solutions. Using Oracle’s automatic management features will keep you from reinventing the wheel each time. It also turns out
that after several years of development, Oracle has finally placed in your hands a set of powerful
management advisors and other tools that make a lot of traditional DBA work obsolete.

How to Become an Oracle DBA
As you start out on your journey to become a proficient Oracle DBA, you have many sources of
information on the Oracle database:
xvi

4517FM.qxd

8/19/05

10:24 AM

Page xvii

■INTRODUCTION

• Oracle Database 10g database administration classes, which have now been boiled down to
a pair of five-day long classes
• Oracle manuals—there’s an entire library of manuals available on the Oracle web sites
• Books from other publishers that impart various pieces of the knowledge required to
become an accomplished Oracle DBA
You’ll also need to acquire the necessary operating system knowledge. Most of the large Oracle
databases are based on the UNIX (or Linux) operating system, so you’ll need to have a reasonably
good understanding of UNIX. Again, you have many sources of information available. You can
attend a class or two from the leading UNIX system vendors, such as Hewlett-Packard and Sun
Microsystems, you can read the manuals, or you can buy some books. Microsoft Windows is
another popular operating system for Oracle databases, so you need to have a basic understanding
of the Windows Server operating system as well.
As many of the new entrants to the Oracle Database 10g 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 DBAs to have
an entire shelf full of books, all explaining various facets of the DBA profession—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 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 find his or her way through this baffling amount of material,
but how’s the neophyte DBA to cope with the overwhelming amount of information? That’s where
this book comes in. This text will not only educate you in the theory and principles involved in
managing relational databases, it will also help you translate that theory into the useful, practical
knowledge that will enable you to manage real-life Oracle Database 10g databases with real-life
data and real-life issues.

Oracle Database 10g
A recent article by one of Oracle Corporations’ senior executives refers to Oracle Database 10g as
a “revolution in database technology.” I would slightly amend the statement by saying that Oracle
Database 10g is more an “evolution” of database technology—a result of several improvements
Oracle has made in its flagship product over the past few years. Oracle Database 10g is the real
McCoy—it’s the culmination of a sustained effort on Oracle’s behalf to simplify and refine database
management. This is a vastly improved database product compared to its predecessors, and it can
truly lay claim to the title of a “self-managing” database.
The g in Oracle Database 10g stands for “grid.” The idea is to enable software to access spare
processing power across networks (grids) of inexpensive servers. Traditionally, database systems
have been run on large servers capable of running several very large databases at once. However,
there are distinct disadvantages inherent in the single-server model. For example, resources tied
up in the large servers cannot be redistributed among the various databases and other services to
ensure an optimal allocation of resources. If you need a massive amount of resources to handle
your database’s peak needs, chances are that you’ll run with identical resources throughout the day,
thus guaranteeing that you are going to waste critical resources during low-utilization periods.
The new model being strongly supported and recommended by Oracle Corporation is grid
computing, which provides a means of harnessing the power of a large number of cheaper servers

xvii

4517FM.qxd

xviii

8/19/05

10:24 AM

Page xviii

■INTRODUCTION

to provide the computing power you need in a flexible manner. This hardware would be servers like
the Intel-based blade servers, and the software would include the free (or almost free) open-source
Linux operating system. By choosing small, generic servers, your system will cost much less than a
traditional large server system, and because you can dynamically reallocate or provision resources
based on actual needs, you’ll be using resources efficiently.
Grid computing (also referred to as computing on demand and utility computing) isn’t a new
innovation invented solely by Oracle. The idea of grid computing has been around for a while, primarily in the academic world. In fact, grid computing arose out of the academic community’s need
for extremely fast and scalable computers to perform complex, massive research tasks. Another
overriding goal of the academic community was to permit the sharing of computing resources
among large numbers of researchers. Of course, the academics also aimed to keep the cost as low as
possible. Grid computing emerged out of these efforts as a viable way to create huge sharable computing environments that are dynamically adjustable to changes in the demand for computing
power.
When we talk about harnessing the power of a number of commodity servers, realize that the
number of computers may not be limited to just a handful. We are talking about combining the
power of a fairly large number of small servers linked together to form a grid. Obviously, the key
idea here is that the sum is far greater than the individual components. Enterprise grid computing,
as envisioned by Oracle, uses large pools of modular storage and commodity servers. Underutilization of resources will be cut down, because capacity could be altered from the centralized pool of
resources as necessary.
Here is a summary of the key benefits of grid computing:
• Flexibility: Since you are creating a single logical entity from a bunch of small servers, you
can, of course, add or remove individual components as your computing needs dictate.
• Efficiency: The concept of dynamic provisioning underlies grid computing. Dynamic provisioning means that the allocation of resources for various services is not rigidly fixed, but
changes according to the need for resources and the availability of the resources. Ideally, a
well-run grid will channel resources to where they are needed the most by diverting them
from underutilized sources.
• Easy manageability: It is far easier to manage a single logical combination of your computing
resources (which may include several databases and application servers), rather than monitoring each one as a completely independent unit.
• Economy: The total cost of a grid environment could be considerably lower than a traditional
single, big server environment. Oracle strongly recommends the use of Linux-based commodity servers, which Oracle says offer the best price/performance ratio.

Key Components of Oracle Database 10g
While Oracle Corporation has focused its 10g marketing campaign around the support for grid
computing, several of the main features of Oracle Database 10g that support a grid-based system
have been in place from the 8i and 9i database versions. The 10g release refines existing features,
introduces a few new features, and generally pulls all of the grid-related features together in a coordinated manner. These are the essential components of Oracle’s grid-based systems:
• Real Application Clusters (RAC)
• Information sharing
• Easy server manageability

4517FM.qxd

8/19/05

10:24 AM

Page xix

■INTRODUCTION

• Extensive instrumentation
• Automatic performance tuning
• Automatic Storage Management (ASM)
• Automatic memory management
• Scheduling and resource management
Note that you most certainly don’t have to use a “grid” platform to be able to use the Oracle
Database 10g server. In either case, you can take advantage of all the new features of the database
system.

Real Application Clusters
Oracle has had a feature called the Oracle Parallel Server (OPS) for many years, which enabled people
to access the database from more than one instance, thus providing for scalability as well as high
availability. Oracle has refined the parallel server technology considerably over the years, eventually
renaming it Real Application Clusters (RAC) a few years ago. Real Application Clusters are at the
heart of the Oracle Database 10g technology, so much so that several analysts have remarked that
10g is mostly a marketing push to promote Oracle RAC technology.

■Note

This book concerns itself exclusively with the “mainstream” Oracle Database 10g DBA concepts and
techniques. You’ll not find any discussion of the Oracle Real Application Clusters in this book. If you are interested
in RAC, you may want to take a look at Oracle manuals or refer to one of the many good books devoted to RAC.

Information Sharing
In order to efficiently share information over a grid spanning many heterogeneous systems, you
need to share information efficiently. Data exchange can be occasional (such as when you perform
data loads for a new system), or it could be regular and instantaneous (updating one part of the
system when something changes in another part). In order to facilitate either type of information
sharing, Oracle Database 10g provides transportable tablespaces and Oracle streams.

Transportable Tablespaces
The transportable tablespaces features enables high-speed transport of huge amounts of data from
one database to another, even if the databases are running on different operating systems. The ability to move huge amounts of data across platforms, and even to rename the tablespaces during the
process, makes information exchange far easier. In Oracle Database 10g Release 2, you can transport tablespaces using RMAN backups as the source for the transported tablespaces.

Oracle Streams
Oracle Streams is a feature that enables you to effortlessly capture changes made in one database
and propagate them to subscriber nodes in the grid. The Oracle Streams feature can keep all the
copies in sync while the changes are being applied.

xix

4517FM.qxd

xx

8/19/05

10:24 AM

Page xx

■INTRODUCTION

Easy Server Manageability
Through its new Database Control and Grid Control interfaces, Oracle Enterprise Manager enables
the management of either a single database or all databases, application servers, hosts, listeners,
HTTP servers, and web applications as well.
The prevailing view among IT organizations is that Oracle is a complex, difficult-to-manage
database, especially when compared with the Windows server database, SQL Server. Oracle Database 10g makes a conscious effort to simplify management, right from the installation process
through to the daily monitoring and performance tuning. There is a new common infrastructure for
storing workload- and performance-related information. You can now use powerful SQL tuning
tools to determine ways to improve performance.
The Oracle Enterprise Manger (OEM) has been around for several years now, but it has reached
a new level of sophistication in Oracle Database 10g. The Database Control, and its enterprise-wide
counterpart, Grid Control, provide unsurpassed capabilities for managing the database. Traditionally, Oracle DBAs relied on complex SQL scripts to monitor the database as well as diagnose and fix
performance problems. OEM now can help you do all those things and a lot more. Occasional use
of scripts is okay, but a heavy reliance on them today would be anachronous, and as needless as a
dependence on the horse and buggy in today’s modern world.

■Note

I’ve reduced the use of DBA scripts to the bare minimum in this book. Instead, I show you how to use the
OEM Database Control effectively to perform all your tasks quickly and with far less effort.

Extensive Instrumentation
Oracle Database 10g, for the first time, provides much farther ranging instrumentation of its code
base, providing accurate metrics about database performance that weren’t available until now.
Oracle’s own instrumentation and metrics, since they are embedded in the database code, provide
better information without any measurable performance degradation, compared to third-party
performance-measurement tools.

of the various components of the database. Here are some of them:
• The Automatic Database Diagnostic Monitor (ADDM) helps you analyze current and past
instance performance.
• The SQL Tuning Advisor helps you tune SQL statements.
• The SQL Access Advisor tells you whether you should add (or drop) indexes and materialized
views.
• The Segment Advisor helps you figure out the necessary space for new tables and to reclaim
unused space assigned to segments, among other things.
• The Undo Advisor helps you configure the critical Undo tablespace.
• The Memory Advisor provides recommendations for memory related parameters.
• The MTTR Advisor helps you determine the ideal mean-time-to-recover settings.

4517FM.qxd

8/19/05

10:24 AM

Page xxi

■INTRODUCTION

Each of these advisors has a similar look and feel, and this consistency will help you learn how
to use them effectively. Using the advisors isn’t mandatory, of course—you can also tune space and
memory by using Oracle-supplied packages and various dynamic performance views—but it’s more
efficient to simply invoke the necessary advisor.

Automatic Performance Tuning
Oracle Database 10g revolutionizes SQL performance tuning by providing you with automatic
performance diagnosis and tuning recommendations. A brand new expert diagnosis tool called
contents to analyze instance performance. The ADDM’s analysis includes a summary of database
problems ranked according to the amount of database time they’re costing, as well as a list of
recommendations to eliminate these problems. The ADDM’s recommendations may include
modifying configuration settings or running one of the advisors listed in the previous section.

Automatic Storage Management
A significant component of the Oracle Database 10g push towards easier management is the new
Automatic Storage Management (ASM) feature. Traditionally, we have relied on third-party vendors,
such as Veritas and EMC, to provide storage-management tools for larger systems. The new ASM
feature enables the automatic management of disks without resorting to third-party logical volume
mangers (LVMs).
You can use Oracle’s new storage virtualization layer to automate and simplify the layout and
management of all Oracle database files, when you use ASM. Instead of directly managing numerous files and disks, you can pay attention to a relatively small number of disk groups. If you need
additional storage, you simply add new physical disks to the logical disk groups.

Automatic Memory Management
The Oracle Database 10g server provides you with an easy way of managing the memory needs
of your databases. Automatic shared memory management and automatic program global area
management use information collected from the instance to efficiently allocate both the major
components of Oracle’s memory allocation—the system global area (SGA) and the program global
area (PGA).

Scheduling and Resource Management
It’s common for enterprise users to share computing resources, and there needs to be a way of
scheduling the users and sharing the enterprise’s resources efficiently. Oracle Database 10g DBAs
can use the Resource Manager feature to control and channel scarce database resources among the
various users of the grid. You can also use the new Scheduler feature to manage and monitor jobs as
well as prioritize them.

What sets this book apart from the others on the market is the constant focus on 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 new DBA need to know? What UNIX, Linux, and Windows commands and utilities does the
new DBA need to know? How does a DBA perform the basic UNIX administration tasks? How does a
DBA install the Oracle software from scratch? How does one use all the powerful new performance-

xxi

4517FM.qxd

xxii

8/19/05

10:24 AM

Page xxii

■INTRODUCTION

This book provides the conceptual background and operational details for all the topics a DBA
needs to be familiar with. The following sections outline other reasons to choose this Oracle Database 10g book.

Delivers a One-Volume Reference
This book’s specific purpose is to serve as a one-volume handbook for professional Oracle DBAs—
as a book that covers both the theory and practice of the DBA craft. 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 mundane, so you can identify what matters most
and what you merely need to be aware of, at least in the beginning.
I’m definitely not suggesting that this one book will supplant all of the other Oracle material.
I strongly recommend that inquisitive readers make it a habit to refer to Oracle’s documentation
for the 10g database. 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
http://technet.oracle.com.
It’s extremely important to read the Oracle database manuals, and to understand how the
database works. However, nothing can replace working on an actual database when it comes to
mastering DBA techniques, so if you have a Windows desktop, you can easily install the freely
downloadable Oracle Database 10g software. If you want, you can do the same on a Linux system as
well. One of the great things about the Oracle database software is that it runs virtually identically
on each operating system. In fact, your production system will operate exactly the same as the free
“toy database” on your desktop machine, so go ahead and practice to your heart’s content on the
10g database.

Whether you use this or some other DBA handbook, you will 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 Oracle Database 10g 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 a lot 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 has several manuals covering the backup and recovery material. Once you finish the two relevant chapters in this book
(Chapters 15 and 16), you’ll find going through those 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
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 Oracle Database 10g tasks. You can access these tutorials, the Oracle
by Example series, by going to http://www.oracle.com/technology/obe/start/index.html.

4517FM.qxd

8/19/05

10:24 AM

Page xxiii

■INTRODUCTION

Emphasizes New Methods and When to Use Them
One of the fundamental difficulties for a neophyte in this field is determining the right strategy for
managing databases. Although the essential tasks of database management are pretty similar in
Oracle Database 10g compared to earlier versions of the software, the database contains several
innovative techniques that make a number of routine tasks easier to perform than in the past.
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 existing techniques abruptly between versions; features advertised as being destined for
obsolescence are made obsolete only after 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 concerning contending methods. Thus, when more than one method exists for performing a task, you as a DBA have to exercise caution when you select the appropriate methods to use.
In this book, I clearly emphasize the newer features of Oracle that have been refined in the last
few years and encourage you to move away from older techniques when the new innovations are
clearly superior. I help you in formulating a solid strategy when multiple choices are offered. A good
example is performance tuning: it was common to employ a traditional SQL-script approach to
guide performance-tuning efforts, but this book comes down squarely on the side of using the latest
Oracle Enterprise Manager (OEM) GUI techniques to perform all your performance tuning and

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/Linux 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 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 enables you
to start using the UNIX operating system right away and 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 to strengthen your
skills as an Oracle DBA as you progress in your career.

■Note

I understand that some of you may not really need the UNIX (or Linux) background or the introduction
to SQL and PL/SQL (presented in Appendix A). If this is the case, skip those chapters and get on to the main
database-management chapters.

Although a number of books have been published in the last decade on the subject of Oracle database administration, there has been a surprising lack of the blending of the concepts of the Oracle
database with the techniques needed to perform several administrative tasks. A glaring example is

xxiii

4517FM.qxd

xxiv

8/19/05

10:24 AM

Page xxiv

■INTRODUCTION

the area of backup and recovery, where it’s difficult to find discussions of the conceptual underpinnings of Oracle’s 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 split between 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,
and to their understanding of the concepts behind the operation of the database. To get this practice, readers can experiment with all the commands in this book on a UNIX- or a Windows-based
Oracle Database 10g database. Oracle Database 10g is loaded with features that make it the cuttingedge database in the relational database market, and this book covers all the new additions and
modifications to database administration contained in the 10g version. It’s a lot of fun for an experienced DBA to have the opportunity to use all the wonderful features of the new database, but
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 Oracle Database 10g
This book was written with the Oracle Database 10g database specifically in mind—it doesn’t simply
add 10g features to a book written for earlier versions. The book was written for the express purpose
of taking advantage of Oracle Database 10g’s new powerful features for database administration and
making them an integral part of a working DBA’s toolkit.
You might be familiar with my Oracle 9i DBA book (Expert Oracle9i Database Administration).
Only two chapters made it in to this book more or less intact—those on data modeling and UNIX.
All the other chapters have been rewritten from scratch using the 10g database. All of Oracle Database 10g’s key features pertaining to a DBA’s job have been thoroughly tested and verified, and they
are shown to you in this book. Unlike the current practice in the market, this book takes a clear
stand when alternative methods exist to perform the same task, and it advocates the use of the
newer Oracle Database 10g methods consistently. I consider it superfluous to continue to teach
the old methods along with the more sophisticated new techniques.

This book is primarily intended for beginning- and intermediate-level Oracle Database 10g DBAs.
Prior experience with Oracle databases isn’t assumed, so if you’ve never managed databases and
intend to master the management of the new Oracle Database 10g database, you can do so with the
help of this book.
Oracle9i DBAs can also benefit from this book, but, as I mentioned in the previous section, this
book isn’t an Oracle9i book with a smattering of Oracle Database 10g features. Consequently, you
may not find any worthwhile discussion of some 9i features that have been supplanted by better
methods in the Oracle Database 10g release. If you’re using strictly the Oracle9i release databases,
you may wish to refer to my earlier book, Expert Oracle9i Database Administration.
More precisely, the audience for this book will fall into the following categories:
• Oracle DBAs who are just starting out
• Oracle developers and UNIX/Linux or Windows system 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

4517FM.qxd

8/19/05

10:24 AM

Page xxv

■INTRODUCTION

A Note About UNIX, Linux, and Windows
I personally like the UNIX operating system and use it at work. I’m familiar with the Windows platform and I 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 operating 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.
If you need to find out how to use the Oracle Database 10g 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, and
Chapter 20 summarizes these differences and covers basic Windows system administration as it
pertains to Oracle Database 10g 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 Oracle Database 10g database management skills. I know it’s unusual to provide UNIX
and SQL background in an Oracle DBA book, but this 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 Oracle Database 10g DBA.
I strove to write the chapters to mirror real-life practical training. For example, you should
understand basic database modeling and fundamental UNIX operating system commands before
learning to manage Oracle databases. I therefore start with a discussion of database modeling and
UNIX (in Part One of the book). You’ll install the Oracle database software before you create an
actual database (Part Two). After you install the software, you can create databases, create users,
and establish connectivity (Part Three). You can load and back up data only after the database is
created (Part Four). As you can see, the chapters follow the real-life sequence of the tasks they cover.
The following sections briefly summarize the contents of the book.
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.
Throughout the book I’ve provided detailed, step-by-step, tested examples to illustrate the use
of data concepts and features of Oracle Database 10g. I strongly recommend that you set up an
Oracle Database 10g database server on your PC and follow along with these examples. Doing so
will teach you the relevant commands and help you build confidence in your skill level. Plus, the
examples are a whole lot of fun!

Part 1: Background, Data Modeling, and UNIX/Linux
Part 1 provides a background on the Oracle DBA profession and offers an introduction to data
modeling and the UNIX operating system. In Chapter 1 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 also discuss the basics
of relational databases. Chapter 2 provides an introduction to both logical and physical database
design, including the use of entity-relationship diagrams. You’ll learn about the Optimal Flexible
Architecture (OFA) with regard to disk layout. Chapter 3 provides a quick introduction to UNIX/Linux

xxv

4517FM.qxd

xxvi

8/19/05

10:24 AM

Page xxvi

■INTRODUCTION

operating systems, including the most common commands that you need as an Oracle DBA, the
rudiments of shell scripting, and how to use the vi text-processing commands. You’ll also explore
the essential UNIX system administration tasks for Oracle DBAs. This chapter finishes with coverage of disks and storage systems, including the popular RAID systems.

Part 2: Oracle Database 10g Architecture, Schema,
and Transaction Management
Part 2 is in many ways the heart of the book—it covers the important topics of Oracle Database 10g’s
architecture, schema management, and transaction management. In Chapter 4 you’ll learn about
the important components of the Oracle database architecture, such as how the database processes
and memory work. It also covers the conceptual foundations of the Oracle database. Chapter 5
covers schema management in Oracle Database 10g, and it contains a quick review of the important types of Oracle objects, such as tables and indexes, and shows you how to manage them.
Chapter 6 provides you with a good understanding of how Oracle databases conduct transaction
processing.

Part 3: Installing Oracle Database 10g, and
Part 3 includes three chapters that show you how to install the Oracle Database 10g software,
create Oracle databases, and upgrade databases. Chapter 7, which covers Oracle software installation, shows the interesting changes made to the Oracle installation process in the 10g version.
Chapter 8 shows you in detail how to upgrade to Oracle Database 10g from older versions of the
database server software. And Chapter 9 shows you how to create an Oracle database from scratch,
both manually as well as through the use of the Database Configuration Assistant (DBCA).

Part 4: Connectivity and User Management
Part 4 explains how to establish connectivity to the Oracle database from various types of users.
Chapter 10 covers connecting to Oracle databases, and Chapter 11 shows you how to manage users
and discusses ways of securing your production databases. Chapter 12 provides a thorough introduction to the use of SQL*Plus and iSQL*Plus, the main interfaces to the Oracle database.

Part 5 deals with loading data and performing backups and recovery. You’ll learn how to use
SQL*Loader in Chapter 13, and Chapter 14 covers the new Data Pump technology, which enables
you to load and unload Oracle data. Chapters 15 and 16 deal with the important topics of database
backups and recovery, respectively.

Part 6: Managing the Operational Oracle Database
Part 6 covers managing the operational Oracle Database 10g database. Chapter 17 focuses on
the important Oracle Database 10g automatic management features, as well as on several online
capabilities. Chapter 18 shows you how to manage data files, tablespaces, and Oracle redo logs, and
also how to perform undo management. The new Oracle storage solution, Automatic Storage Management, is discussed in this chapter as well. Chapter 19 describes how to use the powerful Oracle
Enterprise Manager (OEM) to monitor and manage your databases as well as your entire system.
You’ll learn how to install and use the Database Control, which you use for managing a single

4517FM.qxd

8/19/05

10:24 AM

Page xxvii

■INTRODUCTION

database, and the Grid Control, through which you can manage your enterprise, including application servers and hosts. Chapter 20 discusses how to install the Oracle Database 10g software on
Windows system, and details the salient features of administering Oracle databases in a Windows
environment.

Part 7: Performance Tuning
Part 7 covers Oracle Database 10g performance tuning and troubleshooting issues. Chapter 21 discusses the Oracle Optimizer and provides tips on writing efficient SQL queries. You’ll also see how to
use Oracle’s new automatic SQL Tuning Advisor to improve query performance. In Chapter 22, you’ll
learn how to optimize the use of Oracle’s memory, disk I/O, and the operating system. You’ll also
learn about the Oracle wait interface in this chapter. A basic approach to performance analysis and
troubleshooting production databases is explained as well.

Part 8: The Data Dictionary, Dynamic Views,
and the Oracle-Supplied Packages
I discuss the all-important Oracle data dictionary in Chapter 23—one measure of how good a DBA
you are is how well you know the Oracle data dictionary. You can perform most important performance tasks by utilizing only the internal Oracle dynamic performance views, and I discuss these in
detail in this chapter. In Chapter 24 you will learn how to effectively use the most important packages supplied by Oracle.

Appendix A: Oracle Database 10g SQL and PL/SQL:
A Brief Primer
In the Appendix, I show you how to install the Oracle sample schemas, so you can practice and test
the Oracle database features on a test database. I also introduce Oracle SQL and PL/SQL, provide an
introduction to Oracle XML DB, which helps you deal with XML data, and include an introduction
to using the Java programming language with Oracle.

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 observation, adapted
from the introduction to the famous textbook by Paul A. Samuelson, the great economist and Nobel
Laureate:1
I envy you, the beginning Oracle DBA, as you set out to explore the exciting world of Oracle
Database 10g 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!

, seventeenth ed. (New York: McGraw-Hill, 1998).

xxvii

4517FM.qxd

8/19/05

10:24 AM

Page xxviii

4517CH01.qxd

8/19/05

11:54 AM

PART

Page 1

1

■■■

Background,
Data Modeling,
and UNIX/Linux

4517CH01.qxd

8/19/05

11:54 AM

Page 2

4517CH01.qxd

8/19/05

11:54 AM

CHAPTER

Page 3

1

■■■

The Oracle DBA’s World

T

here are many types of Oracle databases, and there are many types of Oracle database administrators (DBAs)—this chapter discusses the role of the Oracle DBA as well as the training that Oracle
DBAs typically need to be successful. 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 to keep the databases under your stewardship performing optimally. Toward the end of the chapter, you’ll find a list of resources and

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 to that single goal, and almost
everything DBAs do on a day-to-day basis is aimed at meeting that single target. Without access to
data, many companies and organizations would simply cease to function.

■Note

Imagine the chaos that would ensue if a company such as Amazon.com no longer had access to its customer database, even for a short time. The entire company could cease to function. At a minimum, it would lose
also responsible for protecting that data from unauthorized access—just think of the commotion caused by the
break-ins at leading data-based organizations like ChoicePoint in the United States.

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, including these:
• 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 a small organization a DBA could be managing the entire information technology (IT) infrastructure, including the databases, whereas in a large organization there could be a number of
DBAs, each charged with managing a particular area of the system.

3

4517CH01.qxd

4

8/19/05

11:54 AM

Page 4

CHAPTER 1 ■ THE ORACLE DBA’S WORLD

You can put the tasks you’ll perform as an Oracle DBA in the following three categories:
• Security
• System management
• Database design
I discuss each of these broad roles in more detail in the following sections, outlining what you
could consider the bare minimum level of performance expected of a DBA. Although the lists in
each section may seem long and daunting, the tasks are 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 are the really enjoyable
things, such as performance tuning or whatever else may appeal to you.

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. Several potential security holes are possible when you implement a new Oracle
system out of the box, and you need to know how to plug these security holes thoroughly before the
databases go live in a production environment. In Chapter 11, which deals with user management,
you’ll find a fuller discussion of standard Oracle security guidelines and other Oracle securityrelated issues.

Protecting the Database
For an Oracle DBA, no task is more fundamental and critical than protecting the database itself. The
Oracle DBA is the person the information departments entrust with safeguarding the organization’s
data, and this involves preventing unauthorized use of and access to 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 maintain the database security policy (and to create the policy if it doesn’t already
exist). 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 Chapter 11.

■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 monitor the system to ensure
uninterrupted service. The tasks involved in monitoring the system include the following:
• Monitoring space in the database to ensure it is sufficient for the system
• Checking to ensure that batch jobs are finishing as expected
• Monitoring log files on a daily basis for evidence of unauthorized attempts to log in
(something DBAs want to keep close tabs on)

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 guide the users’ use of the database and ensure the database’s
security by using proper authorization schemes, roles, and privileges. Of course, when users are

4517CH01.qxd

8/19/05

11:54 AM

Page 5

CHAPTER 1 ■ THE ORACLE DBA’S WORLD

locked out of the database because of password expiration and related issues, the DBA needs to
take care of them. It’s also the responsibility of the DBA to monitor the resource usage by individual
users and to flag the heavy resource users.

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 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 of 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.
Troubleshooting is a catchall term, and it can involve several of the tasks 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 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 of a database. 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 database tuning, or application tuning, or both.
Generally, the DBA performs the database tuning and assists in the testing and implementation
stages of the application tuning performed by the application developers.
Performance requirements for a living database change constantly, and the DBA needs to continually monitor the database performance by applying the right indicators. For example, after my
firm migrated from Oracle8i to the new Oracle Database 10g, 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 Oracle 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 Oracle version
before you switch over to it.
You can say that all database tuning efforts can be grouped into two classes—proactive and
reactive tuning. Proactive tuning, as the name indicates, means that the DBA heads off potential
trouble by careful monitoring of necessary performance indices. As we all know, prevention is
always better than any cure, so proactive tuning will always trump reactive tuning efforts. However,
most Oracle DBAs in charge of production databases don’t have the luxury of proactively tuning—
they are too busy reacting to complaints about a slow-performing database or some similar problem.
You are likely to encounter both kinds of database tuning efforts in your day-to-day life as an
Oracle DBA.

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 quickly 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 downtime (such as downtime due to a process running out of space).

5

4517CH01.qxd

6

8/19/05

11:54 AM

Page 6

CHAPTER 1 ■ THE ORACLE DBA’S WORLD

Estimating Requirements
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
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 sorely neglected in many
companies, in spite of its critical importance for the company.
Loss of business data not only leads to immediate monetary damage in the form of lost revenue, but it also costs customer goodwill in the long run. Unplanned database downtime reflects
poorly on the firm’s technical prowess and the competency of the management. A good example of
this was 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.
When disasters or technical malfunctions keep the database from functioning, the DBA can
fall back on backed-up copies of the database to resume functioning at peak efficiency. The DBA is
responsible for the formulation, implementation, and testing of fail-safe backup and restoration
policies for the organization. In fact, no other facet of the DBA’s job is as critical as the successful
and speedy restoration of the company’s database in an emergency. I’ve personally seen careers
made or broken based on one backup- and recovery-related emergency; an emergency can test the
true mettle of an Oracle DBA like no other job requirement can.
During those times when disaster strikes, the seasoned DBA is the one who is confident that
he or she has the necessary technical skills and can remain calm in an emergency. This calmness is
really the outcome of years of painstaking study and testing of the theoretical principles and the
operational commands necessary to perform sensitive tasks, such as the restoration and recovery
of damaged databases.

After the DBA has created database objects, schemas, and users, he or she needs to load the data,
usually from older legacy systems or sometimes from a data warehouse. If the data loads need to be
done on a periodic basis, the DBA needs to design, test, and implement the appropriate loading
programs.

Overseeing Change Management
Every application goes through changes over time to improve features and fix bugs in the software.
There is a constant cycle of development, testing, and implementation, and the DBA plays an
important role in that cycle. Change management is the process of properly migrating new code,
and the Oracle DBA needs to understand the process that’s in place in his or her organization.
In addition to updating application code, the Oracle DBA is also responsible for ensuring that
all the latest changes to the database software are also evaluated and adopted. These so-called
software patches are usually made available through Oracle’s MetaLink service. In fact, the latest

4517CH01.qxd

8/19/05

11:54 AM

Page 7

CHAPTER 1 ■ THE ORACLE DBA’S WORLD

The DBA’s Database Design Role
Many Oracle DBAs spend at least part of their time helping design new databases. The DBA’s role
may include helping create entity-relationship diagrams and suggesting dependencies and candidates for primary keys. In fact, having the DBA actively involved in designing new databases will
improve the performance of the databases down the road. It’s a well-known fact that an improperly
designed database thwarts all attempts to tune its performance.

Designing the Database
Although designing databases is probably not the first thing that comes to mind when you think of
a DBA’s responsibilities, design issues (whether concerning the initial design or design change) are a
fundamental part of the Oracle DBA’s job. Administrators who are particularly skilled in the logical
design of databases can be crucial members of a team that’s designing and building brand-new
databases. A talented DBA can keep the design team from making poor choices during the design
process.

The Oracle DBA plays an important role in evaluating the features of alternative products. The DBA
is the person who installs the Oracle database server software in most organizations; the UNIX system administrator may also handle part of the installation process. Prior to actual installation, the
DBA is responsible for listing all the memory and disk requirements so that the Oracle software
and databases, as well as the system itself, can perform adequately. If the DBA wants the system
administrator to reconfigure the UNIX kernel so it can support the Oracle installation, the DBA is
responsible for providing the necessary information. Besides installing the Oracle database server
software, the DBA is also called upon to install any middleware, such as the Oracle Application
Server 10g and Oracle client software on client machines.

Creating Databases
The DBA is responsible for the creation of databases. Initially he or she may create a test database
and later, after satisfactory testing, move the database to a production version. The DBA plans
the logical design of the database structures, such as tablespaces, and implements the design by
creating the structures after the database is created. As the DBA plays a part in creating the new
database, he or she needs to work with the application team closely to come up with proper estimates of the database objects, such as tables and indexes.

Creating Database Objects
An empty database doesn’t do anyone a whole lot of good, so the DBA needs to create the various
objects of the database, such as tables, indexes, and so on. Here, the developers and the DBA work
together closely, with the developers providing the tables and indexes to be created and the DBA
making sure that the objects are designed soundly. The DBA may also make suggestions and modifications to the objects to improve their performance. Through proper evaluation, the DBA can
come up with alternative access methods for selecting data, which can improve performance.

■Note As a DBA, you can contribute significantly to your organization by explaining the alternatives available to
your application team in designing an efficient database. For example, if you explain to the application team the
Oracle partitioning option, including the various partitioning schemes and strategies, the team can make smarter
choices at the design stage. You can’t expect the application team to know the intricacies of many Oracle options
and features, especially in the new Oracle Database 10g software.

7

4517CH01.qxd

8

8/19/05

11:54 AM

Page 8

CHAPTER 1 ■ THE ORACLE DBA’S WORLD

Finally, remember that the organization will look to the DBA for many aspects of information
management. The DBA may be called upon to not only assist in the design of the databases, but
also to provide strategic guidance as to the right types of databases (OLTP, DSS, and so forth) and
the appropriate architecture for implementing the organization’s database-driven applications.

Different DBA Job Classifications
Given the diverse nature of business, a DBA’s job description is not exactly the same in all organizations. There are several variations in the job’s classification and duties across organizations. In a
small firm, a single DBA might be the UNIX or NT administrator and the network administrator as
well as the Oracle DBA, with all job functions rolled into one. A large company might have a dozen
or more Oracle DBAs, each in charge of a certain database or a certain set of tasks.
Sometimes you’ll hear the terms “production DBA” and “development” (or “logical”) DBA.
Production DBA refers to database administrators in charge of production databases. Because a
such DBAs aren’t required to have design or other such developmental skills. DBAs who are involved
in the preproduction design and development of databases are usually called development or
logical DBAs. Ideally, you should strive to acquire the relevant skill sets for both development and
production administration, but reality demands that you usually are doing more of one thing than
the other at any given time. In general, large establishments usually have a number of DBAs and
can afford to assign specialized tasks to their personnel. If you work for a small organization,
chances are you’ll be doing a little bit of everything.
Individual preference, the availability of financial and technical resources, and the necessary
skill sets determine whether a DBA is doing production or development work. A DBA who comes
up from the developer ranks or who’s happiest coding is usually more likely to be a development
or logical DBA. This same person also may not really want to carry a pager day and night and be
woken up in the dead of night to perform a database recovery. On the other hand, a person who
likes to do production work and to work with business analysts to understand their needs is less
likely to enjoy programming in SQL or in any other language.
Although all of the preceding is true, both development and production DBAs are well advised
to cross-train and learn aspects of the “other” side of Oracle database administration. Too often,
people who characterize themselves as production DBAs do not do much beyond performing backups and restores and implementing the physical layout of databases. Similarly, development DBAs,
due to their preference for the programming and design aspects of the job, may not be fully
cognizant of the operational aspects of database management, such as storage and memory
requirements.

Types of Databases
In many organizations, you will be working with different types of databases daily, and thus with
different types of data and management requirements. You may find yourself working on simple SQL
queries with users and simultaneously wrestling with decision-support systems for management.
Databases perform a variety of functions, but you can group all of those functions into two
broad categories: online transaction processing (OLTP) and decision-support systems (DSSs; sometimes also called online analytical processing, or OLAP). Let’s take a quick look at some of the basic
classifications of Oracle databases.

4517CH01.qxd

8/19/05

11:54 AM

Page 9

CHAPTER 1 ■ THE ORACLE DBA’S WORLD

Online Transaction Processing and Decision-Support
System Databases
Online transaction processing (OLTP) databases are the bread and butter of most consumer- and
supplier-oriented databases. This category includes order entry, billing, customer, supplier, and
supply-chain databases. These databases are characterized by heavy transaction volume and a need
to be online continuously, which today (given the use of the Internet to access such systems) means
24/7/365 availability, short maintenance intervals, and low tolerance for breakdowns in the system.
Decision-support systems (DSSs) range from small databases to large data warehouses. These
are typically not 24/7 operations, and they can easily manage with regularly scheduled downtime
and maintenance windows. The extremely large size of some of these data warehouses necessitates
the use of special techniques both to load and to use the data.
There isn’t a whole lot of difference between the administration of a DSS-oriented data warehouse and a transaction-oriented OLTP system from the DBA’s perspective. The backup and
recovery methodology is essentially the same, and database security and other related issues are
also very similar. The big difference between the two types of databases occurs at the design and
implementation stages. DSS systems usually involve a different optimization strategy for queries
and different physical storage strategies. Oracle Database 10g provides you with the choice of
implementing an OLTP database or a DSS database using the same database server software.
Performance design considerations that may work well with one type of database may be
entirely inappropriate for another type of database. For example, a large number of indexes can
help you query a typical data warehouse efficiently while you are getting some reports out of that
database. If you have the same number of indexes on a live OLTP system with a large number of
concurrent users, you may see a substantial slowing down of the database, because the many