Anar Godajev http://anargodjaev.wordpress.

com/
Statspack Reports /* When installing the Statspack package, you can either change to the ORACLE_HOME/rdbms/admin directory, or fully specify the ORACLE_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 variable snap NUMBER; BEGIN snap := statspack.snap; dbms_output.put_line(snap); END;

SPREPSQL.snap parameters EXECUTE STATSPACK.SQL. SQL> @?/rdbms/ADMIN/sprepsql -.Purge unnecessary data by using the SPPURGE. The SQL report.A sample script on how to do this is supplied in SPAUTO. EXECUTE STATSPACK.SQL -.drops the user */ -. information on any SQL plan(s) associated with that statement.remove statspack SQL> CONNECT / AS SYSDBA SQL> @?/rdbms/ADMIN/spdrop /* SPDTAB. you often find high-load SQL statements that you want to examine more closely. 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 .SQL .SNAP(i_ucomment=>'this is a temporary commment'). displays statistics.SQL script SQL> CONNECT perfstat/my_perfstat_password SQL> SET TRANSACTION USE ROLLBACK SEGMENT rbig.MODIFY_STATSPACK_PARAMETER(i_ucomment=>'this is a commment that is saved').automatic statspac -.SNAP(i_snap_level=>10.truncate all statspack data SQL> CONNECT perfstat/my_perfstat_password SQL> @?/rdbms/ADMIN/sptrunc -. EXECUTE STATSPACK. EXECUTE STATSPACK.com/ -.SQL .SNAP(i_snap_level=>6). SQL> @?/rdbms/admin/spurge SQL> SQL> SQL> SQL> CONNECT perfstat/my_perfstat_password DEFINE losnapid=1 DEFINE hisnapid=2 @?/rdbms/admin/spurge -. */ SQL> CONNECT perfstat/my_perfstat_password Connected.create statspack report without prompt SQL> SQL> SQL> SQL> SQL> CONNECT perfstat/my_perfstat_password define begin_snap=1 define end_snap=2 define report_name=batch_run @?/rdbms/ADMIN/spreport /* When you examine the instance report.drops tables and public synonyms SPDUSR. the complete SQL text. i_modify_parameter=>'true'). and (if a level six snapshot has been taken).wordpress.Anar Godajev http://anargodjaev.

com/ Levels >= 10 Additional STATISTICS: Parent AND Child Latches .Anar Godajev http://anargodjaev.wordpress.