You are on page 1of 4

Tools Available for Oracle Performance

Tuning
The tools available to help you diagnose and resolve performance issues depend to a certain
extent on the version of the database you are using. Oracle 10g and upwards have more
tools available than earlier versions. In general the tools available include:

explain plan / DBMS_XPLAN package

SQL trace

TKPROF

DBMS_STATS, DBMS_SPM and DBMS_OUTLN packages

Automatic Workload Repository (AWR)

Automatic Database Diagnostic Monitor (ADDM)

Explain Plan / DBMS_XPLAN


When faced with an SQL statement that you suspect could be improved, before changing it
you need to know what it's current execution plan is. This can be achieved by preceding the
statement with the explain plan clause and then running it. This writes
thepredicted execution plan that the statement would use if it were to be run into the plan
table from where it can be retrieved by calling DBMS_XPLAN.DISPLAY.
As the predicted execution plan may not be entirely accurate you can determine the actual
execution plan of the statement after it has been run by
using DBMS_XPLAN.DISPLAY_CURSOR.
Often this is the only tool required for Oracle performance tuning as most problems are due
to SQL statements that are not using the optimal path to access the data.

SQL Trace
SQL trace is an Oracle database facility that provides individual performance information
about SQL statements either at the instance or session level.
The information gathered about SQL statements comprises:

Parse, execute, and fetch counts

CPU and elapsed times

Physical reads and logical reads

Number of rows processed

Misses on the library cache

Username under which each parse occurred

Each commit and rollback

Wait event data for each SQL statement, and a summary for each trace file

If the statement's cursor is closed, row source information is also provided including:

The actual execution plan of each SQL statement

Number of rows, number of consistent reads, number of physical reads, number of


physical writes, and time elapsed for each operation on a row

TKPROF
TKPROF is a program that is run against
Oracle trace files to format them and generate
a readable output. It can also:

display the actual execution plan of a


statement

create a SQL script that stores


statistics in the database

DBMS_STATS package
The DBMS_STATS package provides a number
of routines for generating and manipulating
statistics on tables and indexes in the
database. These statistics are then used by
the Oracle cost-based optimizer when
determining the optimal execution plan for
SQL statements.

DBMS_SPM
This package enables you to manage SQL
execution plans to ensure that the plan and
therefore the performance of the
corresponding SQL statements are unchanged
irrespective of any changes to the system
such as more data, a new version of the
Oracle database, or new applications.

DBMS_OUTLN
This package enables the management of
stored outlines (stored data for an an
execution plan for a specific SQL statement)
in the Oracle database. It enables the
Oracle optimizer to re-create an execution plan equivalent to the original plan. In future
releases of Oracle this will be deprecated in favour of SQL plan management (DBMS_SPM).

Automatic Workload Repository (AWR)


Introduced with Oracle 10g, AWR helps with Oracle performance tuning by collecting,
processing and maintaining performance information which can be displayed in reports
and/or views.

Automatic Database Diagnostic Monitor (ADDM)


This analyzes the data collected by AWR to identify any performance issues and provides
recommendations to correct problems.
More information on these tools can be found in the Oracle Database Performance Tuning
Guide available from the Oracle Technology Network.