Professional Documents
Culture Documents
This note is intended to provide information about the steps required to take a
StatsPack snapshot of current database performance levels and how to capture
different granularities of performance information at both the instance and
session levels. This note also discusses how to automate the process of
capturing a StatsPack snapshot. These snapshots can be used as a starting or
ending point for generating a performance summary.
This note is applicable for Oracle RDBMS releases 8.1.6 and greater, and is
related to the task of gathering database and session level performance
information by using the StatsPack package. This note assumes that the
StatsPack package has already been loaded into the database. This process is
described in Note 149113.1: "Installing and Configuring StatsPack Package".
e.g.
SQL> connect perfstat/perfstat
SQL> execute statspack.snap;
Note: In an OPS environment, you must connect to the instance you wish to
collect data for. A snapshot must be taken on each instance so that later
comparisons can be made. A snapshot taken on one instance can only be
compared to another snapshot taken on the same instance.
Although statistics are cumulative ,this will store the current values for the
performance statistics in the StatsPack schema tables, and can be used as a
baseline snapshot for comparison with another snapshot taken at a later time.
===========================================================================
== Range of Default
Parameter Name Valid Values Value Meaning
===========================================================================
==
i_snap_level 0, 5, 6, 10 5 Snapshot Level
*Level 6 NOT VALID in 8i
*Level 7 is available in 9.2
------------------------------------------------------------------------------
i_ucomment Text Blank Comment to be stored with Snapshot
------------------------------------------------------------------------------
i_executions_th Integer >=0 100 SQL Threshold: number of times
the statement was executed
------------------------------------------------------------------------------
i_disk_reads_th Integer >=0 1,000 SQL Threshold: number of disk reads
the statement made
------------------------------------------------------------------------------
i_parse_calls_th Integer >=0 1,000 SQL Threshold: number of parse
calls the statement made
------------------------------------------------------------------------------
i_buffer_gets_th Integer >=0 10,000 SQL Threshold: number of buffer
gets the statement made
------------------------------------------------------------------------------
i_session_id Valid sid 0 (no Session Id of the Oracle Session
from session) to capture session granular
v$session statistics for
------------------------------------------------------------------------------
i_modify_parameter True, False False Save the parameters specified for
future snapshots?
===========================================================================
==
- Snapshot Level
SQL 'Thresholds'
The SQL statements gathered by Statspack are those which exceed one of
four predefined threshold parameters:
- number of executions of the SQL statement (default 100)
- number of disk reads performed by the SQL statement (default 1,000)
- number of parse calls performed by the SQL statement (default 1,000)
- number of buffer gets performed by the SQL statement (default 10,000)
The SQL threshold levels used are either those stored in the table
stats$statspack_parameter, or by the thresholds specified when
the snapshot is taken.
Levels = 6
This level includes all statistics gathered in the lower level(s).
Additionally, it gathers SQL plans and plan usage data for each of the
high resource usage SQL statements captured. Therefore, level 6 snapshots
should be used whenever there is the possibility that a plan may change.
To gather the plan for a SQL statement, the statement must be in the shared
pool at the time the snapshot is taken, and it must exceed one of the SQL
thresholds. To gather plans for all statements in the shared pool, specify
the executions threshold to be zero (0) for those snapshots.
There are other parameters which can be configured in addition to the level.
These parameters are used as thresholds when collecting SQL statements;
if any SQL statements breach the threshold, these are the statements which
are captured during the snapshot.
- Changing the default values for Snapshot Level and SQL Thresholds
- Specifying a Session Id
- Within the database, using the Oracle dbms_job procedure to schedule the
snapshots
e.g.
execute dbms_job.interval(<job number>,'SYSDATE+(1/48)');
Where 'SYSDATE+(1/48)' will result in the statistics being gathered each 1/48
hours (i.e. every half hour).
For more information on dbms_job, see the Supplied Packages Reference Manual.
RELATED DOCUMENTS
-----------------
Note 94224.1 - FAQ - STATSPACK COMPLETE REFERENCE
Note 149113.1 - "Installing and Configuring StatsPack Package"
Note 30824.1 - "Init.ora Parameter "TIMED_STATISTICS" Reference Note"