<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=Oracle%2FDatabase%2FOracle_Statspack</id>
	<title>Oracle/Database/Oracle Statspack - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://aznot.com/index.php?action=history&amp;feed=atom&amp;title=Oracle%2FDatabase%2FOracle_Statspack"/>
	<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=Oracle/Database/Oracle_Statspack&amp;action=history"/>
	<updated>2026-05-09T00:12:26Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://aznot.com/index.php?title=Oracle/Database/Oracle_Statspack&amp;diff=2004&amp;oldid=prev</id>
		<title>Kenneth at 16:52, 15 April 2015</title>
		<link rel="alternate" type="text/html" href="https://aznot.com/index.php?title=Oracle/Database/Oracle_Statspack&amp;diff=2004&amp;oldid=prev"/>
		<updated>2015-04-15T16:52:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Oracle Statspack ==&lt;br /&gt;
&lt;br /&gt;
[http://www.orafaq.com/wiki/Statspack Statspack - Oracle FAQ]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Statspack&amp;#039;&amp;#039;&amp;#039; is a set of performance monitoring and reporting utilities provided by Oracle starting from [[Oracle 8i]] and above. Statspack provides improved BSTAT/ESTAT functionality, though the old BSTAT/ESTAT scripts are still available. For more information about STATSPACK, read the documentation in file $ORACLE_HOME/rdbms/admin/spdoc.txt.&lt;br /&gt;
&lt;br /&gt;
Note: Although AWR and ADDM (introduced in [[Oracle/Database/Oracle 10g]]) provide better statistics than STATSPACK, users that are not licensed to use the Enterprise Manager Diagnostic Pack should continue to use statspack.&lt;br /&gt;
&lt;br /&gt;
== Install statspack ==&lt;br /&gt;
 cd $ORACLE_HOME/rdbms/admin&lt;br /&gt;
 sqlplus &amp;quot;/ as sysdba&amp;quot; @spdrop.sql       -- Drop and install statspack&lt;br /&gt;
 sqlplus &amp;quot;/ as sysdba&amp;quot; @spcreate.sql     -- Enter [[tablespace]] names when prompted&lt;br /&gt;
&lt;br /&gt;
References:&lt;br /&gt;
* [http://www.dba-oracle.com/t_statspack_installation_steps.htm Oracle STATSPACK installation steps]&lt;br /&gt;
&lt;br /&gt;
== Take performance snapshots of the database ==&lt;br /&gt;
 sqlplus perfstat/perfstat&lt;br /&gt;
 exec statspack.snap;                    -- Take a performance snapshots &lt;br /&gt;
 -- or :&lt;br /&gt;
 exec perfstat.statspack.snap(i_snap_level=&amp;gt;10);  -- or instruct statspack to do gather more details in the snapshot &lt;br /&gt;
                                                  -- (look up which oracle version supports which level).&lt;br /&gt;
&lt;br /&gt;
The spauto.sql script can be customized and executed to schedule the collection of STATPACK snapshots.&lt;br /&gt;
&lt;br /&gt;
== Statspack reporting ==&lt;br /&gt;
 -- Get a list of snapshots&lt;br /&gt;
 select SNAP_ID, SNAP_TIME from STATS$SNAPSHOT; &lt;br /&gt;
  &lt;br /&gt;
 @spreport.sql                           -- Enter two snapshot id&amp;#039;s for difference report&lt;br /&gt;
&lt;br /&gt;
== Other statspack scripts ==&lt;br /&gt;
Some of the other statspack scripts are:&lt;br /&gt;
* sppurge.sql - Purge (delete) a range of Snapshot Id&amp;#039;s between the specified begin and end Snap Id&amp;#039;s &lt;br /&gt;
* spauto.sql - Schedule a [[DBMS JOB|dbms_job]] to automate the collection of STATPACK statistics&lt;br /&gt;
* spcreate.sql - Installs the STATSPACK user, tables and package on a database (Run as SYS).&lt;br /&gt;
* spdrop.sql - Deinstall STATSPACK from database (Run as SYS)&lt;br /&gt;
* spreport.sql - Report on differences between values recorded in two snapshots&lt;br /&gt;
* sptrunc.sql - Truncates all data in Statspack tables&lt;br /&gt;
&lt;br /&gt;
==Potential problems==&lt;br /&gt;
Statpack reporting suffers from the following problems:&lt;br /&gt;
&lt;br /&gt;
* Some statistics may only be reported on COMPLETION of a query. For example, if a query runs for 12 hours, its processing won&amp;#039;t be reported during any of the snapshots taken while the query was busy executing.&lt;br /&gt;
&lt;br /&gt;
* If queries are aged out of the shared pool, the stats from V$SQL are reset. This can throw off the delta calculations and even make it negative. For example, query A has 10,000 &amp;#039;&amp;#039;buffer_gets&amp;#039;&amp;#039; at snapshot 1, but at snapshot #2, it has been aged out of the pool and reloaded and now shows only 1,000 &amp;#039;&amp;#039;buffer_gets&amp;#039;&amp;#039;. So, when you run &amp;#039;&amp;#039;spreport.sql&amp;#039;&amp;#039; from snapshot 1 to 2, you&amp;#039;ll get 1,000-10,000 = -9,000 for this query.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
Source: [http://www.orafaq.com/wiki/Statspack Statspack - Oracle FAQ]&lt;br /&gt;
&lt;br /&gt;
== Resources ==&lt;br /&gt;
&lt;br /&gt;
* [http://www.oraperf.com/ OraPerf.com], upload your STATSPACK file to get performance recommendations.&lt;br /&gt;
* [http://www.spviewer.com www.spviewer.com], website with software tools for Oracle tuning based on statspack and AWR.&lt;br /&gt;
* [http://www.statspackanalyzer.com statspackanalyzer.com] - website that can analyze statspack reports.&lt;br /&gt;
&lt;br /&gt;
== keywords ==&lt;br /&gt;
&lt;br /&gt;
Oracle Statspack&lt;br /&gt;
&lt;br /&gt;
[[Category:Oracle]]&lt;/div&gt;</summary>
		<author><name>Kenneth</name></author>
	</entry>
</feed>