Sei sulla pagina 1di 7

TKPROF for Trace

Analysis
TKPROF
• TKPROF accepts as input a trace file produced by sql trace facility and it
produces a formatted output file.
• TKPROF can also be used to generate execution plans.
• After the SQL Trace Facility has generated trace files you can :
• Run TKPROF on each individual trace file, producing several formatted output files, one
for each session.
• Concatenate the trace files , and then run TKPROF on the result to produce a formatted
output file for the entire instance.
• Run the trcsess command-line utilityto consolidate tracing information from several
trace files , then run TKPROF on the result.
• TKPROF does not report COMMITS and ROLLBACKS that are recorded in the trace file.
• Show parameter user_dump
• Alter session set tracefile_identifier=SQLT;
• Alter session set SQL_TRACE=TRUE;
Autotrace In SQL
• The autotrace utility is a very underutilized feature of SQL*Plus. It offers
statement tracing and instant feedback on any successful SELECT, INSERT,
UPDATE or DELETE statement.
• The autotrace provides instantaneous feedback including the returned rows,
execution plan, and statistics.
• The user doesn't need to be concerned about trace file locations and
formatting since the output is displayed instantly on the screen. This is very
important data that can be used to tune the SQL statement.
Autotrace In SQL
• autotrace on - Enables all options.

• autotrace on explain - Displays returned rows and the explain plan.

• autotrace on statistics - Displays returned rows and statistics.

• autotrace trace explain - Displays the execution plan for a select


statement without actually executing it. "set autotrace trace explain"

• autotrace traceonly - Displays execution plan and statistics without


displaying the returned rows. This option should be used when a large
result set is expected.
Autotrace In SQL
• SET AUTOT[RACE] {OFF | ON | TRACE[ONLY]} [EXP[LAIN]] [STAT[ISTICS]]
• Set autotrace on
• Set autotrace off
• set autotrace traceonly explain
• analyze table departments compute statistics;

Potrebbero piacerti anche