Statspack Reports
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Statspack Reports

on

  • 6,422 views

 

Statistics

Views

Total Views
6,422
Views on SlideShare
559
Embed Views
5,863

Actions

Likes
0
Downloads
11
Comments
0

3 Embeds 5,863

http://anargodjaev.wordpress.com 5842
https://anargodjaev.wordpress.com 15
http://prlog.ru 6

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Statspack Reports Document Transcript

  • 1. Anar Godajev http://anargodjaev.wordpress.com/ Statspack Reports /* When installing the Statspack package, you can either change to theORACLE_HOME/rdbms/admin directory, or fully specify theORACLE_HOME/rdbms/admin DIRECTORY WHEN calling the installation script, SPCREATE.SQL. */ -- install statspack @?/rdbms/ADMIN/spcreate /* Enter appropriate information when prompted for the PERFSTAT user's password, default tablespace, and temporary tablespace. The SPCREATE.SQL install script runs the following scripts automatically: */ /* SPCUSR.SQL: Creates the user and grants privileges SPCTAB.SQL: Creates the tables SPCPKG.SQL: Creates the package */ -- To install without prompting SQL> CONNECT / AS SYSDBA SQL> define default_tablespace='TOOLS' SQL> define temporary_tablespace='TEMP' SQL> define perfstat_password='my_perfstat_password' SQL>@?/rdbms/ADMIN/spcreate /* -- automatic collection of statistics oracle_home/rdbms/admin/spauto.sql */ -- executing statspack SQL> CONNECT perfstat/my_perfstat_password SQL> EXECUTE statspack.snap; -- For better performance analysis, set the initialization parameter TIMED_STATISTICS to TRUE. -- Statspack will then include important timing information in the data it collects. -- create statspack report SQL> CONNECT perfstat/my_perfstat_password SQL>@?/rdbms/ADMIN/spreport -- statspack in a pl/sql block DECLARE variablesnap NUMBER; BEGIN snap:= statspack.snap; dbms_output.put_line(snap); END;
  • 2. Anar Godajev http://anargodjaev.wordpress.com/ -- automaticstatspac -- A sample script on how to do this is supplied in SPAUTO.SQL -- create statspack report without prompt SQL> CONNECT perfstat/my_perfstat_password SQL> define begin_snap=1 SQL> define end_snap=2 SQL> define report_name=batch_run SQL>@?/rdbms/ADMIN/spreport /* When you examine the instance report, you often find high-load SQL statements that you want to examine more closely. The SQL report, SPREPSQL.SQL, displays statistics, the complete SQL text, and (if a level six snapshot has been taken), information on any SQL plan(s) associated with that statement. */ SQL> CONNECT perfstat/my_perfstat_password Connected. SQL>@?/rdbms/ADMIN/sprepsql -- truncate all statspack data SQL> CONNECT perfstat/my_perfstat_password SQL>@?/rdbms/ADMIN/sptrunc -- remove statspack SQL> CONNECT / AS SYSDBA SQL>@?/rdbms/ADMIN/spdrop /* SPDTAB.SQL - drops tables and public synonyms SPDUSR.SQL - drops the user */ -- Purge unnecessary data by using the SPPURGE.SQL script SQL> CONNECT perfstat/my_perfstat_password SQL> SET TRANSACTION USE ROLLBACK SEGMENT rbig; SQL>@?/rdbms/admin/spurge SQL> CONNECT perfstat/my_perfstat_password SQL> DEFINE losnapid=1 SQL> DEFINE hisnapid=2 SQL>@?/rdbms/admin/spurge -- snap parameters EXECUTE STATSPACK.SNAP(i_ucomment=>'this is a temporary commment'); EXECUTE STATSPACK.MODIFY_STATSPACK_PARAMETER(i_ucomment=>'this is a commment that is saved'); EXECUTE STATSPACK.SNAP(i_snap_level=>10, i_modify_parameter=>'true'); EXECUTE STATSPACK.SNAP(i_snap_level=>6); Levels Levels Levels Levels >= >= >= >= 0 5 6 7 General Performance STATISTICS Additional Data: SQL Statements Additional Data: SQL Plans AND SQL PLAN Usage Additional data: SEGMENT LEVEL STATISTICS
  • 3. Anar Godajev http://anargodjaev.wordpress.com/ Levels >= 10 Additional STATISTICS: Parent AND Child Latches