Oracle Dba Survival Guide 9780672306815, 0672306816

The Oracle DBA Survival Guide will turn a mediocre administrator into an effective, skilled administrator in charge of a

375 113 227KB

English Pages 789 [790] Year 1995

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
ORACLE DBA SURVIVAL GUIDE ®......Page 1
COPYRIGHT © 1995 BY SAMS PUBLISHING......Page 2
Overview......Page 3
Contents......Page 6
Preface......Page 17
Introduction......Page 18
ORGANIZATION OF THIS BOOK......Page 19
Part I The Job of the Oracle DBA......Page 23
Ch 1 The W orld of Oracle and the Database Administrator......Page 25
Ch 2 The Database Administrator's Job Description......Page 35
Ch 3 History and Development of Databases Oracle......Page 65
Ch 4 Oracle and Its Environments......Page 77
Ch 5 The T ools of the Trade......Page 97
Part II Understanding How Oracle Works......Page 117
Ch 6 How the Oracle RDBMS Works......Page 119
Ch 7 Oracle Memory Structures......Page 131
Ch 8 Oracle Files......Page 145
Ch 9 Oracle Processes......Page 159
Ch 10 Basic Oracle Database Objects......Page 175
Ch 11 Oracle System Privileges......Page 193
Ch 12 Oracle Object Privileges......Page 213
Ch 13 Roles and Grants......Page 227
Ch 14 Backup and Recovery......Page 245
Part III Installing and Upgrading the Oracle Software......Page 271
Ch 15 The Life Cycle of an Oracle Database......Page 273
Ch 16 Choosing Products and the Environment......Page 283
Ch 17 Planning an Oracle Installation......Page 299
Ch 18 Oracle Installations......Page 317
Ch 19 Planning an Oracle Upgrade......Page 333
Ch 20 Oracle Upgrades......Page 343
Part IV Developing a Database Administration Scheme......Page 349
Ch 21 The Database Administration Scheme......Page 351
Ch 22 Laying Out a Database......Page 361
Ch 23 A Routine Maintenance Schedule......Page 373
Ch 24 Developing Scripts to Autmate Tasks......Page 385
Part V The Daily Routine......Page 403
Ch 25 The “Typical” Day......Page 405
Ch 26 User Account Maintenance......Page 415
Ch 27 Tablespace Maintenance......Page 431
Ch 28 Table and Index Maintenance......Page 445
Part VI Monitoring the Database's Health......Page 467
Ch 29 The Health of a Database......Page 469
Ch 30 Routine Monitoring......Page 479
Ch 31 Auditing......Page 501
Ch 32 Tuning the Database......Page 517
Ch 33 Looking Toward the Future......Page 539
Part VII Dealing with Problems......Page 551
Ch 34 When Problems Occur......Page 553
Ch 35 Space Problems......Page 569
Ch 36 Instance and Application Crashes......Page 585
Ch 37 When the Database Is Too Slow......Page 597
Ch 38 A Troubleshooting Checklist......Page 607
Part VIII Supporting Users and Developer's......Page 613
Ch 39 Sound Database Object Design......Page 615
Ch 40 Query Optimization......Page 633
Ch 41 Keeping Current as a DBA......Page 653
Part IX Advanced Oracle Technical Features......Page 651
Ch 42 Rollback Segments......Page 663
Ch 43 Locks......Page 671
Ch 44 Parallel Processing Options......Page 677
Ch 45 Packages, Procedures, and Triggers......Page 685
Ch 46 Client-Server Networking......Page 694
Ch 47 Where To Next?......Page 702
Ch 48 Oracle Workgroup Server and Oracle 7.2......Page 708
Appendixes......Page 714
Appendix A SQL Commands......Page 716
Appendix B Glossary of Terms......Page 722
Appendix C SQL*Plus Features......Page 726
Appendix D SQL*DBA Features......Page 732
Appendix E SQL*Loaders......Page 736
Appendix F Import and Export......Page 740
Appendix G Where to Get More Information......Page 746
Appendix H Sample System Configuration Analyses......Page 748
Appendix I The Disk Contents......Page 752
Recommend Papers

Oracle Dba Survival Guide
 9780672306815, 0672306816

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview

C ONTENTS

ORACLE DBA SURVIVAL GUIDE ®

Joseph B. Greene

201 West 103rd Street Indianapolis, Indiana 46290

i

O RACLE DBA S URVIVAL G UIDE

ii

I came into this world knowing nothing. Therefore, this book is dedicated to all the people along the way who took the time to teach me something.

A CQUIS ITI ON S E DIT OR Rosemarie Graham

D EVELOP MENT E DI TOR Todd Bumbalough

C OPYRIGHT © 1995

BY

S AMS P UBLISHING

FIRST EDITION

S OFT WARE D EVELOPMEN T SPECIALIST Steve Flatt

All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. For information, address Sams Publishing, 201 W. 103rd St., Indianapolis, IN 46290.

P RO D UCT IO N E D I TO R Nancy Albright

T ECHNICAL R EVIEWER Byron Pearce Mark Gokman

E D I TO RI AL C O O RDI N ATO R Bill Whitmer

International Standard Book Number: 0-672-30681-6

T ECHNICAL E DIT COORDI NATOR

Library of Congress Catalog Card Number: 95-67649

Lynette Quinn

98

97

96

95

4

3

2

FORMATT ER

1

Interpretation of the printing code: the rightmost double-digit number is the year of the book’s printing; the rightmost single-digit, the number of the book’s printing. For example, a printing code of 95-1 shows that the first printing of the book occurred in 1995. Composed in New Century Schoolbook and MCPdigital by Macmillan Computer Publishing Printed in the United States of America All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.

PRESIDENT

AND

PUBLISHER

ACQUISITIONS MANAGER DEVELOPMENT MANAGER MANAGING EDITOR MARKETING MANAGER

Richard K. Swadley Greg Wiegand Dean Miller Cindy Morrow Gregg Bushyeager

Frank Sinclair

C OVER D ESIGN ER Tim Amrhein

B OOK D ESIGNER Alyssa Yesh

P RODUCT ION T EAM S UPERVISOR Brad Chinn

P AGE L AYOUT Louisa Klucznik Brian-Kent Proffitt Tina Trettin Susan Van Ness

PROOF READI NG Nancy Price Brian-Kent Proffitt Erich Richter Susan D. Van Ness Paul Wilson

INDEXER Cheryl Dietsch

C ONTENTS

Overview Preface

xvii

Introduction

P ART I

T HE J OB

xviii OF THE

O RACLE DBA

1

The World of a Database Administrator

2

The Database Administrator’s Job Description

13

3

History and Development of Databases and Oracle

43

4

Oracle and Its Environments

55

5

The Tools of the Trade

75

P ART II

3

U NDERSTANDING H OW O RACLE W ORKS

6

How the Oracle RDBMS Works

7

Oracle Memory Structures

109

8

Oracle Files

123

9

Oracle Processes

137

10

Basic Oracle Database Objects

153

11

Oracle System Privileges

171

12

Oracle Object Privileges

191

13

Roles and Grants

205

14

Backup and Recovery

223

P ART III

I NSTALLING

AND

U PGRADING

97

THE

O RACLE S OFTWARE

15

The Life Cycle of an Oracle Database

251

16

Choosing Products and the Environment for Your Oracle Database

261

17

Planning an Oracle Installation

277

18

Oracle Installations

295

19

Planning an Oracle Upgrade

311

20

Oracle Upgrades

321

P ART IV

DEVELOPING

A

D ATABASE A DMINISTRATION S CHEME

21

The Database Administration Scheme

329

22

Laying Out a Database

339

23

A Routine Maintenance Schedule

351

24

Developing Scripts to Automate Tasks

363

iii

iv

O RACLE DBA S URVIVAL G UIDE

P ART V

T HE D AILY R OUTINE

25

The “Typical” Day

383

26

User Account Maintenance

393

27

Tablespace Maintenance

409

28

Table and Index Maintenance

423

P ART VI

MONITORING

THE

D ATABASE ’ S HEALTH

29

The Health of a Database

447

30

Routine Monitoring

457

31

Auditing

479

32

Tuning the Database

495

33

Looking Toward the Future

517

P ART VII

D EALING

WITH

P ROBLEMS

34

When Problems Occur

531

35

Space Problems

547

36

Instance and Application Crashes

563

37

When the Database Is Too Slow

575

38

Troubleshooting Checklist

585

P ART VIII

S UPPORTING U SERS

AND

D EVELOPERS

39

Sound Database Object Design

593

40

Query Optimization

611

41

Keeping Current as a DBA

629

P ART IX

A DVANCED O RACLE T ECHNICAL F EATURES

42

Rollback Segments

641

43

L oc ks

649

44

Parallel Processing Options

655

45

Packages, Procedures, and Triggers

663

46

Client-Server and Networking

673

47

Where To Next?

681

48

Oracle Workgroup Server and Oracle 7.2

687

C ONTENTS

A PPENDIXES A

SQL Commands

695

B

Glossary of Terms

701

C

SQL*Plus Features

705

D

SQL*DBA Features

711

E

SQL*Loaders

715

F

Import and Export

719

G

Where to Get More Information

725

H

Sample System Configuration Analyses

727

The Disk Contents

731

Index

737

I

v

vi

O RACLE DBA S URVIVAL G UIDE

Contents Introduction

P ART I

T HE J OB

OF THE

xviii

O RACLE DBA

1

1

The World of a Database Administrator

3

2

The Concept of a Database Administrator ............................................ 7 Variety of Responsibilities ..................................................................... 8 Summary .............................................................................................. 11 The Database Administrator’s Job Description 13

3

Types of Database Administrator........................................................ 15 The Full-Time Database Administrator ......................................... 18 Developers Acting as Database Administrators............................. 23 Scientists, Engineers, and Other Users as DBAs .......................... 28 Database Administrator Tasks ............................................................ 32 Is the Database Secure Enough? ..................................................... 33 Does the Database Perform Well Enough? ..................................... 35 Is the Data Accurate? ...................................................................... 37 Is the Data Stored in a Logical and Accessible Manner? .............. 37 Interfacing with System Administrators and Other Support Staff ... 37 Understanding the Application Needs ................................................ 39 Summary .............................................................................................. 42 History and Development of Databases and Oracle 43

4

Computerized Data Storage ................................................................ 44 The First Databases ............................................................................. 46 Relational Databases ........................................................................... 48 Oracle’s History .................................................................................... 50 The Current Database Market ............................................................ 51 What Next? ........................................................................................... 52 Summary .............................................................................................. 53 Oracle and Its Environments 55 What Is Oracle? .................................................................................... 56 Alternative Architectures .................................................................... 57 Oracle Development Tools Versus the Database ................................ 61 Oracle Utilities ..................................................................................... 63 Third-Party Products ........................................................................... 66 Assembling the Parts into an Architecture ........................................ 69 Summary .............................................................................................. 73

C ONTENTS

5

The Tools of the Trade

75

The Basics: SQL*DBA .......................................................................... 78 The Next Generation: Oracle Server Manager ................................... 81 Personal Oracle7 for Microsoft Windows ............................................ 82 The Command-Line Interface: SQL*Plus ........................................... 88 Import and Export ................................................................................ 90 Loading Data from External Systems: SQL*Loader .......................... 91 Third-Party Products ........................................................................... 93 Locally Developed Tools ....................................................................... 93 Summary .............................................................................................. 93

P ART II

U NDERSTANDING H OW O RACLE W ORKS

95

6

How the Oracle RDBMS Works

97

7

Overview ............................................................................................... 98 The Oracle Processes.......................................................................... 101 Memory and Speed ............................................................................. 102 Disk Storage ....................................................................................... 104 Multiprocessing and Microsoft Windows Configurations ................ 106 Summary ............................................................................................ 107 Oracle Memory Structures 109

8

Overview ............................................................................................. 110 The System Global Area (SGA) ......................................................... 112 The Program Global Area (PGA) ....................................................... 117 User Work Spaces .............................................................................. 119 Summary ............................................................................................ 120 Oracle Files 123

9

File Locations ..................................................................................... 125 Data Files ........................................................................................... 127 Redo Log Files .................................................................................... 129 Archive Log Files ................................................................................ 131 Control Files ....................................................................................... 133 Initialization Files .............................................................................. 133 Log and Trace Files ............................................................................ 135 Summary ............................................................................................ 136 Oracle Processes 137 Overview ............................................................................................. 138 The System Monitor ........................................................................... 142 The Process Monitor ........................................................................... 144 The Database Writer .......................................................................... 144

vii

viii

O RACLE DBA S URVIVAL G UIDE

10

The Log Writer ................................................................................... 147 The Archiver ....................................................................................... 148 The Recoverer ..................................................................................... 148 The Lock Writer.................................................................................. 148 Dedicated Server Processes ............................................................... 149 Multi-Threaded Server Processes...................................................... 149 SQL*Net Listeners ............................................................................. 150 Parallel Query Processes ................................................................... 150 Oracle 7 for Microsoft Windows ......................................................... 151 Summary ............................................................................................ 151 Basic Oracle Database Objects 153

11

Overview of Storage and Access ........................................................ 154 Tables .................................................................................................. 159 Indexes ................................................................................................ 162 Views ................................................................................................... 164 Synonyms ............................................................................................ 166 Stored Procedures .............................................................................. 167 Clusters ............................................................................................... 168 Sequences ........................................................................................... 169 Summary ............................................................................................ 169 Oracle System Privileges 171

12

Overview of Oracle Privileges ............................................................ 172 Overview of System Privileges .......................................................... 176 The User Privileges ........................................................................ 178 The Developer Privileges ............................................................... 178 The “Any” Privileges ...................................................................... 180 The Database Maintenance Privileges ......................................... 185 The Monitoring Privilege ............................................................... 187 Typical Privilege Sets ......................................................................... 188 The “Any” Privilege Sets .................................................................... 189 Summary ............................................................................................ 190 Oracle Object Privileges 191

13

Overview ............................................................................................. 192 Object Privileges ................................................................................. 196 Using Dummy Object Owners ........................................................... 198 A Typical Privilege Scheme ............................................................... 199 Summary ............................................................................................ 203 Roles and Grants 205 Introduction to Grants ....................................................................... 206 Introduction to Roles (Version 7 Feature) ........................................ 209 Grants Without Roles......................................................................... 212

C ONTENTS

14

A Typical Privilege Scheme ............................................................... 212 Use of Scripts to Capture Privilege Sets ........................................... 220 Summary ............................................................................................ 221 Backup and Recovery 223 The Importance of Backups ............................................................... 224 Overview of Oracle Backup Schemes ................................................ 225 Archive Log or No Archive Log .......................................................... 228 Cold Backups ...................................................................................... 229 Warm Backups ................................................................................... 236 Exports ................................................................................................ 238 Which Scheme to Choose ................................................................... 239 Rotating Backup Schemes ................................................................. 242 Automated Backup Schemes ............................................................. 245 What About Mirrored Disks? ............................................................. 247 Summary ............................................................................................ 248

P ART III

I NSTALLING AND U PGRADING O RACLE S OFTWARE

THE

249

15

The Life Cycle of an Oracle Database

251

16

Product Selection ................................................................................ 254 Planning the Installation ................................................................... 255 Installation ......................................................................................... 256 When to Upgrade................................................................................ 257 Planning Upgrades ............................................................................. 258 Upgrading the Oracle Software ......................................................... 259 Summary ............................................................................................ 260 Choosing Products and the Environment 261

17

Getting All the Pieces......................................................................... 262 Host-Based and Server-Based Architectures.................................... 268 Client-Server Architectures ............................................................... 271 Dealing with Vendors ......................................................................... 274 Summary ............................................................................................ 276 Planning an Oracle Installation 277 Starting with Business Needs ........................................................... 279 The Installation and Configuration Guide ....................................... 281 The README File ............................................................................. 284 Oracle’s Recommended Layout .......................................................... 285 Calculating Data Space ...................................................................... 288 Memory Area Planning ...................................................................... 289 Process Planning ................................................................................ 289

ix

x

O RACLE DBA S URVIVAL G UIDE

18

Developing Your Own Installation Plan ........................................... 290 Some Good Reviewers ........................................................................ 292 Summary ............................................................................................ 292 Oracle Installations 295

19

Overview ............................................................................................. 296 Starting with a System Backup ......................................................... 298 The Oracle Installer ........................................................................... 299 Installing the Oracle Application Software ...................................... 301 UNIX Installations ............................................................................. 303 Creating a Database with the Installer ............................................ 304 Dealing with Installation Problems .................................................. 305 Manually Creating a Database .......................................................... 307 Summary ............................................................................................ 309 Planning an Oracle Upgrade 311

20

Overview ............................................................................................. 312 Storing the New Software .................................................................. 314 The Importance of the README File ............................................... 314 Changes Needed in the Database ...................................................... 315 Other Factors to Consider .................................................................. 315 The Backout Plan ............................................................................... 317 Lining Up Support ............................................................................. 318 Summary ............................................................................................ 319 Oracle Upgrades 321 The Oracle Installer: To Use or Not? ................................................ 323 Another Backup Lecture .................................................................... 324 Loading and Linking the New Software ........................................... 324 Upgrading the Database .................................................................... 325 When Problems Occur ........................................................................ 325 Summary ............................................................................................ 326

P ART IV

D EVELOPING

A

D ATABASE ADMINISTRATION S CHEME

327

21

The Administration Scheme

329

22

What Is a DBA Scheme? .................................................................... 330 Technical Factors to Consider ........................................................... 333 Matching User Requirements ............................................................ 335 Preparing for the Future .................................................................... 336 Summary ............................................................................................ 338 Laying Out a Database 339 Overview ............................................................................................. 340 Data Files ........................................................................................... 341 Control Files ....................................................................................... 344

C ONTENTS

23

Online Redo Log Files ........................................................................ 345 Archive Log Files ................................................................................ 346 The Configuration Process ................................................................. 346 Expansion of the Database ................................................................ 348 Summary ............................................................................................ 349 A Routine Maintenance Schedule 351

24

Overview ............................................................................................. 352 Starting with User and System Processing Schedules .................... 355 Types of Activities .............................................................................. 357 The Daily Schedule ............................................................................ 359 The Long-Term Schedule ................................................................... 360 Summary ............................................................................................ 361 Developing Scripts to Automate Tasks 363 Automation of DBA Tasks ................................................................. 365 SQL Scripts and System Scripts ....................................................... 367 Automatic Job Submission Utilities .................................................. 373 Developing and Testing Scripts ......................................................... 377 Monitoring the Results ...................................................................... 378 Summary ............................................................................................ 379

P ART V

T HE D AILY R OUTINE

381

25

The “Typical” Day

383

26

Scheduled Events ............................................................................... 386 Monitoring .......................................................................................... 386 User Support ...................................................................................... 387 Problems ............................................................................................. 388 If There Is Any Time Left .................................................................. 390 Summary ............................................................................................ 391 User Account Maintenance 393

27

User Maintenance and the Security Scheme .................................... 394 Using System Logon IDs for Access .................................................. 396 Adding New Users to the Database .................................................. 399 Changing User Access Rights ............................................................ 402 Deleting Users from the System ........................................................ 406 Temporarily Disabling Users............................................................. 407 Summary ............................................................................................ 408 Tablespace Maintenance 409 Care and Feeding of Tablespaces ...................................................... 410 Monitoring and Planning ................................................................... 416 Typical Problems and Their Solutions .............................................. 418 Summary ............................................................................................ 422

xi

xii

O RACLE DBA S URVIVAL G UIDE

28

Table and Index Maintenance

423

Care and Feeding of Tables and Indexes .......................................... 424 Monitoring Tables and Indexes ......................................................... 434 Typical Problems and Their Solutions .............................................. 436 Fragmentation .................................................................................... 442 Summary ............................................................................................ 443

P ART VI

M ONITORING

THE

D ATABASE ’ S H EALTH

445

29

The Health of a Database

447

30

What Is a “Healthy” Database? ......................................................... 448 Monitoring Programs ......................................................................... 451 Auditing .............................................................................................. 454 Tuning ................................................................................................. 455 Summary ............................................................................................ 455 Routine Monitoring 457

31

A Routine Monitoring Program ......................................................... 458 Scripts and Reports ............................................................................ 460 Utilization Monitoring ................................................................... 462 Tuning Monitoring ......................................................................... 465 Security Monitoring ....................................................................... 470 Configuration Monitoring .............................................................. 474 Third-Party Tools ............................................................................... 477 Summary ............................................................................................ 478 Auditing 479

32

Overview ............................................................................................. 480 Oracle Auditing Events ...................................................................... 483 Auditing and Performance ................................................................. 491 Auditing as Part of Security Monitoring ........................................... 491 Deciding What to Audit ..................................................................... 492 Summary ............................................................................................ 494 Tuning the Database 495

33

What Is Tuning? ................................................................................. 496 What Can You Control? ..................................................................... 498 Host Computer Indicators ................................................................. 504 Oracle Resource Contention .............................................................. 506 A Tuning Checklist ............................................................................. 513 Summary ............................................................................................ 514 Looking Toward the Future 517 Knowing Where the Database Is Going ............................................ 518 When More Is Needed ........................................................................ 522

C ONTENTS

Proving Your Case .............................................................................. 523 Summary ............................................................................................ 527

P ART VII

D EALING

WITH

P ROBLEMS

529

34

When Problems Occur

531

35

Routine Requests, Problems, and Real Problems ............................. 533 Classifying the Problem ..................................................................... 536 Resources to Identify the Problems ................................................... 539 Unknown Problems and Approaches ................................................ 541 Supporting Resources......................................................................... 542 The Ten Most Common Problems You’ll Face .................................. 543 Service Level Agreements .................................................................. 544 Summary ............................................................................................ 545 Space Problems 547

36

Identifying the True Problem ............................................................ 548 Cleaning Out Tablespaces ................................................................. 551 Expanding Tablespaces ...................................................................... 553 Compressing the Number of Extents ................................................ 555 Alternatives: Reducing Data Storage ................................................ 559 Keeping the Data Definition Language (DDL) ................................. 560 Summary ............................................................................................ 560 Instance and Application Crashes 563

37

Tracing the Problem ........................................................................... 564 Log Files Can Help ............................................................................. 566 Operating System Conflicts ............................................................... 569 Expanding Oracle Resources for Applications .................................. 570 Reducing Oracle Resources for Applications .................................... 571 When to Call Oracle ........................................................................... 571 Summary ............................................................................................ 573 When the Database Is Too Slow 575

38

When Is a Database Too Slow? .......................................................... 576 Managing User Expectations ............................................................ 578 Checking Tuning of the Database ..................................................... 579 Application Tuning ............................................................................. 580 When Additional Capacity Is Required............................................. 581 Summary ............................................................................................ 583 Troubleshooting Checklist 585 Summary ............................................................................................ 589

xiii

xiv

O RACLE DBA S URVIVAL G UIDE

P ART VIII

S UPPORTING U SERS

AND

D EVELOPERS

591

39

Sound Database Object Design

593

40

Overview ............................................................................................. 594 Normalization and Table Design ....................................................... 597 Table Design Modifications for Decision Support ............................ 600 When and How to Use Indexes .......................................................... 601 Naming Conventions .......................................................................... 604 Summary Tables Versus Views ......................................................... 606 Sizing Tables ...................................................................................... 606 Sizing Indexes ..................................................................................... 609 Summary ............................................................................................ 610 Query Optimization 611

41

Factors Designers Can Control ......................................................... 613 The Rule-Based Optimizer ................................................................. 616 The Cost-Based Optimizer ................................................................. 617 Execution Plans .................................................................................. 619 Hints.................................................................................................... 622 Indexes ................................................................................................ 624 General Guidelines ............................................................................. 624 The Value of Experimentation .......................................................... 626 Summary ............................................................................................ 626 Keeping Current as a DBA 629 The Changing Environment .............................................................. 631 Training Vendors ................................................................................ 632 Books ................................................................................................... 634 A Test Instance ................................................................................... 635 The Internet ........................................................................................ 635 User Groups ........................................................................................ 637 Summary ............................................................................................ 638

P ART IX

A DVANCED O RACLE T ECHNICAL F EATURES

639

42

Rollback Segments

641

43

Introduction ........................................................................................ 642 Special Storage Considerations ......................................................... 644 Common and Confusing Error Messages .......................................... 645 Setting Up Rollback Segments .......................................................... 647 Summary ............................................................................................ 648 L oc ks 649 Overview ............................................................................................. 650 Types of Locks Applied....................................................................... 651

C ONTENTS

44

Freeing Locks ..................................................................................... 653 Determining When an Application is Waiting for a Lock to Release ........................................................................ 653 Summary ............................................................................................ 654 Parallel Processing Options 655

45

Types of Parallel Processing .............................................................. 657 When to Use Parallel Processing ....................................................... 658 Distributed Databases Versus Parallel Servers ............................... 658 Multi-Threaded Servers ..................................................................... 659 Asynchronous Database Writers ....................................................... 660 Parallel Query .................................................................................... 661 Parallel Recovery ................................................................................ 661 Summary ............................................................................................ 662 Packages, Procedures, and Triggers 663

46

Software Stored in the Database ....................................................... 664 The Object-Oriented World ................................................................ 666 Trigger Types and Uses ..................................................................... 667 Database Procedures .......................................................................... 668 Database Packages ............................................................................. 670 When to Use Packages, Procedures, and Triggers ........................... 671 Summary ............................................................................................ 671 Client-Server and Networking 673

47

What Is Client-Server? ....................................................................... 674 Typical Client-Server Architectures .................................................. 678 Tricks to Administering a Client-Server Database .......................... 679 Distributed Databases ....................................................................... 680 Summary ............................................................................................ 680 Where To Next? 681

48

The Oracle Environment ................................................................... 682 The DBA’s Job .................................................................................... 683 Tips to Make Life Easier .................................................................... 684 The Future .......................................................................................... 685 Oracle Workgroup Server and Oracle 7.2 687 First Impressions of the Workgroup Server Concept ....................... 688 Oracle 7.2 ............................................................................................ 690 Rumors and Gossip About Oracle 8 .................................................. 691 Summary ............................................................................................ 691

xv

xvi

O RACLE DBA S URVIVAL G UIDE

A PPENDIXES

693

A

SQL Commands

B

Object Creation Commands ............................................................... 696 Object Modification Commands ......................................................... 698 Object Deletion Commands ............................................................... 699 Glossary of Terms 701

C

SQL*Plus Features

D

Calling SQL*Plus ............................................................................... 706 Output Formatting ............................................................................. 706 Working with SQL Files .................................................................... 708 SQL*Plus Versus SQL*DBA ............................................................. 709 SQL*DBA Features 711

E

Command Line Versus Screen Mode ................................................ 712 Menu Interface ................................................................................... 712 Monitors .............................................................................................. 713 Killing User Sessions ......................................................................... 713 Oracle Server Manager ...................................................................... 713 SQL*Loaders 715

F

Using Load Tables and Population Scripts ....................................... 716 Fixed Column Versus Delimited Formats ........................................ 716 An Example Control File ................................................................... 717 Useful Optional Parameters .............................................................. 717 Import and Export 719

G

Command Line Versus Interactive ................................................... 720 Import Parameters ............................................................................. 720 Requirements for Running Import .................................................... 721 Oracle Export ...................................................................................... 721 An Export and Import Example ........................................................ 721 Where to Get More Information 725

H

Conventional Addresses ..................................................................... 726 FTP Sites ............................................................................................ 726 World Wide Web Pages ...................................................................... 726 Newsgroups ........................................................................................ 726 Sample System Configuration Analyses 727

I

695

705

The Disk Contents

731

Index

737

C ONTENTS

Preface Some people lead highly focused careers. I’m not one of those people. Instead, I have tried a number of different jobs, appreciating a variety of assignments and learning new things. This was how I got into Oracle. I was working as a system architect and MIS planner when someone needed to have a database management system. I ordered the system and, because I had worked with Oracle a little before for a test, set up the system for them. Once I set it up, I wound up maintaining the system. Then a strange thing happened. People saw Oracle DBA work on my résumé and started to ask for my services. Even though I was qualified to perform a number of other tasks and had actually spent more time working in those areas, I received assignment after assignment as an Oracle DBA. Some of these assignments were extremely challenging, working on extremely large databases and integrating a wide variety of client-server products into the environments. Over time, I became very comfortable as an Oracle DBA. Then I saw a request on the Oracle Internet Newsgroup for authors to write books on Oracle. I had always wanted to write a book, so I jumped at the opportunity. Practical people want to write books to further their careers or get a publication on their resumes. I just wanted to try something new and perhaps spread the knowledge that I had been gaining through my consulting assignments. I had discovered that most of the places where I started up Oracle databases had similar questions and needs that were not addressed by the books provided with Oracle. Don’t get me wrong. I use the books that come with Oracle (electronic and hard copy) all the time. They are usually correct when you have a specific question on a specific technical topic, but often lack an overall feeling for the job of the DBA. They do a good job as an encyclopedia, but do not present the big picture. That is my goal for Oracle DBA Survival Guide. Writing this book was definitely a challenge. The folks at Sams (especially Rosemarie Graham, the acquisitions editor) were very tolerant of my schedule demands and I appreciate that. One of the things that I found to be most interesting as an author is the large number of people who work on a book like this. There are a large number of people who work to acquire the books (in my case Rosemarie Graham), develop the book (Todd Bumbalough), perform technical editing (Byron Pearce and Mark Gokman), pull everything together (Nancy Albright), and perform all of the other services such as preparing graphics, typesetting, and so forth. (I don’t know these people’s names, but thank them anyway). Finally, there are a large number of people who I would like to thank for contributions that they have made to my development. My Mom brought me into this world

xvii

xviii

O RACLE DBA S URVIVAL G UIDE