René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

Oracle's TKPROF

TKPROF stands for transient kernel profiler.

Enabling SQL TRACE

To be able to use TKPROF, you must first enable sql trace. This can be done for either the instance or the session. If you want to change it for the entire instance, set sql_trace=true into the init.ora file and restart the instance. However, usually, you'll want to turn on sql trace for a particular session only. This can be done like so:
alter session set sql_trace=true;
or, from another session with a
sys.dbms_system.set_sql_trace_in_session(session's id,serial number, true)

Timed Statistics

You can have Oracle include timing information into the sql trace files as well. Either set the timed_statistics parameter to true or issue an
alter system set timed_statistics=true;
or
alter session set timed_statistics=true;

Finding the SQL trace file

The trace files will be written into the directory pointed to by the parameter user_dump_dest. You can query for the value with select value from v$parameter where name = 'user_dump_dest'.
See find the trace file to see where the tk prof file goes.

Format of the trace file

See this link.

Maximum size of the trace file

The init parameter max_dump_file_size allows to set the maximum size of the trace files. Valid values for this parameter are: unlimited, a number followed by a K or a M or a number. If the value is a number only, it indicates how many OS Blocks the file can grow to. K or M set the file's maximum size in kilo or mega bytes.

Using tkprof

Thanks

Thanks to Julia Lovick who reported an error on this page.