Trace

7
Oracle TKPROF & SQL_TRACE Version 10.2 General Information Note: Use "dbms_monitor.session_trace_enable()" instead of "alter session set events ..." and you will see the columns sys.gv_$session updated Event Numbering Range 10000 - 10999 Event Definitions Event # Level Description 8186 - ALTER SESSION SET EVENTS '8186 trace name context OFF' - VERSIONS BETWEEN query 10013 1 Monitor Transaction Recovery 10015 1 Dump Undo Segment Headers 10015 3 Identify corrupt undo segments 10032 4 Dump Sort Statistics 10032 10 Dump Sort Statistics 10033 4 Dump Sort Large Run Statistics (blocks dumped to disk and read back) - poss. no levels. 10033 10 Dump Sort Intermediate Run Statistics 10045 1 Trace Free List Management Operations 10046 0 No statistics generated 10046 1 Standard trace output including parsing, executes and fetches plus more 10046 2 Same as Level 1 10046 4 Level 1 + Bind Variables 10046 8 Level 1 + Waits 10046 12 Level 1 + Bind Variables & Waits 10053 1 Dump Optimizer Statistics and Computations 10053 2 Dump Optimizer Computations only 10060 1 10060 - Dump Predicates * 10065 1 Restrict Library Cache Output for State Object Dumps - Library Objects Only 10065 2 Restrict Library Cache Output for State Object Dumps + library object lock details 10065 3 Restrict Library Cache Output for State Object Dumps + library object handle and library object 10079 2 Dump SQL*Net Statistics 10081 1 Dump High Water Mark Changes 10104 10 Dump Hash Join Statistics 10128 0x0001 Dump Partition Pruning Information * 10128 0x0002 Dump partition iterators 10128 0x0004 Dump optimizer decisions about partition-wise joins 10128 0x0008 Dump ROWID range scan pruning information 10132 12 Dumps SQL statements into UDUMP along with the actual execution plan 10200 1 Dump Consistent Reads 10201 1 Dump Consistent Read Undo Application 10210 10 Table Integrity Check 10211 10 Index Integrity Check 10220 1 Dump Changes to Undo Header 10221 7 Dump Undo Changes Página 1 de 7 Oracle TKPROF & SQLTRACE Trace Plustrace 14/9/2007 http://www.psoug.org/reference/trace_tkprof.html

description

Oracle Trace

Transcript of Trace

  • Oracle TKPROF & SQL_TRACE Version 10.2

    General InformationNote: Use "dbms_monitor.session_trace_enable()" instead of "alter session set events ..." and you will see the columns sys.gv_$session updatedEvent Numbering Range 10000 - 10999

    Event DefinitionsEvent # Level Description8186 - ALTER SESSION SET EVENTS '8186 trace name context OFF' - VERSIONS BETWEEN query 10013 1 Monitor Transaction Recovery10015 1 Dump Undo Segment Headers10015 3 Identify corrupt undo segments10032 4 Dump Sort Statistics10032 10 Dump Sort Statistics

    10033 4 Dump Sort Large Run Statistics (blocks dumped to disk and read back) - poss. no levels.

    10033 10 Dump Sort Intermediate Run Statistics10045 1 Trace Free List Management Operations10046 0 No statistics generated

    10046 1 Standard trace output including parsing, executes and fetches plus more10046 2 Same as Level 110046 4 Level 1 + Bind Variables10046 8 Level 1 + Waits10046 12 Level 1 + Bind Variables & Waits10053 1 Dump Optimizer Statistics and Computations10053 2 Dump Optimizer Computations only10060 1 10060 - Dump Predicates *

    10065 1 Restrict Library Cache Output for State Object Dumps - Library Objects Only10065 2 Restrict Library Cache Output for State Object Dumps + library object lock details10065 3 Restrict Library Cache Output for State Object Dumps + library object handle and library object10079 2 Dump SQL*Net Statistics10081 1 Dump High Water Mark Changes10104 10 Dump Hash Join Statistics101280x0001 Dump Partition Pruning Information *101280x0002 Dump partition iterators101280x0004 Dump optimizer decisions about partition-wise joins101280x0008 Dump ROWID range scan pruning information

    10132 12 Dumps SQL statements into UDUMP along with the actual execution plan

    10200 1 Dump Consistent Reads10201 1 Dump Consistent Read Undo Application10210 10 Table Integrity Check10211 10 Index Integrity Check10220 1 Dump Changes to Undo Header10221 7 Dump Undo Changes

    Pgina 1 de 7Oracle TKPROF & SQLTRACE Trace Plustrace

    14/9/2007http://www.psoug.org/reference/trace_tkprof.html

  • 10224 1 Dump Index Block Splits / Deletes10225 1 Dump Changes to Dictionary Managed Extents

    10231 10 Causes full table scans to skip corrupt blocks, rather than fail with an ORA-1578 error10232 10 Causes corrupt blocks to be dumped to the process trace file10233 10 Traces memory usage statistics

    10235 1 Check memory manager internal structures (use with ORA-600/ORA-7445 errors)10241 1 Dump Remote SQL Execution10246 1 Trace PMON Process10248 10 Trace Dispatcher Processes10249 10 Trace Shared Server (MTS) Processes10270 10 Debug Shared Cursors10289 1 Dump a database block in hexadecimal10299 1 Debug Prefetch10357 1 Debug Direct Path

    103900x0001 Dump Parallel Execution Slave Statistics - Slave-side execution messages

    103900x0002 Dump Parallel Execution Slave Statistics - Coordinator-side execution messages

    103900x0004 Dump Parallel Execution Slave Statistics - Slave context state changes

    103900x0008 Dump Parallel Execution Slave Statistics - Slave ROWID range bind variables and xty

    103900x0010 Dump Parallel Execution Slave Statistics - Slave fetched rows as enqueued to TQ

    103900x0020 Dump Parallel Execution Slave Statistics - Coordinator wait reply handling

    103900x0040 Dump Parallel Execution Slave Statistics - Coordinator wait message buffering

    103900x0080 Dump Parallel Execution Slave Statistics - Slave dump timing103900x0100 Dump Parallel Execution Slave Statistics - Coordinator dump timing103900x0200 Dump Parallel Execution Slave Statistics - Slave dump

    allocation file number103900x0400 Dump Parallel Execution Slave Statistics - Terse format for debug dumps103900x0800 Dump Parallel Execution Slave Statistics - Trace CRI

    random sampling103900x1000 Dump Parallel Execution Slave Statistics - Trace signals

    103900x2000 Dump Parallel Execution Slave Statistics - Trace parallel execution granule operations

    103900x4000 Dump Parallel Execution Slave Statistics - Force compilation by slave 0

    103910x0001 Dump Parallel Execution Granule Allocation - Summary of each object scanned in parallel

    103910x0002 Dump Parallel Execution Granule Allocation - Full dump of each object except extent map

    103910x0004 Dump Parallel Execution Granule Allocation - Full dump of each object including extent map

    103910x0010 Dump Parallel Execution Granule Allocation - Summary of each granule generators

    103910x0020 Dump Parallel Execution Granule Allocation - Granule generators except granule instances0x0040 Dump Parallel Execution Granule Allocation - Granule

    Pgina 2 de 7Oracle TKPROF & SQLTRACE Trace Plustrace

    14/9/2007http://www.psoug.org/reference/trace_tkprof.html

  • 10391 generators including granule instances

    103910x0080 Dump Parallel Execution Granule Allocation - System information103910x0100 Dump Parallel Execution Granule Allocation - Reference

    object for the query103910x0200 Dump Parallel Execution Granule Allocation - kxfralo timing

    103910x0400 Dump Parallel Execution Granule Allocation - Affinity module

    103910x0800 Dump Parallel Execution Granule Allocation - Granule allocation during query execution

    103910x1000 Dump Parallel Execution Granule Allocation - Object flush10393 1 Dump Parallel Execution Statistics

    10401 1 KSXP tracing - event 10401 trace name context forever, level 1 (for RAC kernel)10402 1 SKGXP tracing - event 10402 trace name context forever, level 1 (for RAC kernel) minimal tracing10402 127 SKGXP tracing - event 10402 trace name context forever, level 1 (for RAC kernel) maximum tracing10500 1 Trace SMON Process10608 10 Trace Bitmap Index Creation10704 1 Trace Enqueues10706 1 Trace Global Enqueue Manipulation10708 10 Trace RAC Buffer Cache10710 1 Trace Bitmap Index Access10711 1 Trace Bitmap Index Merge Operation10712 1 Trace Bitmap Index OR Operation10713 1 Trace Bitmap Index AND Operation10714 1 Trace Bitmap Index MINUS Operation10715 1 Trace Bitmap Index Conversion to ROWIDs10716 1 Trace Bitmap Index Compress / Decompress10717 1 Trace Bitmap Index Compaction10719 1 10719 - Trace Bitmap Index DML10730 1 Trace Fine Grained Access Predicates10731 1 Trace CURSOR Statements10731 2 Trace CURSOR Statements10901

    Disable extent trimming10928 1 Trace PL/SQL Execution10938 1 Trace PL/SQL Execution Statistics

    29700

    Enable the collection of DLM lock conversion statistics to query GV$DLM_CONVERT_LOCAL and GV$DLM_CONVERT_REMOTE

    10060 Event 10128 Event CREATE TABLE kkoipt_table ( c1 INTEGER, c2 VARCHAR2(80);

    CREATE TABLE kkpap_pruning ( partition_count NUMBER, iterator VARCHAR2(32), partition_level VARCHAR2(32),

    Pgina 3 de 7Oracle TKPROF & SQLTRACE Trace Plustrace

    14/9/2007http://www.psoug.org/reference/trace_tkprof.html

  • ShowDoc

    order_pt VARCHAR2(12), call_time VARCHAR2(12), part# NUMBER, subp# NUMBER, abs# NUMBER);

    Trace File Locations

    $ORACLE_BASE/admin/sid_name/

    bdump ... alert logs and system generated trace files cdump ... core dumps udump ... user generated trace files

    Grant public access to all views used by TKPROF with verbose=y option.

    $ORACLE_HOME/rdbms/admin/utltkprf.sql

    Add timed statistics to trace file

    conn / as sysdba

    set linesize 121 col name format a40 col value format a30

    SELECT name, value FROM gv$parameter WHERE name LIKE 'timed%';

    ALTER SYSTEM SET timed_statistics=TRUE;

    System Privilege To Enable and Disable Tracing

    GRANT alter session TO ;GRANT alter session TO uwclass;

    REVOKE alter session FROM uwclass;

    PFile Entries vs. Alter Sessioninit.ora Parameter Example event='1401 trace name errorstack, level 12';

    ALTER SESSION Commands

    Start and Stop Session Tracing

    ALTER SESSION SET sql_trace = ;ALTER SESSION SET sql_trace = TRUE;

    ALTER SESSION SET sql_trace = FALSE;

    Pgina 4 de 7Oracle TKPROF & SQLTRACE Trace Plustrace

    14/9/2007http://www.psoug.org/reference/trace_tkprof.html

  • Event Tracing ExamplesActive Session History

    alter session set events 'immediate trace name ashdump level 10';

    Control File Dump alter session set events 'immediate trace name CONTROLF level 10';

    Error Stack (Exception) Trace

    alter session set events ' trace name errorstack level 10';alter session set events '60 trace name errorstack level 10';

    File Header Dump alter session set events 'immediate trace name FILE_HDRS level 10';

    Library Cache Dump

    alter session set events 'immediate trace name LIBRARY_CACHE level 10';

    Process State Dump

    alter session set events 'immediate trace name PROCESSSTATE LEVEL 10';

    Redo Log Headers Dump

    alter session set events 'immediate trace name REDOHDR LEVEL 10';

    System State Dump

    alter session set events 'immediate trace name SYSTEMSTATE LEVEL 10';

    Tracing DemoGo through a 10053 output to find why Oracle ignores a hint or thinks it is smarter than you. One little trick is to grep for lines starting "Join order" and "Best so far." The join order lists tables by table name, so you can see when an order you expected did not survive (or did not reach) the CBO's processing. The "Best so far" appear only when the CBO has decided that the most recent join order has a plan better than the previous best, so you can quickly check the evolution of the plan.

    ALTER SESSION SET tracefile_identifier = 'test_plan1';

    ALTER SESSION SET EVENTS '10053 trace name context forever, level 1';

    ALTER SESSION SET EVENTS '10046 trace name context forever, level 1';

    SELECT srvr_id FROM servers WHERE srvr_id IN ( SELECT srvr_id FROM serv_inst);

    SELECT srvr_id FROM servers WHERE srvr_id IN ( SELECT i.srvr_id FROM serv_inst i, servers s WHERE i.srvr_id = s.srvr_id);

    Pgina 5 de 7Oracle TKPROF & SQLTRACE Trace Plustrace

    14/9/2007http://www.psoug.org/reference/trace_tkprof.html

  • ALTER SESSION SET EVENTS '10053 trace name context OFF'; ALTER SESSION SET EVENTS '10046 trace name context OFF'; or ALTER SESSION SET SQL_TRACE=FALSE;

    review the trace file in admin/orabase/udump

    TKPROF

    Generate TKPROF Output

    TKPROF [explain=

  • Generate PLSHPROF Output

    PLSHPROF [] -output []

    Note: "output" refers to the output from DBMS_HPROF not the output from PLSHPROF.

    Options Description Default-trace

    Specifies function name of tree root N/A

    -skip Skips first count calls. Use only with -trace symbol 0-collect

    Collects information for count calls. Use only with -trace symbol 1

    -output Specifies name of output file N/A-summary Prints only elapsed time N/A

    plshprof -trace -output hprof_trace.html hprof.trc

    Related TopicsASHAWR

    DBMS_HPROFDBMS_MONITORDBMS_PROFILERDBMS_SUPPORTDBMS_SYSTEMDBMS_TRACE

    Explain PlanTrace Analyzer

    Contact Us Legal Notices and Terms of Use Privacy Statement

    Pgina 7 de 7Oracle TKPROF & SQLTRACE Trace Plustrace

    14/9/2007http://www.psoug.org/reference/trace_tkprof.html