Tracing session activity is the most SQL performance tuning exercise. Oracle provides various tools to trace SQL activity. Oracle SQL trace utility is most commonly used utility. We also use OEM Grid Control, Toad and other Oracle/ Third party tools to trace the SQL activity.
Oracle Provides numerous "events" that help you perform various types of traces. Although there are several tracing methods available, Oracle now recommends DBMS_MONITOR package for most types of tracing. Oracle also provides the TKPROF utility and Oracle Trace Analyzer to analyze the raw trace files. You need to set/prepare your environment before starting any trace activity. 1. Enable times statistics collection (set the timed_statistics parameter to TRUE) SQL> show parameter statistics NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ optimizer_use_pending_statistics boolean FALSE statistics_level string TYPICAL timed_os_statistics integer 0 timed_statistics boolean TRUE IF timed_statistics parameter is set to false then, SQL> alter system set timed_statistics =TRUE; 2. Specify destination of the trace file. SQL> select name,value from v$diag_info where name='Diag Trace'; NAME ---------------------------------------------------------------- VALUE -------------------------------------------------------------------------------- Diag Trace /u01/app/oracle/diag/rdbms/testdb/testdb/trace 3. Adjust the trace dump file size SQL> show parameter dump NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ background_core_dump string partial background_dump_dest string /u01/app/oracle/diag/rdbms/tes tdb/testdb/trace core_dump_dest string /u01/app/oracle/diag/rdbms/tes tdb/testdb/cdump max_dump_file_size string unlimited shadow_core_dump string partial user_dump_dest string /u01/app/oracle/diag/rdbms/tes tdb/testdb/trace SQL> |