0% found this document useful (1 vote)
546 views10 pages

Oracle 9i - High Performance Tuning With STATSPACK

This document provides an overview and table of contents for a book about tuning Oracle databases using STATSPACK. It outlines the key topics that will be covered in each chapter, including installing and configuring STATSPACK, understanding the data in the STATSPACK tables, extending STATSPACK to collect additional server statistics, and using STATSPACK to tune the server environment and Oracle database.

Uploaded by

acsabo_14521769
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
546 views10 pages

Oracle 9i - High Performance Tuning With STATSPACK

This document provides an overview and table of contents for a book about tuning Oracle databases using STATSPACK. It outlines the key topics that will be covered in each chapter, including installing and configuring STATSPACK, understanding the data in the STATSPACK tables, extending STATSPACK to collect additional server statistics, and using STATSPACK to tune the server environment and Oracle database.

Uploaded by

acsabo_14521769
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

ORACLE Series / Oracle9i High Performance Tuning with STATSPACK / Burleson / 222360-x / Chapter 1

Blind Folio 1:vii

Color profile: Disabled


Composite Default screen

Contents
ACKNOWLEDGMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
PART I

Overview of the Method and the Tools


1 Overview of Oracle Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Overall Tuning Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Server Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Network Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Disk Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Instance Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Object Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SQL Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning with Oracle Parallel Query . . . . . . . . . . . . . . . . . . . . . . .
Tuning Real Application Clusters (RAC) . . . . . . . . . . . . . . . . . . . .
Oracle and STATSPACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3
4
9
10
11
12
13
14
15
15
16
19

2 Overview of STATSPACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The STATSPACK Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
How STATSPACK Collects Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The STATSPACK Table Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
STATSPACK Control Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
STATSPACK Parameter Tables . . . . . . . . . . . . . . . . . . . . . . . . . . .
Uses for STATSPACK Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Database Tuning with STATSPACK . . . . . . . . . . . . . . . . . . . . . . .
Resource Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Predictive Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21
23
23
26
27
29
31
31
32
33
34

vii

D:\OMH\Oracle8\360-x\360xFM.vp
February 15, 2002 1:34:52 PM

Color profile: Disabled


Composite Default screen

viii

ORACLE Series / Oracle9i High Performance Tuning with STATSPACK / Burleson / 222360-x / Front Matter
Blind Folio FM:viii

Oracle9i High Performance Tuning with STATSPACK

3 Installing and Configuring STATSPACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Overview of the STATSPACK Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . .
STATSPACK Scripts for Oracle8 and Oracle8i . . . . . . . . . . . . . . .
STATSPACK Scripts for Post-8.1.6 STATSPACK . . . . . . . . . . . . . . .
Step 1: Create the perfstat Tablespace . . . . . . . . . . . . . . . . . . . . . . . . . .
Step 2: Run the Create Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Run the Pre-8.1.7 Install Scripts . . . . . . . . . . . . . . . . . . . . . . . . . .
Install Prerequisites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step 3: Test the STATSPACK Install . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step 4: Schedule Automatic STATSPACK Data Collections . . . . . . . . . . .
STATSPACK Configuration and Maintenance . . . . . . . . . . . . . . . . . . . . .
Viewing STATSPACK Snapshots . . . . . . . . . . . . . . . . . . . . . . . . .
Adjusting the STATSPACK Collection Thresholds . . . . . . . . . . . . . . . . . .
Snapshot Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Snapshot Thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Back-Porting STATSPACK for Oracle 8.0 Through 8.1.5 . . . . . . . . . . . . .
Removing Old STATSPACK Snapshots . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the STATSPACK purge Utility . . . . . . . . . . . . . . . . . . . . . .
Manually Removing STATSPACK Snapshots . . . . . . . . . . . . . . . .
Removing Ranges of Snapshots . . . . . . . . . . . . . . . . . . . . . . . . . .
An Intelligent UNIX Script to Purge Snapshots . . . . . . . . . . . . . . .
Handy STATSPACK Shell Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A Quick Elapsed-Time STATSPACK Script . . . . . . . . . . . . . . . . . .
Monitoring STATSPACK Table Extents . . . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

35
36
37
38
40
41
41
41
43
43
45
45
47
47
48
50
50
50
51
51
54
59
59
65
67

4 Data Inside the STATSPACK Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


What Is Missing from STATSPACK? . . . . . . . . . . . . . . . . . . . . . . . . . . . .
STATSPACK Subordinate Table Structures . . . . . . . . . . . . . . . . . . . . . . .
STATSPACK Summary Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Changes in STATSPACK Tables for Oracle9i . . . . . . . . . . . . . . . .
The stats$latch_misses_summary Table . . . . . . . . . . . . . . . . . . . .
The stats$sgastat_summary Table (Oracle8i Only) . . . . . . . . . . . . .
The stats$sql_summary Table . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$parameter Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
STATSPACK System Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$rollstat Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$latch Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$latch_children Table . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$librarycache Table . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$waitstat Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$enqueuestat Table . . . . . . . . . . . . . . . . . . . . . . . . . . . .

69
70
70
71
71
74
75
77
79
80
80
82
83
83
84
85

D:\OMH\Oracle8\360-x\360xFM.vp
February 15, 2002 1:34:52 PM

ORACLE Series / Oracle9i High Performance Tuning with STATSPACK / Burleson / 222360-x / Front Matter
Blind Folio FM:ix

Color profile: Disabled


Composite Default screen

Contents

The stats$sysstat Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


The stats$sesstat Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$sgastat Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
STATSPACK Transaction Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$buffer_pool Table (Pre-Oracle9i Only) . . . . . . . . . . . . .
The stats$buffer_pool_statistics Table . . . . . . . . . . . . . . . . . . . . .
The stats$filestatxs Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
STATSPACK Event Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$system_event Table . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$session_event Table . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$bg_event_summary Table . . . . . . . . . . . . . . . . . . . . . .
The stats$idle_event Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Oracle Parallel Server Tables (Real Application Clusters) . . . . . . . . . . . .
The stats$rowcache_summary Table . . . . . . . . . . . . . . . . . . . . . .
The stats$sgaxs Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

87
89
90
91
91
92
94
95
96
98
99
100
100
101
101
102

PART II

Tuning the Oracle Database with STATSPACK


5 Extending STATSPACK to Collect Server Statistics . . . . . . . . . . . . . . . . . . . .
Overview of the vmstat Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dialect Differences in vmstat . . . . . . . . . . . . . . . . . . . . . . . . . . . .
What to Look for in vmstat . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Identifying CPU Bottlenecks with vmstat . . . . . . . . . . . . . . . . . . .
Identifying High CPU Usage with vmstat . . . . . . . . . . . . . . . . . . .
Identifying RAM Memory Bottlenecks . . . . . . . . . . . . . . . . . . . . .
Understanding UNIX RAM Memory Paging . . . . . . . . . . . . . . . . .
Capturing Server Performance Data Inside STATSPACK . . . . . . . . . . . . .
A Script to Capture vmstat Information . . . . . . . . . . . . . . . . . . . .
Internals of the vmstat Capture Script . . . . . . . . . . . . . . . . . . . . .
Reporting vmstat Information on Other Oracle Servers . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

105
106
107
108
109
112
112
112
119
119
123
124
125

6 Tuning the Server Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


The Relationship Between the Database Administrator
and the Systems Administrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Online Server Monitor Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using top to Monitor the Server . . . . . . . . . . . . . . . . . . . . . . . . . .
Using sar to Monitor Server Statistics . . . . . . . . . . . . . . . . . . . . . .
Monitoring Server CPU Consumption . . . . . . . . . . . . . . . . . . . . . . . . . .

127

D:\OMH\Oracle8\360-x\360xFM.vp
February 15, 2002 1:34:52 PM

129
129
129
130
132
135

ix

ORACLE Series / Oracle9i High Performance Tuning with STATSPACK / Burleson / 222360-x / Front Matter
Blind Folio FM:x

Color profile: Disabled


Composite Default screen

Oracle9i High Performance Tuning with STATSPACK

Upgrading an Entire Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Adding Additional CPU Processors . . . . . . . . . . . . . . . . . . . . . . .
Load Balancing of Server Tasks . . . . . . . . . . . . . . . . . . . . . . . . . .
Using nice and priocntl to Change Execution Priority . . . . . . . . .
Monitoring Server Memory Consumption . . . . . . . . . . . . . . . . . . . . . . . .
Server Memory Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Very Large Memory and Oracle . . . . . . . . . . . . . . . . . . . . . . . . .
Making Oracle Memory Nonswappable . . . . . . . . . . . . . . . . . . .
Reporting on Server Statistics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Server Exception Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Daily vmstat Trend Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Long-Term Server Analysis and Trending . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

136
137
137
141
143
144
144
145
146
146
150
154
154

7 Tuning the Network Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Optimizing Oracle NET Configuration . . . . . . . . . . . . . . . . . . . . . . . . . .
The tcp.nodelay Parameter in protocol.ora . . . . . . . . . . . . . . . . .
The automatic_ipc Parameter of sqlnet.ora . . . . . . . . . . . . . . . . .
SDU and TDU Parameters in tnsnames.ora . . . . . . . . . . . . . . . . .
The queuesize Parameter in listener.ora . . . . . . . . . . . . . . . . . . .
The break_poll_skip Parameter of sqlnet.ora . . . . . . . . . . . . . . . .
The disable_oob Parameter of sqlnet.ora . . . . . . . . . . . . . . . . . . .
The epc_disabled Environment Variable . . . . . . . . . . . . . . . . . . .
Other Oracle Features that Affect Network Behavior . . . . . . . . . . . . . . .
Using Array Fetches to Improve Network Throughput . . . . . . . . .
Using the Multi-Threaded Server . . . . . . . . . . . . . . . . . . . . . . . . .
Connection Pooling and Network Performance . . . . . . . . . . . . . .
ODBC and Network Performance . . . . . . . . . . . . . . . . . . . . . . . .
Tuning with Oracle Replication . . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring Network Performance from Oracle STATSPACK . . . . . . . . .
Tuning the Distributed Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using netstat to Monitor Network Activity . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

155
156
157
158
158
160
160
161
161
162
162
162
164
166
167
169
172
172
174

8 Tuning the Disk I/O Subsystem with STATSPACK . . . . . . . . . . . . . . . . . . . . .


Oracle Tuning Factors that Influence Disk I/O . . . . . . . . . . . . . . . . . . . .
Oracle Internals and Disk I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Oracle File Organization Techniques . . . . . . . . . . . . . . . . . . . . .
Transient Disk Hot Spots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mapping Oracle Disk Architectures . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Multiple RAM Buffer Issue . . . . . . . . . . . . . . . . . . . . . . . . . .
File Striping with Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using RAID with Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

175
177
178
178
180
186
187
188
189

D:\OMH\Oracle8\360-x\360xFM.vp
February 15, 2002 1:34:53 PM

ORACLE Series / Oracle9i High Performance Tuning with STATSPACK / Burleson / 222360-x / Front Matter
Blind Folio FM:xi

Color profile: Disabled


Composite Default screen

Contents

Using Oracle with Raw Devices . . . . . . . . . . . . . . . . . . . . . . . . .


Load Balancing Disks with Oracle Databases . . . . . . . . . . . . . . .
Configuring Oracle Tablespaces and Datafiles . . . . . . . . . . . . . .
Building the Oracle File-to-Disk Architecture . . . . . . . . . . . . . . .
Reporting on the Oracle Disk Architecture . . . . . . . . . . . . . . . . .
STATSPACK Reports for Oracle Datafiles . . . . . . . . . . . . . . . . . . . . . . . .
Detailed Disk and File I/O with STATSPACK . . . . . . . . . . . . . . . .
A STATSPACK Report on Specific I/O Activity . . . . . . . . . . . . . . .
A STATSPACK Script to Identify Hot Datafiles . . . . . . . . . . . . . . .
The Approach to Locating Hot Disks . . . . . . . . . . . . . . . . . . . . . .
Extending STATSPACK for Disk I/O Data . . . . . . . . . . . . . . . . . . . . . . . .
The Basic iostat Utility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Defining the STATSPACK Table . . . . . . . . . . . . . . . . . . . . . . . . . .
Capturing the iostat Information . . . . . . . . . . . . . . . . . . . . . . . . .
Generating iostat Reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Viewing I/O Signatures with STATSPACK . . . . . . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

190
191
191
194
195
196
203
204
206
207
208
208
210
211
213
217
222

PART III

Tuning the Oracle Database with STATSPACK


9 Tuning the Oracle Database Instance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
An Overview of the Oracle Database Instance . . . . . . . . . . . . . . . . . . . .
The Oracle SGA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Oracle Background Processes . . . . . . . . . . . . . . . . . . . . . . . . . . .
Blocksize and Oracle Disk I/O . . . . . . . . . . . . . . . . . . . . . . . . . .
The db_file_multiblock_read_count and Oracle . . . . . . . . . . . . .
Tuning the Oracle7 through Oracle8i Data Buffers . . . . . . . . . . . . . . . .
Introduction of Data Block Caching . . . . . . . . . . . . . . . . . . . . . .
Full Data Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Data Buffer Hit Ratio . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Data Buffer Pool Internals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring Data Buffer Pool Usage with STATSPACK . . . . . . . . .
Overview of the Oracle8i Data Pools . . . . . . . . . . . . . . . . . . . . .
Locating Tables and Indexes for the KEEP Pool . . . . . . . . . . . . . .
Tuning the RECYCLE Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Identifying Candidates for the RECYCLE Pool . . . . . . . . . . . . . . .
Trend Reports of the Data Buffer Hit Ratio with STATSPACK . . . . . . . . .
Tuning the Oracle9i Data Buffer Pools . . . . . . . . . . . . . . . . . . . . . . . . . .
The Seven Data Buffer Hit Ratios . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning the Oracle8.0 Database Writer Processes . . . . . . . . . . . . . . . . . .
Oracle 8.0 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

D:\OMH\Oracle8\360-x\360xFM.vp
February 15, 2002 1:34:53 PM

225
227
228
232
235
236
236
237
239
240
242
245
248
249
256
257
261
267
267
274
275

xi

ORACLE Series / Oracle9i High Performance Tuning with STATSPACK / Burleson / 222360-x / Front Matter
Blind Folio FM:xii

Color profile: Disabled


Composite Default screen

xii

Oracle9i High Performance Tuning with STATSPACK

Monitoring Database Writer Contention in Oracle8i and Oracle9i . . . . .


Tuning the Shared Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning the Library Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring the Library Cache Miss Ratio . . . . . . . . . . . . . . . . . . .
Monitoring Objects Within the Library Cache
with STATSPACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning the Dictionary Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning Oracle Sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning the Undo Records (Rollback Segments) . . . . . . . . . . . . . . . . . . .
Monitoring Dedicated Connections to Oracle . . . . . . . . . . . . . . . . . . . .
UNIX Interaction with the Multi-Threaded Server . . . . . . . . . . . . . . . . . .
Prerequisites for Using the MTS . . . . . . . . . . . . . . . . . . . . . . . . . .
Oracle9i Dynamic RAM and UNIX . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Oracle9i and UNIX Granules . . . . . . . . . . . . . . . . . . . . . . . . . . .
Changing Dynamic SGA and PGA Components . . . . . . . . . . . . .
Oracle9i PGA Memory Allocation for Dedicated Connections . . . . . . . .
Automatic RAM Memory Management in Oracle9i . . . . . . . . . . .
Moving Toward a Self-Tuning Oracle9i Database . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

282
285
292
293

10 Tuning Oracle Tables and Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Automatic Space Management in Oracle9i . . . . . . . . . . . . . . . . . . . . . .
The Evolution of Bitmaps in Oracle . . . . . . . . . . . . . . . . . . . . . . .
Oracle9i Freelists Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Characteristics of Bitmap Segment Management . . . . . . . . . . . . .
Oracle9i Freelist Internals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Oracle9i Tools for Automatic Space Management . . . . . . . . . . . .
Traditional Oracle Storage Parameters and Performance . . . . . . . . . . . .
The pctfree Storage Parameter . . . . . . . . . . . . . . . . . . . . . . . . . . .
The pctused Storage Parameter . . . . . . . . . . . . . . . . . . . . . . . . . .
The Freelists Storage Parameter . . . . . . . . . . . . . . . . . . . . . . . . . .
The Freelist Groups Storage Parameter for OPS . . . . . . . . . . . . . . .
Summary of Storage Parameter Rules . . . . . . . . . . . . . . . . . . . . .
Traditional Freelist Management and Oracle Objects . . . . . . . . . . . . . . .
Linking and Unlinking from the Freelists . . . . . . . . . . . . . . . . . . .
Reducing Freelist Relinks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Table Internals and Freelists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Long Data Columns and Freelist Behavior . . . . . . . . . . . . . . . . . .
Setting pctfree and pctused Based on Average Row Length . . . . . . . . . .
Buffer Busy Waits and Freelist Contention . . . . . . . . . . . . . . . . . . . . . . .
Using STATSPACK to Find Wait Contention . . . . . . . . . . . . . . . .
Finding Buffer Busy Waits with STATSPACK . . . . . . . . . . . . . . . .
Reorganizing Oracle Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using CTAS to Reorganize a Table . . . . . . . . . . . . . . . . . . . . . . .

353
354
355
356
357
358
362
365
365
366
367
367
367
369
370
372
373
375
377
378
379
382
390
392

D:\OMH\Oracle8\360-x\360xFM.vp
February 15, 2002 1:34:54 PM

294
299
305
312
316
319
320
329
331
333
334
334
342
351

ORACLE Series / Oracle9i High Performance Tuning with STATSPACK / Burleson / 222360-x / Front Matter
Blind Folio FM:xiii

Color profile: Disabled


Composite Default screen

Contents

Identifying Oracle Tables with Chained Rows . . . . . . . . . . . . . . . . . . . .


Identifying Tables with Long Rows . . . . . . . . . . . . . . . . . . . . . . .
Identifying Sparse Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Resequencing Oracle Table Rows for High Performance . . . . . . . . . . . .
Index Rebuilding Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
When to Rebuild Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Automating Index Rebuilds . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Identifying Unused Indexes in Oracle9i . . . . . . . . . . . . . . . . . . . . . . . . .
A Sample Index Monitoring Session . . . . . . . . . . . . . . . . . . . . . .
Tuning Index Contention with Hidden Parameters . . . . . . . . . . .
Monitoring Oracle Tables and Indexes with STATSPACK . . . . . . . . . . . .
Allocating the STATSPACK Extension Tables . . . . . . . . . . . . . . . .
Collecting the STATSPACK Snapshot for Tables and Indexes . . . .
Reports on Tables and Indexes . . . . . . . . . . . . . . . . . . . . . . . . . .
Distributing the Table Reports via E-mail . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

398
403
404
406
409
415
415
417
417
418
419
419
421
424
442
443

11 Tuning Oracle SQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Goals of SQL Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Problem of Declarative SQL Syntax . . . . . . . . . . . . . . . . . . . . . . . . .
The Oracle SQL Optimizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
optimizer_mode = RULE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
optimizer_mode = FIRST_ROWS . . . . . . . . . . . . . . . . . . . . . . . . .
optimizer_mode = ALL_ROWS . . . . . . . . . . . . . . . . . . . . . . . . . .
optimizer_mode = CHOOSE . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning with Rule-Based Optimization . . . . . . . . . . . . . . . . . . . . . . . . . .
Changing the Rule-Based Driving Table . . . . . . . . . . . . . . . . . . .
When the Rule-Based Optimizer Fails to Use
the Correct Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning with Cost-Based Optimization (CBO) . . . . . . . . . . . . . . . . . . . . .
Invoking the Cost-Based Optimizer . . . . . . . . . . . . . . . . . . . . . . .
Gathering Statistics for the CBO . . . . . . . . . . . . . . . . . . . . . . . . .
Determining the Default optimizer_mode . . . . . . . . . . . . . . . . . . . . . . .
Miscellaneous Tuning Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning with CBO SQL Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning SQL Subqueries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Problem of Literal SQL Statements . . . . . . . . . . . . . . . . . . . .
Using cursor_sharing in Oracle8i . . . . . . . . . . . . . . . . . . . . . . . .
Tuning SQL with Temporary Tables . . . . . . . . . . . . . . . . . . . . . .
Tuning SQL by Adding Indexes . . . . . . . . . . . . . . . . . . . . . . . . . .
General Rules for Writing Efficient SQL . . . . . . . . . . . . . . . . . . . .

445
446
447
449
449
449
449
450
453
453

D:\OMH\Oracle8\360-x\360xFM.vp
February 15, 2002 1:34:54 PM

454
456
458
458
460
461
462
462
463
466
467
468
469

xiii

ORACLE Series / Oracle9i High Performance Tuning with STATSPACK / Burleson / 222360-x / Front Matter
Blind Folio FM:xiv

Color profile: Disabled


Composite Default screen

xiv

Oracle9i High Performance Tuning with STATSPACK

The SQL Tuning Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Step 1: Identify High-Impact SQL in the Library Cache . . . . . . . .
Step 2: Extract and Explain the SQL Statement . . . . . . . . . . . . . . .
Step 3: Tune the SQL Statement . . . . . . . . . . . . . . . . . . . . . . . . .
An Actual Case-Study in SQL Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . .
Get the Full Table Scan Report . . . . . . . . . . . . . . . . . . . . . . . . . .
Advanced SQL Execution Plan Analysis . . . . . . . . . . . . . . . . . . . . . . . . .
Table Histograms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Making Permanent Changes to Tuned SQL . . . . . . . . . . . . . . . . . . . . . .
Using Stored Outlines for SQL . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the v$sql_plan and the v$sql_workarea Views . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

470
471
481
487
488
488
490
494
495
495
496
499

12 Tuning with Oracle Parallel Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Using Oracle Parallel Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Parallel Query Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Setting the Optimal Degree of Parallelism . . . . . . . . . . . . . . . . . .
Using Parallel Query Hints . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring Oracle Parallel Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Monitoring Oracle Parallel Query with STATSPACK . . . . . . . . . .
Monitoring Oracle Parallel Query with v$ Views . . . . . . . . . . . .
Parallel Queries and Distributed Objects . . . . . . . . . . . . . . . . . . .
Finding Candidate Tables for Oracle Parallel Query . . . . . . . . . .
Using Parallel DML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Turning On Parallel DML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Parallelizing Oracle Table Reorganizations . . . . . . . . . . . . . . . . .
Parallel Index Rebuilding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

501
503
504
505
509
511
511
512
513
514
516
516
517
518
519

13 Tuning the Oracle Parallel Server Environment . . . . . . . . . . . . . . . . . . . . . . . .


Introduction to Oracle Cluster Server Architecture . . . . . . . . . . . . . . . . .
Partitioning Data for RAC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Integrated Distributed Lock Manager (Oracle7
Through Oracle8i) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Configuring the IDLM within the Oracle8i OPS Environment . . .
Oracle Table Settings for OPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tuning the OPS Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
STATSPACK Tables for Monitoring OPS . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$rowcache_summary Table . . . . . . . . . . . . . . . . . . . . . .
The stats$sgaxs Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The stats$sysstat Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Extending STATSPACK for OPS Information . . . . . . . . . . . . . . . . . . . . . .
Querying the v$ Views for Oracle Parallel Server . . . . . . . . . . . . . . . . . .

521
522
525

D:\OMH\Oracle8\360-x\360xFM.vp
February 15, 2002 1:34:55 PM

526
527
529
532
534
534
535
535
537
540

ORACLE Series / Oracle9i High Performance Tuning with STATSPACK / Burleson / 222360-x / Front Matter
Blind Folio FM:xv

Color profile: Disabled


Composite Default screen

Contents

Comparing Real Application Clusters to Oracle Parallel Server . . . . . . . 543


Monitoring Transaction Application Failover in Oracle9i . . . . . . 545
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
PART PART IV

Database Reporting with STATSPACK


14 Monitoring Oracle with STATSPACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
The Standard STATSPACK Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introductory Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Wait Event Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
SQL Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Tablespace Activity Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Overview of the Alert Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Customized Exception Alert Reports for the DBA . . . . . . . . . . . . . . . . . .
Daily STATSPACK Alert Report . . . . . . . . . . . . . . . . . . . . . . . . . .
Daily Server Alert Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A Real-Time Check for Oracle Problems . . . . . . . . . . . . . . . . . . .
Weekly Object Growth Report . . . . . . . . . . . . . . . . . . . . . . . . . .
Trace Alert Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Web Server Alert Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Buffer Busy Waits Alerts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A STATSPACK Reactive Report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Scheduling and Customizing Oracle Alert Reports . . . . . . . . . . . . . . . . .
A Sample UNIX Crontab to Schedule Oracle Reports
and Alerts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

549
550
550
553
554
559
568
569
570
579
580
582
585
588
589
591
596

15 Trend Analysis with STATSPACK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


Plotting STATSPACK Data Using Microsoft Excel . . . . . . . . . . . . . . . . . .
Plotting STATSPACK Data with a Spreadsheet Chart Wizard . . . .
Step 1: Customize the STATSPACK Report . . . . . . . . . . . . . . . . .
Step 2: Run the Report in SQL*Plus . . . . . . . . . . . . . . . . . . . . . . .
Step 3: Highlight and Copy the Results . . . . . . . . . . . . . . . . . . . .
Step 4: Open Excel and Paste the Data . . . . . . . . . . . . . . . . . . . .
Step 5: Partition the Data into Columns . . . . . . . . . . . . . . . . . . . .
Step 6: Column Delimit the Data . . . . . . . . . . . . . . . . . . . . . . . . .
Step 7: Start the Chart Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step 8: Choose a Line Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Step 9: Complete the Chart Wizard and View the Chart . . . . . . .
Step 10: Add a Trend Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
STATSPACK Reports for Forecasting . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Basic STATSPACK Metrics for Trend Analysis . . . . . . . . . . . . . . .

599
600
600
601
603
603
604
604
604
606
606
606
608
609
609

D:\OMH\Oracle8\360-x\360xFM.vp
February 15, 2002 1:34:55 PM

596
597

xv

ORACLE Series / Oracle9i High Performance Tuning with STATSPACK / Burleson / 222360-x / Front Matter
Blind Folio FM:xvi

Color profile: Disabled


Composite Default screen

xvi

Oracle9i High Performance Tuning with STATSPACK

STATSPACK Extensions for Database Server Trend Analysis . . . .


Checking Server Trends by Hour . . . . . . . . . . . . . . . . . . . . . . . . .
Plotting Server Statistics by Day of the Week . . . . . . . . . . . . . . . .
Web-Based Plotting of STATSPACK Data . . . . . . . . . . . . . . . . . . . . . . . .
The RRDtool Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Other Web-Based Graphing Tools . . . . . . . . . . . . . . . . . . . . . . . .
The STATSPACK Viewer Product . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

610
613
616
617
617
618
620
625

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627

D:\OMH\Oracle8\360-x\360xFM.vp
February 15, 2002 1:34:55 PM

You might also like