STATSPACK 101 - introduction
Lundi 23 juin 2008More articles to come on this subject, this is just a small introduction.
To effectively perform reactive tuning, it is vital to have an established baseline for later comparison when the system is running poorly. Without a baseline data point, it becomes very difficult to identify what a new problem is attributable to: Has the volume of transactions on the system increased? Has the transaction profile or application changed? Has the
number of users increased?
Statspack fundamentally differs from the well known UTLBSTAT/UTLESTAT tning scripts by collecting more information, and also by storing the performance statistics permanently in Oracle tables, which can later be used for reporting and analysis. The data collected can be analyzed using the report provided, which includes an ‘instance health and load’ summary page, high resource SQL statements, as well as the traditional wait events and initialization parameters.
Statspack improves on the existing UTLBSTAT/UTLESTAT performance scripts in the following ways:
- Statspack collects more data, including high resource SQL (and the optimizer execution plans for those statements)
- Statspack pre-calculates many ratios useful when performance tuning, such as cache hit ratios, per transaction and per
second statistics (many of these ratios must be calculated manually when using BSTAT/ESTAT)
- Permanent tables owned by PERFSTAT store performance statistics; instead of creating/dropping tables each time, data is inserted into the pre-existing tables. This makes historical data comparisons easier
- Statspack separates the data collection from the report generation. Data is collected when a ’snapshot’ is taken; viewing the data collected is in the hands of the performance engineer when he/she runs the performance report
- Data collection is easy to automate using either dbms_job or an OS utility
NOTE: The term ’snapshot’ is used to denote a set of statistics gathered at a single time, identified by a unique Id which includes the snapshot number (or snap_id). This term should not be confused with Oracle’s Snapshot Replication technology.
How does Statspack work?
Statspack is a set of SQL, PL/SQL and SQL*Plus scripts which allow the collection, automation, storage and viewing of performance data. A user is automatically created by the installation script - this user, PERFSTAT, owns all objects needed by this package. This user is granted limited query-only privileges on the V$views required for performance tuning.
Statspack users will become familiar with the concept of a ’snapshot’. ’snapshot’ is the term used to identify a single collection of performance data. Each snapshot taken is identified by a ’snapshot id’ which is a unique number generated at the time the snapshot is taken; each time a new collection is taken, a new snap_id is generated.
The snap_id, along with the database identifier (dbid) and instance number (instance_number) comprise the unique key for a snapshot (using this unique combination allows storage of multiple instances of a Clustered database in the same tables).
Once snapshots are taken, it is possible to run the performance report. The performance report will prompt for the two snapshot id’s the report will process. The report produced calculates the activity on the instance between the two snapshot periods specified, in a similar way to the BSTAT/ESTAT report; to compare - the first snap_id supplied can be considered the equivalent of running BSTAT; the second snap_id specified can be considered the equivalent of ESTAT. Unlike BSTAT/ESTAT which can by its nature only compare two static data points, the report can compare any two snapshots specified.




Index du Blog














