|
Oracle Home |
|
Home > Oracle Database Administration (DBA) > Database Tuning > Statspack Utility |
|
Oracle Database 10g Administration (DBA): Database Tuning |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
Statspack Utility |
||||||||||||
|
STATSPACK is a performance diagnosis tool, available
since Oracle8i: Oracle 8.1.6 introduced statspack as a replacement for
the
Installing and Configuring STATSPACK
1. Connect to the database as sysdba (and create the PERFSTAT user (statspack owner) if the user doesn't exit):
a) sqlplus /nolog; b) connect / as sysdba c) create the PERFSTAT user if it is not created
2. Set the default tablespaces (the tablespaces must exist if not must be created):
a) define default_tablespace = 'TOOLS' b) define temporary_tablespace = 'TEMP'
3. Run the spcreate script:
@?/rdbms/admin/spcreate
4. Set timed_statistics to true:
ALTER SYSTEM SET timed_statistics = true; or
5. Set the "level" statspack parameter (In this example the "level" parameter is set to 6):
exec statspack.snap(i_snap_level => 6, i_modify_parameter => 'true');
Select the STATSPACK Collection Level
When the snapshots are taken, the collected information is in function of the statspack settings (the level parameter controls the type of data collected). Here is a table which show the information which is collected in function of the "level" statspack parameter:
To see the current statspack level we can use the following select: SELECT * FROM stats$level_description ORDER BY snap_level;
The snapshots could be taken every 30 minutes, but the interval is fixed in function of the needs and database usage. For this purpose we can use the statspack.snap procedure:
exec statspack.snap; (for the database) OR execute statspack.snap(i_session_id=>13); (for a particular session, in this case SID = 13)
1. To generate a report for the database: @?/rdbms/admin/spreport.sql
We have to provide at the prompt: BEGIN_SNAP, END_SNAP, REPORT_NAME (we can use a default value as well)
2. To generate a report for a particular statement: @?/rdbms/admin/sprepsql.sql
We have to provide at the prompt: BEGIN_SNAP, END_SNAP, Hash_Value, REPORT_NAME (we can use a default value as well)
NOTE: The reports could be run in batch by providing the responses before the execution of the reports. Here is an example: Connected as perfstat run:
define begin_snap=10
1. View snapshot details in the current database:
SELECT FROM stats$snapshot,v$database;
2. Gather statistics on PERFSTAT schema to create reports faster:
execute dbms_stats.gather_schema_stats('PERFSTAT', DBMS_STATS.AUTO_SAMPLE_SIZE);
3. Delete old snapshot:
@?/rdbms/admin/sppurge; (after that Enter
the Lower and Upper Snapshot ID
More information about this subject ( Statspack Utility ) you can get from www.in-oracle.com
Top 5 Wait Events
More information you get get from here as well.
|
|
Home > Oracle Database Administration (DBA) > Database Tuning > Statspack Utility |
|
Different Romanian Links/ Linkuri romanesti diferite |
Disclaimer: The views expressed on this web site are my own and do not reflect the views of Oracle Corporation. You may use the information from this site only at your risk. Copyright (c) 2009-2011 Paul Catalin Tomoiu. All rights reserved.