Trace

Published on February 2017 | Categories: Documents | Downloads: 70 | Comments: 0 | Views: 553
of 7
Download PDF   Embed   Report

Comments

Content

Oracle TKPROF & SQLTRACE Trace Plustrace

Página 1 de 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
Event Definitions

10000 - 10999
Event # Level

8186

-

10013 1
10015 1
10015 3
10032 4
10032 10
10033

4

Description
ALTER SESSION SET EVENTS '8186 trace name context
OFF' - VERSIONS BETWEEN query
Monitor Transaction Recovery
Dump Undo Segment Headers
Identify corrupt undo segments
Dump Sort Statistics
Dump Sort Statistics
Dump Sort Large Run Statistics (blocks dumped to disk and
read back) - poss. no levels.
Dump Sort Intermediate Run Statistics

10033 10
10045 1 Trace Free List Management Operations
10046 0 No statistics generated
10046

1

Standard trace output including parsing, executes and
fetches plus more
Same as Level 1

10046 2
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

10065

2

10065

3

Restrict Library Cache Output for State Object Dumps Library Objects Only
Restrict Library Cache Output for State Object Dumps +
library object lock details
Restrict Library Cache Output for State Object Dumps +
library object handle and library object
Dump SQL*Net Statistics

10079 2
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

SQL statements into UDUMP along with the actual
10132 12 Dumps
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

http://www.psoug.org/reference/trace_tkprof.html

14/9/2007

Oracle TKPROF & SQLTRACE Trace Plustrace

10224
10225

1
1

10231 10
10232 10
10233 10
10235

1

Página 2 de 7

Dump Index Block Splits / Deletes
Dump Changes to Dictionary Managed Extents
Causes full table scans to skip corrupt blocks, rather than
fail with an ORA-1578 error
Causes corrupt blocks to be dumped to the process trace
file
Traces memory usage statistics
Check memory manager internal structures (use with ORA600/ORA-7445 errors)
Dump Remote SQL Execution

10241 1
10246 1 Trace PMON Process
10248 10 Trace Dispatcher Processes
10249 10 Trace Shared Server (MTS) Processes
10270 10 Debug Shared Cursors
10289 1 Dump a database block in hexadecimal
10299 1 Debug Prefetch
10357 1 Debug Direct Path

Parallel Execution Slave Statistics - Slave-side
10390 0x0001 Dump
execution messages
Parallel Execution Slave Statistics - Coordinator-side
10390 0x0002 Dump
execution messages
Parallel Execution Slave Statistics - Slave context
10390 0x0004 Dump
state changes
Parallel Execution Slave Statistics - Slave ROWID
10390 0x0008 Dump
range bind variables and xty
Parallel Execution Slave Statistics - Slave fetched
10390 0x0010 Dump
rows as enqueued to TQ
Parallel Execution Slave Statistics - Coordinator wait
10390 0x0020 Dump
reply handling
Parallel Execution Slave Statistics - Coordinator wait
10390 0x0040 Dump
message buffering
Parallel Execution Slave Statistics - Slave dump
10390 0x0080 Dump
timing
Parallel Execution Slave Statistics - Coordinator
10390 0x0100 Dump
dump timing
Parallel Execution Slave Statistics - Slave dump
10390 0x0200 Dump
allocation file number
Parallel Execution Slave Statistics - Terse format for
10390 0x0400 Dump
debug dumps
Parallel Execution Slave Statistics - Trace CRI
10390 0x0800 Dump
random sampling

10390 0x1000 Dump Parallel Execution Slave Statistics - Trace signals
Parallel Execution Slave Statistics - Trace parallel
10390 0x2000 Dump
execution granule operations
Parallel Execution Slave Statistics - Force
10390 0x4000 Dump
compilation by slave 0
Parallel Execution Granule Allocation - Summary of
10391 0x0001 Dump
each object scanned in parallel
Parallel Execution Granule Allocation - Full dump of
10391 0x0002 Dump
each object except extent map
Parallel Execution Granule Allocation - Full dump of
10391 0x0004 Dump
each object including extent map
Parallel Execution Granule Allocation - Summary of
10391 0x0010 Dump
each granule generators
Parallel Execution Granule Allocation - Granule
10391 0x0020 Dump
generators except granule instances
0x0040 Dump Parallel Execution Granule Allocation - Granule

http://www.psoug.org/reference/trace_tkprof.html

14/9/2007

Oracle TKPROF & SQLTRACE Trace Plustrace

Página 3 de 7

generators including granule instances

10391

Parallel Execution Granule Allocation - System
10391 0x0080 Dump
information
Parallel Execution Granule Allocation - Reference
10391 0x0100 Dump
object for the query

10391 0x0200 Dump Parallel Execution Granule Allocation - kxfralo timing
Parallel Execution Granule Allocation - Affinity
10391 0x0400 Dump
module
Parallel Execution Granule Allocation - Granule
10391 0x0800 Dump
allocation during query execution

10391 0x1000 Dump Parallel Execution Granule Allocation - Object flush
10393 1 Dump Parallel Execution Statistics
10401

1

10402

1

10402 127

KSXP tracing - event 10401 trace name context forever,
level 1 (for RAC kernel)
SKGXP tracing - event 10402 trace name context forever,
level 1 (for RAC kernel) minimal tracing
SKGXP tracing - event 10402 trace name context forever,
level 1 (for RAC kernel) maximum tracing
Trace SMON Process

10500 1
10608 10 Trace Bitmap Index Creation
10704 1 Trace Enqueues
10706 1 Trace Global Enqueue Manipulation
10708 10 Trace RAC Buffer Cache
10710 1 Trace Bitmap Index Access
10711 1 Trace Bitmap Index Merge Operation
10712 1 Trace Bitmap Index OR Operation
10713 1 Trace Bitmap Index AND Operation
10714 1 Trace Bitmap Index MINUS Operation
10715 1 Trace Bitmap Index Conversion to ROWIDs
10716 1 Trace Bitmap Index Compress / Decompress
10717 1 Trace Bitmap Index Compaction
10719 1 10719 - Trace Bitmap Index DML
10730 1 Trace Fine Grained Access Predicates
10731 1 Trace CURSOR Statements
10731 2 Trace CURSOR Statements
10901
Disable extent trimming
10928 1 Trace PL/SQL Execution
10938 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

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

http://www.psoug.org/reference/trace_tkprof.html

10128 Event

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

14/9/2007

Oracle TKPROF & SQLTRACE Trace Plustrace

Página 4 de 7

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

ShowDoc

$ORACLE_BASE/admin/sid_name/
Trace File
Locations

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

bdump ... alert logs and system generated trace
files
cdump ... core dumps
udump ... user generated trace files
$ORACLE_HOME/rdbms/admin/utltkprf.sql
conn / as sysdba

Add timed
statistics to trace
file

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;
GRANT alter session TO <user_name>;

System Privilege
To Enable and
Disable Tracing

GRANT alter session TO uwclass;
REVOKE alter session FROM uwclass;

PFile Entries vs. Alter Session
init.ora Parameter
Example

event='1401 trace name errorstack, level 12';

ALTER SESSION Commands
ALTER SESSION SET sql_trace = <TRUE | FALSE>;
Start and Stop
Session Tracing

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

http://www.psoug.org/reference/trace_tkprof.html

14/9/2007

Oracle TKPROF & SQLTRACE Trace Plustrace

Página 5 de 7

Event Tracing Examples
alter session set events 'immediate trace name
Active Session
History
ashdump level 10';
Control File Dump

Error Stack
(Exception) Trace

alter session set events 'immediate trace name
CONTROLF level 10';
alter session set events
'<error_number_without_leading_zeros> 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 Demo
Go 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);

http://www.psoug.org/reference/trace_tkprof.html

14/9/2007

Oracle TKPROF & SQLTRACE Trace Plustrace

Página 6 de 7

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 <trace_file_name> <output_file_name>
[explain=<Y|N table=<schema.table_name>]
[print=<integer>]
-- list only the first nth
SQL statements
[insert=<file_name>] -- List SQL statements and
data inside INSERT statements
[sort=<sort_options_list] -- zero or more of
the listed options
Sort
Option
execnt
execpu
execu
exedsk
exeela
exemis
exeqry
exerow
fchcnt
fchcpu
fchcu
fchdsk
fchela
fchqry
fchrow
prscnt
prscpu
prscu
prsdsk
prsela
prsmis
prsqry
userid

Description
number of execute was called
cpu time spent executing
number of buffers for current read during
execute
number of disk reads during execute
elapsed time executing
number of library cache misses during
execute
number of buffers for consistent read
during execute
number of rows processed during execute
number of times fetch was called
cpu time spent fetching
number of buffers for current read during
fetch
number of disk reads during fetch
elapsed time fetching
number of buffers for consistent read
during fetch
number of rows fetched
number of times parse was called
cpu time parsing
number of buffers for current read during
parse
number of disk reads during parse
elapsed time parsing
number of misses in library cache during
parse
number of buffers for consistent read
during parse
userid of user that parsed the cursor

TKPROF c:\temp\orabase_ora_1492.trc
c:\temp\trace_out.txt
PLSHPROF

http://www.psoug.org/reference/trace_tkprof.html

14/9/2007

Oracle TKPROF & SQLTRACE Trace Plustrace

Generate
PLSHPROF
Output

Página 7 de 7

PLSHPROF [<options>] -output <input_file1>
[<input_file2>]
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
<symbol>
Skips first count calls. Use only with -skip <count>
0
trace symbol
-collect
Collects information for count calls.
1
<count>
Use only with -trace symbol
-output
Specifies name of output file
N/A
<filename>
-summary Prints only elapsed time
N/A

plshprof -trace -output hprof_trace.html
hprof.trc
Related Topics
ASH
AWR
DBMS_HPROF
DBMS_MONITOR
DBMS_PROFILER
DBMS_SUPPORT
DBMS_SYSTEM
DBMS_TRACE
Explain Plan
Trace Analyzer
Contact Us

http://www.psoug.org/reference/trace_tkprof.html

Legal Notices and Terms of Use

Privacy Statement

14/9/2007

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close