tkprof - Format an sql trace dump
-- tkprof.sql ----------------------------------------------------------------------------------------------------
-- tkprof - Format an sql trace dump
--

# file1 is trace file generated from sql trace, file2 is output formatted file
# PRINT=10 prints the 10 worst statements, default is all
# EXPLAIN=if a user is specified will tkprof will generate an explain plan for each statement in the trace file, the specified
#     user will be used to connect to the database
# TABLE=table to be used to process explain plan.  If the table exists tkprof deletes all rows in the table, uses it for 
# the EXPLAIN PLAN and then deletes those rows.  If this table does not exist, TKPROF creates it, uses it, and then drops it. 
# INSERT=will generate insert statements in file3 to store the statistics in a table
# SYS=Enables and disables the listing of SQL statements issued by the user SYS.  Default is YES.
# SORT=Sorts traced SQL statements in descending order of specified sort options:
#        PRSCNT  Number of times parsed  
#        PRSCPU  CPU time spent parsing  
#        PRSELA  Elapsed time spent parsing  
#        PRSDSK  Number of physical reads from disk during parse  
#        PRSMIS  Number of consistent mode block reads during parse  
#        PRSCU   Number of current mode block reads during parse  
#        PRSMIS  Number of library cache misses during parse  
#        EXECNT  Number of executes  
#        EXECPU  CPU time spent executing  
#        EXEELA  Elapsed time spent executing  
#        EXEDSK  Number of physical reads from disk during execute  
#        EXEQRY  Number of consistent mode block reads during execute  
#        EXECU   Number of current mode block reads during execute  
#        EXEROW  Number of rows processed during execute  
#        EXEMIS  Number of library cache misses during execute  
#        FCHCNT  Number of fetches  
#        FCHCPU  CPU time spent fetching  
#        FCHELA  Elapsed time spent fetching  
#        FCHDSK  Number of physical reads from disk during fetch  
#        FCHQRY  Number of consistent mode block reads during fetch  
#        FCHCU   Number of current mode block reads during fetch  
#        FCHROW  Number of rows fetched  

# Syntax:
tkprof file1 file2 print=10 EXPLAIN=user/password@connectstring TABLE=schema.plantable INSERT=file3 SYS=YES/NO SORT="(sort options)" 

# Example:
tkprof dbc1_ora_26125.trc dbc1_ora_26125.tkprof print=10 EXPLAIN=user/password@connectstring TABLE=dbadm.tkprof_plan_table INSERT=tkprof.sql SYS=NO SORT = "(PRSDSK, EXEDSK, FCHDSK)" 

# all sql statements not sorted 
tkprof dbc1_ora_6640.trc dbc1_ora_6640.tkprof EXPLAIN=user/password@connectstring TABLE=dbadm.tkprof_plan_table INSERT=tkprof.sql SYS=NO 

# Produce all sql statements not sorted, no explain, no DDL generated 
tkprof dbw1_ora_12042.trc dbw1_ora_12042.tkprof  EXPLAIN=user/password@connectstring SYS=NO 


# 
tkprof ora_12493.trc ora_12493.trc.tkprof  EXPLAIN=user/password@connectstring SYS=NO SORT=EXECPU