Tải bản đầy đủ (.pdf) (554 trang)

Apress secrets of the oracle database jun 2009 ISBN 1430219521 pdf

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (15.22 MB, 554 trang )

 CYAN
  MAGENTA

 YELLOW
  BLACK
 PANTONE 123 C

Books for professionals by professionals ®

Dear Reader,

Norbert Debes is the
coauthor of two books
on Oracle9i database
administration, development, and high availability.

The official documentation on the ORACLE database server is so vast that you
will never manage to read it entirely. Yet in all that vastness, some very useful features go completely undocumented, and others are only partially-documented. Read this book, learn to apply those features, and you will lift your
DBA skills to the next level.
Whether you are dealing with administrative tasks, performance optimization, or database security, this book will give you additional insights as well as
caveats that you will not find in Oracle Corporation’s official documentation.
How can that be? I have been working with the ORACLE DBMS for more than
13 years and I have contributed to several documentation volumes during my
tenure at Oracle. I have experienced first-hand that the information flow from
the developers to the documentation writers is often insufficient and that the
writers have not used the features they document.
My favorite part of the book is about performance optimization. You
will learn how extended SQL trace, Statspack, AWR, and my MERITS performance optimization method all combine to really make a difference in your
tuning efforts. I am confident that the MERITS method and the included
ESQLTRCPROF SQL trace profiler will enable you to solve performance problems that you have struggled with in the past.
Do not worry that the insights you will gain will soon become obsolete. Most


of the undocumented aspects described herein are remarkably stable. I have
taken great care to never write about a feature that I haven’t thoroughly tested,
and to provide proof for what I say. Reading this book will help set you apart
from fellow DBAs by giving you just that decisive bit more that you need to
solve a problem.
Sincerely,
Norbert Debes

THE APRESS ROADMAP
Troubleshooting
Oracle Performance

Secrets of the
Oracle Database

Mastering
Oracle SQL and SQL*Plus

Expert Oracle
Database 11g
Administration

Oracle Insights

ISBN 978-1-4302-1952-1
90000

www.apress.com

Debes


SOURCE CODE ONLINE

Beginning Oracle
Database 11g
Administration

Secrets of the Oracle Database

Secrets of the Oracle Database

The EXPERT’s VOIce ® in Oracle

Secrets of the
Oracle Database
Advanced administration, tuning, and
troubleshooting using undocumented features

Norbert Debes
Foreword by Guy Harrison

Shelve in
Databases/Oracle
User level:
Intermediate–Advanced

9 781430 219521

this print for content only—size & color not accurate


spine = 1.054" 552 page count



Debes_1952-1FRONT.fm Page i Monday, May 11, 2009 3:30 PM

Secrets of the
Oracle Database

■■■

Norbert Debes


Debes_1952-1FRONT.fm Page ii Monday, May 11, 2009 3:30 PM

Secrets of the Oracle Database
Copyright © 2009 by Norbert Debes
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-13 (pbk): 978-1-4302-1952-1
ISBN-13 (electronic): 978-1-4302-1953-8
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.
Lead Editor: Jonathan Gennick
Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Tony Campbell, Gary
Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann,

Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh
Project Manager: Beth Christmas
Copy Editor: Lisa Hamilton
Associate Production Director: Kari Brooks-Copony
Production Editor: Kelly Winquist
Compositor: Susan Glinert
Proofreader: Greg Teague
Indexer: Norbert Debes
Artist: April Milne
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 , or
visit .
For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600,
Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail , or visit http://
www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use.
eBook versions and licenses are also available for most titles. For more information, reference our Special
Bulk Sales–eBook Licensing web page at />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 . You will need to answer
questions pertaining to this book in order to successfully download the code.


Debes_1952-1FRONT.fm Page iii Monday, May 11, 2009 3:30 PM



Debes_1952-1FRONT.fm Page iv Monday, May 11, 2009 3:30 PM

Contents at a Glance
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
About the Foreword Writer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii

PART 1

Initialization Parameters

■CHAPTER 1

Partially Documented Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

■CHAPTER 2

Hidden Initialization Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

PART 2

■■■

Data Dictionary Base Tables

■CHAPTER 3

Introduction to Data Dictionary Base Tables . . . . . . . . . . . . . . . . . . . 41


■CHAPTER 4

IND$, V$OBJECT_USAGE, and Index Monitoring . . . . . . . . . . . . . . . . 45

PART 3

■■■

Events

■CHAPTER 5

Event 10027 and Deadlock Diagnosis . . . . . . . . . . . . . . . . . . . . . . . . . 57

■CHAPTER 6

Event 10046 and Extended SQL Trace . . . . . . . . . . . . . . . . . . . . . . . . . 61

■CHAPTER 7

Event 10053 and the Cost Based Optimizer . . . . . . . . . . . . . . . . . . . . 63

■CHAPTER 8

Event 10079 and Oracle Net Packet Contents . . . . . . . . . . . . . . . . . . 87

PART 4

iv


■■■

■■■

X$ Fixed Tables

■CHAPTER 9

Introduction to X$ Fixed Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

■CHAPTER 10

X$BH and Latch Contention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105

■CHAPTER 11

X$KSLED and Enhanced Session Wait Data . . . . . . . . . . . . . . . . . . . 113

■CHAPTER 12

X$KFFXP and ASM Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119


Debes_1952-1FRONT.fm Page v Monday, May 11, 2009 3:30 PM

PART 5

■■■


SQL Statements

■CHAPTER 13

ALTER SESSION/SYSTEM SET EVENTS . . . . . . . . . . . . . . . . . . . . . . . 129

■CHAPTER 14

ALTER SESSION SET CURRENT_SCHEMA . . . . . . . . . . . . . . . . . . . . . 135

■CHAPTER 15

ALTER USER IDENTIFIED BY VALUES . . . . . . . . . . . . . . . . . . . . . . . . . 143

■CHAPTER 16

SELECT FOR UPDATE SKIP LOCKED . . . . . . . . . . . . . . . . . . . . . . . . . . 149

PART 6

■■■

Supplied PL/SQL Packages

■CHAPTER 17

DBMS_BACKUP_RESTORE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

■CHAPTER 18


DBMS_IJOB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

■CHAPTER 19

DBMS_SCHEDULER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

■CHAPTER 20

DBMS_SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

■CHAPTER 21

DBMS_UTILITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

PART 7

■■■

Application Development

■CHAPTER 22

Perl DBI and DBD::Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

■CHAPTER 23

Application Instrumentation and End-to-End Tracing . . . . . . . . . . 251

PART 8


■■■

Performance

■CHAPTER 24

Extended SQL Trace File Format Reference . . . . . . . . . . . . . . . . . . 271

■CHAPTER 25

Statspack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311

■CHAPTER 26

Integrating Extended SQL Trace and AWR . . . . . . . . . . . . . . . . . . . . 345

■CHAPTER 27

ESQLTRCPROF Extended SQL Trace Profiler . . . . . . . . . . . . . . . . . . 351

■CHAPTER 28

The MERITS Performance Optimization Method . . . . . . . . . . . . . . . 371

v


Debes_1952-1FRONT.fm Page vi Monday, May 11, 2009 3:30 PM

PART 9


■■■

Oracle Net

■CHAPTER 29

TNS Listener IP Address Binding and IP=FIRST . . . . . . . . . . . . . . . 401

■CHAPTER 30

TNS Listener TCP/IP Valid Node Checking . . . . . . . . . . . . . . . . . . . . 413

■CHAPTER 31

Local Naming Parameter ENABLE=BROKEN . . . . . . . . . . . . . . . . . . 419

■CHAPTER 32

Default Host Name in Oracle Net Configurations . . . . . . . . . . . . . . 423

PART 10

■■■

Real Application Clusters

■CHAPTER 33

Session Disconnection, Load Rebalancing, and TAF . . . . . . . . . . . 429


■CHAPTER 34

Removing the RAC Option Without Reinstalling . . . . . . . . . . . . . . . 445

PART 11

■■■

Utilities

■CHAPTER 35

OERR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459

■CHAPTER 36

Recovery Manager Pipe Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465

■CHAPTER 37

ORADEBUG SQL*Plus Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479

PART 12

■■■

Appendixes

■APPENDIX A


Enabling and Disabling DBMS Options . . . . . . . . . . . . . . . . . . . . . . . 495

■APPENDIX B

Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497

■APPENDIX C

Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499

■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507

vi


Debes_1952-1FRONT.fm Page vii Monday, May 11, 2009 3:30 PM

Contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
About the Author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
About the Foreword Writer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii

PART 1

■■■

■CHAPTER 1


Initialization Parameters

Partially Documented Parameters

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

AUDIT_SYSLOG_LEVEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Syslog Facility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Introduction to Auditing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Using AUDIT_SYSLOG_LEVEL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Auditing Non-Privileged Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
PGA_AGGREGATE_TARGET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Introduction to Automatic PGA Memory Management . . . . . . . . . . . . 8
Misconceptions About PGA_AGGREGATE_TARGET . . . . . . . . . . . . . 10
Researching PGA_AGGREGATE_TARGET . . . . . . . . . . . . . . . . . . . . . . 11
Creating a Large Table with a Pipelined Table Function . . . . . . . . . 11
V$SQL_WORKAREA_ACTIVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
_PGA_MAX_SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
_SMM_MAX_SIZE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
_SMM_PX_MAX_SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Shared Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Parallel Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
EVENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Leveraging Events at the Instance-Level . . . . . . . . . . . . . . . . . . . . . . 22
Case Study. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22


vii


Debes_1952-1FRONT.fm Page viii Monday, May 11, 2009 3:30 PM

viii

■C O N T E N T S

OS_AUTHENT_PREFIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
OPS$ Database Users and Password Authentication . . . . . . . . . . . . 23
Case Study. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

■CHAPTER 2

Hidden Initialization Parameters

. . . . . . . . . . . . . . . . . . . . . . . . . 29

Trace File Permissions and _TRACE_FILES_PUBLIC . . . . . . . . . . . . . . . . 30
ASM Test Environment and _ASM_ALLOW_ONLY_RAW_DISKS . . . . . . 31
ASM Hidden Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Setting Up Oracle Clusterware for ASM . . . . . . . . . . . . . . . . . . . . . . . 33
ASM Instance Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Disk Failure Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

PART 2


■■■

■CHAPTER 3

Data Dictionary Base Tables

Introduction to Data Dictionary Base Tables . . . . . . . . . . . . . 41
Large Objects and PCTVERSION vs. RETENTION . . . . . . . . . . . . . . . . . . . . 42

■CHAPTER 4

IND$, V$OBJECT_USAGE, and Index Monitoring

. . . . . . . . . 45

Schema Restriction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Index Usage Monitoring Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Function MONITOR_SCHEMA_INDEXES . . . . . . . . . . . . . . . . . . . . . . . 47
Enabling Index Monitoring on Schema HR . . . . . . . . . . . . . . . . . . . . . 48
Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53

PART 3

■■■

■CHAPTER 5

Events


Event 10027 and Deadlock Diagnosis

. . . . . . . . . . . . . . . . . . . . 57

Deadlocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Event 10027 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

■CHAPTER 6

Event 10046 and Extended SQL Trace

. . . . . . . . . . . . . . . . . . . . 61


Debes_1952-1FRONT.fm Page ix Monday, May 11, 2009 3:30 PM

■C O N T E N T S

■CHAPTER 7

Event 10053 and the Cost Based Optimizer

. . . . . . . . . . . . . . 63

Trace File Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
Query Blocks and Object Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Query Transformations Considered . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Legend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Results of Bind Variable Peeking . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
Optimizer Parameters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
System Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
Object Statistics for Tables and Indexes . . . . . . . . . . . . . . . . . . . . . . 77
Single Table Access Path and Cost . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Join Orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Execution Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Predicate Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Hints and Query Block Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

■CHAPTER 8

Event 10079 and Oracle Net Packet Contents

. . . . . . . . . . . . 87

Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

PART 4

■■■

■CHAPTER 9

X$ Fixed Tables

Introduction to X$ Fixed Tables

. . . . . . . . . . . . . . . . . . . . . . . . . . 93


X$ Fixed Tables and C Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Layered Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Granting Access to X$ Tables and V$ Views . . . . . . . . . . . . . . . . . . . . . . . 96
Drilling Down from V$ Views to X$ Fixed Tables . . . . . . . . . . . . . . . . . . . 97
Drilling Down from V$PARAMETER to the Underlying
X$ Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Relationships Between X$ Tables and V$ Views . . . . . . . . . . . . . . . . . . . 102
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

■CHAPTER 10 X$BH and Latch Contention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

ix


Debes_1952-1FRONT.fm Page x Monday, May 11, 2009 3:30 PM

x

■C O N T E N T S

■CHAPTER 11 X$KSLED and Enhanced Session Wait Data . . . . . . . . . . . . . 113
Drilling Down from V$SESSION_WAIT . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
An Improved View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

■CHAPTER 12 X$KFFXP and ASM Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
X$KFFXP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Salvaging an SPFILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120

Mapping Segments to ASM Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

PART 5

■■■

SQL Statements

■CHAPTER 13 ALTER SESSION/SYSTEM SET EVENTS . . . . . . . . . . . . . . . . . . 129
Tracing Your Own Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
ALTER SESSION SET EVENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
ALTER SYSTEM SET EVENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
ALTER SESSION/SYSTEM SET EVENTS and Diagnostic Dumps . . . . . . 132
Immediate Dumps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133

■CHAPTER 14 ALTER SESSION SET CURRENT_SCHEMA . . . . . . . . . . . . . . . . 135
Privilege User vs. Schema User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
Creating Database Objects in a Foreign Schema . . . . . . . . . . . . . . 137
Restrictions of ALTER SESSION SET CURRENT_SCHEMA . . . . . . . . . . . 138
Advanced Queuing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
RENAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Private Database Links. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Stored Outlines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

■CHAPTER 15 ALTER USER IDENTIFIED BY VALUES . . . . . . . . . . . . . . . . . . . . 143
The Password Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Locking Accounts with ALTER USER IDENTIFIED BY VALUES . . . . . . . . 145
ALTER USER and Unencrypted Passwords . . . . . . . . . . . . . . . . . . . . . . . 146



Debes_1952-1FRONT.fm Page xi Monday, May 11, 2009 3:30 PM

■C O N T E N T S

■CHAPTER 16 SELECT FOR UPDATE SKIP LOCKED . . . . . . . . . . . . . . . . . . . . . . 149
Advanced Queuing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
Contention and SELECT FOR UPDATE SKIP LOCKED . . . . . . . . . . . . . . . 151
DBMS_LOCK—A Digression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

PART 6

■■■

Supplied PL/SQL Packages

■CHAPTER 17 DBMS_BACKUP_RESTORE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Recovery Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
Disaster Recovery Case Study with Tivoli Data Protection
for Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

■CHAPTER 18 DBMS_IJOB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
Introduction to DBMS_JOB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
BROKEN Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
FULL_EXPORT Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
REMOVE Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
RUN Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179


■CHAPTER 19 DBMS_SCHEDULER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
Running External Jobs with the Database Scheduler . . . . . . . . . . . . . . . 181
Exit Code Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Standard Error Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
External Jobs on UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
Removal of Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Command Line Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
External Jobs and Non-Privileged Users . . . . . . . . . . . . . . . . . . . . . 190

xi


Debes_1952-1FRONT.fm Page xii Monday, May 11, 2009 3:30 PM

xii

■C O N T E N T S

External Jobs on Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Command Line Argument Handling . . . . . . . . . . . . . . . . . . . . . . . . . 192
Windows Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
External Jobs and Non-Privileged Users . . . . . . . . . . . . . . . . . . . . . 193
Services Created by the ORADIM Utility . . . . . . . . . . . . . . . . . . . . . . 194
OracleJobScheduler Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195

■CHAPTER 20 DBMS_SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
GET_ENV Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
KCFRMS Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
KSDDDT Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

KSDFLS Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
KSDIND Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
KSDWRT Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
READ_EV Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
SET_INT_PARAM_IN_SESSION Procedure . . . . . . . . . . . . . . . . . . . . . . . 205
SET_BOOL_PARAM_IN_SESSION Procedure . . . . . . . . . . . . . . . . . . . . . 207
SET_EV Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
SET_SQL_TRACE_IN_SESSION Procedure . . . . . . . . . . . . . . . . . . . . . . . 210
WAIT_FOR_EVENT Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

■CHAPTER 21 DBMS_UTILITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
NAME_RESOLVE Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
Name Resolution and Extraction of Object Statistics . . . . . . . . . . . . . . . 218
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

PART 7

■■■

Application Development

■CHAPTER 22 Perl DBI and DBD::Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
Circumnavigating Perl DBI Pitfalls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
A Brief History of Perl and the DBI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
Setting Up the Environment for Perl and the DBI . . . . . . . . . . . . . . . . . . 224
UNIX Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
Windows Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229


Debes_1952-1FRONT.fm Page xiii Monday, May 11, 2009 3:30 PM


■C O N T E N T S

Transparently Running Perl Programs on UNIX Systems . . . . . . . . . . . . 232
Transparently Running Perl Programs on Windows . . . . . . . . . . . . . . . . 233
Connecting to an ORACLE DBMS Instance . . . . . . . . . . . . . . . . . . . . . . . 235
DBI connect Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
Connecting Through the Bequeath Adapter . . . . . . . . . . . . . . . . . . . 237
Connecting Through the IPC Adapter . . . . . . . . . . . . . . . . . . . . . . . . 237
Connecting Through the TCP/IP Adapter . . . . . . . . . . . . . . . . . . . . . 239
Easy Connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Connecting with SYSDBA or SYSOPER Privileges . . . . . . . . . . . . . . 240
Connecting with Operating System Authentication . . . . . . . . . . . . . 241
Connect Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Comprehensive Perl DBI Example Program . . . . . . . . . . . . . . . . . . . . . . . 244
Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249

■CHAPTER 23 Application Instrumentation

and End-to-End Tracing

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251

Introduction to Instrumentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
JDBC End-to-End Metrics Sample Code . . . . . . . . . . . . . . . . . . . . . 254
Compiling the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Instrumentation at Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Setting Up Tracing, Statistics Collection,

and the Resource Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256
Using TRCSESS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
TRCSESS and Shared Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
Instrumentation and the Program Call Stack . . . . . . . . . . . . . . . . . . . . . . 266
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267

PART 8

■■■

Performance

■CHAPTER 24 Extended SQL Trace File Format Reference . . . . . . . . . . . . . 271
Introduction to Extended SQL Trace Files . . . . . . . . . . . . . . . . . . . . . . . . 271
SQL and PL/SQL Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
Recursive Call Depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272

xiii


Debes_1952-1FRONT.fm Page xiv Monday, May 11, 2009 3:30 PM

xiv

■C O N T E N T S

Database Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
PARSING IN CURSOR Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . 275
PARSE Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276

PARSE ERROR Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
EXEC Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
FETCH Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
Execution Plan Hash Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Plan Hash Value Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
CLOSE Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
COMMIT and ROLLBACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
UNMAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Execution Plans, Statistics, and the STAT Entry Format . . . . . . . . . . . . . 285
STAT Entry Format in Oracle9i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
STAT Entry Format in Oracle10g and Oracle11g . . . . . . . . . . . . . . 286
Wait Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
WAIT Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
WAIT in Oracle9i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
WAIT in Oracle10g and Oracle11g . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Bind Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
BINDS Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Statement Tuning, Execution Plans, and Bind Variables . . . . . . . . 295
Miscellaneous Trace File Entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Session Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Service Name Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Application Instrumentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
ERROR Entry Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
Application Instrumentation and Parallel Execution Processes . . . 308

■CHAPTER 25 Statspack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Introduction to Statspack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Retrieving the Text of Captured SQL Statements . . . . . . . . . . . . . . 313
Accessing STATS$SQLTEXT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
Capturing SQL Statements with Formatting Preserved . . . . . . . . . 323

Undocumented Statspack Report Parameters . . . . . . . . . . . . . . . . . . . . . 324
Statspack Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
Finding Expensive Statements in a Statspack Repository . . . . . . . . . . . 330


Debes_1952-1FRONT.fm Page xv Monday, May 11, 2009 3:30 PM

■C O N T E N T S

Identifying Used Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
Execution Plans for Statements Captured with SQL Trace . . . . . . . . . . 331
Finding Snapshots with High Resource Utilization . . . . . . . . . . . . . . . . . 334
High CPU Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
High DB Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Importing Statspack Data from Another Database . . . . . . . . . . . . . . . . . 340
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343

■CHAPTER 26 Integrating Extended SQL Trace and AWR . . . . . . . . . . . . . . 345
Retrieving Execution Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349

■CHAPTER 27 ESQLTRCPROF Extended SQL Trace Profiler . . . . . . . . . . . . 351
Categorizing Wait Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
Calculating Response Time and Statistics . . . . . . . . . . . . . . . . . . . . . . . . 353
Case Study. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Running the Perl Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
Calculating Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
Calculating Response Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
ESQLTRCPROF Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358

Command Line Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
ESQLTRCPROF Report Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370

■CHAPTER 28 The MERITS Performance Optimization Method . . . . . . . . 371
Introduction to the MERITS Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Measurement Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
Assessment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Resource Profiles and Performance Assessment Tools . . . . . . . . . 378
Reproduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
Improvement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
Extrapolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381

xv


Debes_1952-1FRONT.fm Page xvi Monday, May 11, 2009 3:30 PM

xvi

■C O N T E N T S

MERITS Method Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
Phase 1—Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Phase 2—Assessment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Phase 3—Reproduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
Phase 4—Improvement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392

Phase 5—Extrapolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
Phase 6—Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Source Code Depot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398

PART 9

■■■

Oracle Net

■CHAPTER 29 TNS Listener IP Address Binding and IP=FIRST . . . . . . . . 401
Introduction to IP Address Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Multihomed Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
IP=FIRST Disabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Host Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
Loopback Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Boot IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Service IP Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
IP=FIRST Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Lessons Learned . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410

■CHAPTER 30 TNS Listener TCP/IP Valid Node Checking . . . . . . . . . . . . . . 413
Introduction to Valid Node Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
Enabling and Modifying Valid Node Checking at Runtime . . . . . . . . . . . 415

■CHAPTER 31 Local Naming Parameter ENABLE=BROKEN . . . . . . . . . . . . 419
Node Failure and the TCP/IP Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419

■CHAPTER 32 Default Host Name in Oracle Net Configurations . . . . . . . 423

Default Host Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Disabling the Default Listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .ike enqueues, latches do not queue up requestors and have no other modes
except exclusive. Latches are implemented with atomic test-and-set machine instructions.

501


Debes_1952-1AppC.fm Page 502 Tuesday, May 5, 2009 10:05 AM

502

APPENDIX C ■ GLOSSARY

Latency
Latency is a time delay between the moment something is initiated and the moment effects
of the initiation become observable. The meaning of the word is highly context dependent.
The term is frequently used in the context of performance tuning. For example, unnecessary
round-trips between database server and client impose a performance penalty due to
network latency.

Lock
See enqueue.

Logical read
Reading an ORACLE block cached in the buffer cache within the System Global Area is called
a logical read.

Net service name
A Net service name is defined in the configuration file tnsnames.ora or a directory service
such as LDAP. Net service names are used in connect strings and with the command tnsping.


Paging
Writes of portions of virtual memory to disk by the operating system are called paging.
Paging occurs when free physical memory (RAM) becomes scarce or is exhausted. Paging
allows operating systems to execute programs that demand more virtual memory than RAM
installed in a system.

Parse
Syntactical and semantic analysis of SQL statements or PL/SQL blocks. Also includes verification of applicable privileges. Each statement or block parsed is associated with a cursor.

Performance
Performance of a computer or software system is the amount of useful work performed
compared to the time and resources used. Good performance implies short response times
and adequate resource usage, whereas bad performance is associated with unacceptable
response time and an overly high demand on resources.

Physical read
Request to the operating system by some process of an ORACLE instance to read one or
more blocks from disk.

Physical write
Request to the operating system by some process of an ORACLE instance to write one or
more blocks to disk. Physical writes occur, for example, when the database writer process
(DBWn) writes modified blocks in the buffer cache to disk. Other examples are writes to sort
or LOB segments by dedicated or shared server processes.


Debes_1952-1AppC.fm Page 503 Tuesday, May 5, 2009 10:05 AM

APPENDIX C ■ GLOSSARY


Polling
Active request for a resource in a tight loop. Polling is often responsible for large amounts of
wasted CPU time. Whenever possible, processes should be sleeping while waiting for a
resource instead of actively polling for a resource’s availability.

POSIX
POSIX (Portable Operating System Interface) is the collective name of a family of related
standards, which define the application programming interface (API) for software compatible with variants of the UNIX operating system.

Random access memory (RAM)
Random access memory is the volatile main memory of a computer system.

Real Application Clusters (RAC)
Multi-instance variant of the ORACLE DBMS that runs on clustered hardware to achieve
scalability and high availability. RAC requires cluster software, such as Oracle Clusterware,
HP-UX ServiceGuard, IBM HACMP, Veritas Cluster, Sun Cluster, or HP TruCluster.

Recursive SQL
SQL statements the ORACLE DBMS executes against the data dictionary as user SYS in order
to service a request from a database client. See also user level SQL.

Resource profile
An apportionment of response time often presented in tabular form. Each row of a tabular
resource profile contains a single contributor to response time, for example CPU time consumption or a wait event. Ideally, the following columns are included: contributor name, percentage
of response time, contribution to response time in seconds, number of times the contributor
was called upon, and average time consumed by a call upon the contributor. The table
should be sorted by percentage of contribution to response time in descending order.

Response time

The wall clock time an electronic system needs to fulfill a request by a user. Response time
consists of CPU time consumption and waiting.

Rule-based SQL optimizer (RBO)
The rule-based SQL optimizer was the simpler predecessor of the more advanced cost based
SQL optimizer (CBO). The RBO generated execution plans based on a fixed set of rules. It
knew nothing about table sizes and column selectivities. The RBO is obsolete since the
release of Oracle10g.

503


Debes_1952-1AppC.fm Page 504 Tuesday, May 5, 2009 10:05 AM

504

APPENDIX C ■ GLOSSARY

SQL (Structured Query Language)
SQL is a computer language designed for the retrieval and management of data in relational
database management systems. Among its features are creation, modification, and removal
of database schema objects (DDL), data manipulation (DML), and database object access
control management.

SQL trace file, extended
An extended SQL trace file contains a log of the actions of one or more database clients.
Actions include parse, execute, and fetch. The trace levels 1, 4, 8, and 12 control the amount
of detail in SQL trace files.

Scalability

Scalability is a desirable property of a system, network, or application program, which indicates its ability to either handle growing workloads in a graceful manner, or to be readily
enlarged.

Sleeping
Processes may be put to sleep when a requested resource is not available. Sleeping processes do
not consume CPU time. Thus sleeping is preferred over polling.

Swapping
Transfer of process virtual memory from RAM to disk.

System Global Area (SGA)
Memory structure containing the database buffer cache, the shared pool, java pool, large
pool, Streams pool, and the log buffer. On UNIX, the SGA resides in shared memory.

System Change Number
Each modification of data in an ORACLE database is stamped with a monotonically increasing
number, the System Change Number. Backup, recovery, and consistent read are implemented
based on the System Change Number.

System call
A routine at the interface between an operating system and user-level programs that run
under control of the operating system. System calls execute in kernel mode, whereas application code executes in user mode. Access to devices, such as disks and network adapters, is
implemented with system calls. UNIX system calls are standardized by the POSIX standard.


Debes_1952-1AppC.fm Page 505 Tuesday, May 5, 2009 10:05 AM

APPENDIX C ■ GLOSSARY

Think time

Think time is a term from the fields of load testing and benchmarking. Humans working
with an electronic information service require a certain time to assimilate information
returned by the service. The interval between the end of the previous request on the server
and the beginning of the next request from the user is called think time, since the human
user spends that interval of time thinking about what to do next.

User level SQL
SQL statements executed directly by a database user (non-recursive SQL).

Wait event
Wait events are used for response time accounting of database sessions. Through the wait
interface or SQL trace files, wait events externalize what a database session has been waiting
on and how much wait time it has accumulated.

Wait interface
The term wait interface is used to refer to a set of V$ fixed views that expose wait events that
database clients are waiting for. These V$ views cover database sessions that are currently
waiting as well as aggregated data on past waits. The wait interface may be used to diagnose
performance problems.

X$ fixed tables
Undocumented internal structures of the ORACLE DBMS. V$ fixed views are based on X$
fixed tables. X$ fixed tables are often called just X$ tables, but they are not tables in the usual
sense of the word, since they do not map to segments in a tablespace.

505


Debes_1952-1AppC.fm Page 506 Tuesday, May 5, 2009 10:05 AM



Debes_1952-1INDEX.fm Page 507 Wednesday, May 6, 2009 2:44 PM

Index

■Symbols
_ALLOW_RESETLOGS_CORRUPTION, 29
_ASM_ALLOW_ONLY_RAW_DISKS, 31
_ASM_AUSIZE, 33, 36
_ASM_STRIPESIZE, 33
_ASM_STRIPEWIDTH, 33, 122
_OFFLINE_ROLLBACK_SEGMENTS, 29
_PGA_MAX_SIZE, 16
_SMM_MAX_SIZE, 17
_SMM_PX_MAX_SIZE, 18
_SPIN_COUNT, 501
_TRACE_FILES_PUBLIC, 30

■A
abstract data type, 149
action
and DBMS_MONITOR, 257
and instrumentation, 131, 253
instrumentation and TAF, 432
Active Session History, 314
Active Workload Repository, 314, 345, 369
adb, 209
address resolution protocol, 421
Advanced Queuing, 138, 149
Advanced Replication, 149

Advanced Security Option, 87
AIX
and Perl, 226
alert log
parsing by monitoring tools, 203
allocation unit
and ASM, 119
ALTER SESSION SET EVENTS, 129
ALTER SYSTEM DISCONNECT SESSION, 429
ALTER SYSTEM KILL SESSION, 431
ALTER SYSTEM REGISTER, xxxv
ALTER SYSTEM SET EVENTS, 129
ANALYZE, 348
ANALYZE INDEX, 50
ANALYZE TABLE, 50

arp
UNIX command, 421
ARP cache, 421
arping
UNIX command, 421
array insert, 111
ARRAYSIZE
in SQL*Plus, 431
ASM, 484
and Clusterware, 445
ASM_DISKSTRING, 34
assoc
Windows command, 234
AUD$, 5

AUDIT_ACTIONS, 7
AUDIT_FILE_DEST, 4
AUDIT_SYSLOG_LEVEL, 3
AUDIT_TRAIL, 3, 146
auditing, 4, 146
AutoCommit
Perl DBI attribute, 243
automatic control file backup, 167
Automatic Database Diagnostic Monitor, 314
Automatic PGA Memory Management, 8
Automatic Shared Memory Management, 9
automatic undo management, 42
AUTOTRACE
in SQL*Plus, 14
AUX_STATS$, 63

■B
BACKGROUND_DUMP_DEST
and failed jobs, 177
backup and recovery, 465
backup metadata, 166
batch jobs
running without using a password, 242
bc
UNIX command, 154
bequeath protocol adapter, xxxv, 235
507


Debes_1952-1INDEX.fm Page 508 Wednesday, May 6, 2009 2:44 PM


508

■I N D E X

bind variable
use in SQL*Plus, 152
bind variable peeking, 71
bind variables
and avoiding parse overhead, 244
tracing with DBMS_SYSTEM, 207
bind_columns
Perl DBI command, 247
bind_param_inout
Perl DBI command, 248
block corruption
creating with dd, 472
BLOCKRECOVER
RMAN command, 474
boot IP addresses, 401
brute force password attack, 143
bstat/estat, 313
buffer busy waits
wait event, 352
Bunce, Tim, 224

contention, 337
CONTROLF
ORADEBUG dump, 486
CONTROLFILE_RECORD_KEEPTIME, 167

COPY DATAFILE
RMAN command, 94
core file, 209
corruption, 468
creating, 472
cost based optimizer, 63
CPU Usage, 335
CPUSPEED, 64
CPUSPEEDNW, 65
CREATE DATABASE, 41
CREATE USER
unencrypted password, 89
crsctl, 33
cursor dump, 488
CV_$SESSION_WAIT, 117
Cygwin, 182, 322, 472

■C

■D

C programming language, 93, 403
call stack, 209
call stack trace, 488
callback function, 432
cardinality
in execution plan, 85
CASE WHEN
SQL CASE statement, 44
CBO, 63

CBO hint, 65
client identifier
and DBMS_MONITOR, 257
and instrumentation, 131, 253
instrumentation and TAF, 432
cluster database service, 437
Cluster Group Services, 449
CLUSTER_DATABASE, 447
clustering factor, 78
Clusterware, 447
setup for ASM, 33
collection type, 11
compulsive tuning disorder, 107
connect
DBI call, 236
connect string, xxxv
CONNECT_DATA, xxxv

Data Pump Export, 136
Data Pump Import, 136
database link
creating in foreign schema, 139
DB CPU
time model statistic, 337
db file sequential read
wait event, 352
DB Time
time model statistic, 337
DB time
statistic, 391

DB_BLOCK_SIZE, 9, 123
DB_FILE_MULTIBLOCK_READ_COUNT, 64
DBA group, 241
DBA_AUDIT_OBJECT, 6
DBA_AUDIT_SESSION, 7
DBA_AUDIT_STATEMENT, 6
DBA_ENABLED_AGGREGATIONS, 243, 257
DBA_ENABLED_TRACES, 243, 257
DBA_EXTENTS, 119
DBA_HIST_SQLSTAT, 346
DBA_HIST_SQLTEXT, 346
DBA_LOBS, 42
DBA_RSRC_GROUP_MAPPINGS, 257
DBA_SCHEDULER_JOB_RUN_DETAILS, 188


×