How to use Statspack to Create Report in Oracle

Posted By  Nimish Garg On 18 Feb 2011 19:02:14
emailbookmarkadd commentsprint
No of Views:602
Bookmarked:0 times
Votes:0 times

Introduction

The Statspack is a set of performance monitoring and reporting utilities provided by Oracle starting from Oracle 8i and above. When you run the Statspack installation script, the PERFSTAT user is created automatically.

PERFSTAT owns all objects needed by the Statspack package
Note: All sql scripts are store in $ORACLE_HOME/rdbms/admin

Let's start to create.

Install statspack

cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
@spcreate

schedule an hourly snapshot

cd $ORACLE_HOME/rdbms/admin
sqlplus perfstat/perfstat
@spauto.sql

To take a snapshot manually

cd $ORACLE_HOME/rdbms/admin
sqlplus perfstat/perfstat
exec statspack.snap;

Or

exec statspack.snap(i_snap_level => 6, i_modify_parameter => 'true');

To generate statspack report

cd $ORACLE_HOME/rdbms/admin
sqlplus perfstat/perfstat
@spreport.sql

To delete snapshots

cd $ORACLE_HOME/rdbms/admin
sqlplus perfstat/perfstat
@sppurge;

To list all generated snapshot

cd $ORACLE_HOME/rdbms/admin
sqlplus perfstat/perfstat
select   
    snap_id,      
    snap_level,   
    to_char(snap_time,'HH24:MI:SS DD-MM-YYYY') "Snap_Time"
from   
    stats$snapshot,   
    v$database
order by
    snap_id
/

To uninstall statspack

cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
@spdrop

That's all.hopes help.

Sign Up to vote for this article
Other popular Tips/Tricks
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top