-- Create statspack (in SQLPlus as sys)
sqlplus /nolog
connect internal
@?/rdbms/admin/spdrop
@?/rdbms/admin/spcreate
-- Start a snapshot
sqlplus perfstat/perfstat
execute statspack.snap
-- End snapshot
connect perfstat/perfstat
execute statspack.snap
-- List snapshots
select SNAP_ID, to_char(SNAP_TIME,'YYYY-MM-DD HH24:MI:SS') from STATS$SNAPSHOT;
-- Generate a report
cd to the directory where you want the report written to
sqlplus perfstat/perfstat
@?/rdbms/admin/spreport
At this point, you'll be prompted for a start snapid, an end snapid and a report name
-- The statspack scripts
sppurge.sql - Purge a range of Snapshot Id's between the specified begin and end Snap Id's
spauto.sql - Schedule a dbms_job to automate the collection of STATPACK statistics
spcreate.sql - Installs the STATSPACK user, tables and package on a database (Run as SYS).
spdrop.sql - Deinstall STATSPACK from database (Run as SYS)
sppurge.sql - Delete a range of Snapshot Id's from the database
spreport.sql - Report on differences between values recorded in two snapshots
sptrunc.sql - Truncates all data in Statspack tables
|