[oracle@rhf ~]$ tkprof
Usage: tkprof tracefile outputfile [explain= ] [table= ]
[print= ] [insert= ] [sys= ] [sort= ]
table=schema.tablename Use 'schema.tablename' with 'explain=' option.
explain=user/password Connect to ORACLE and issue EXPLAIN PLAN.
print=integer List only the first 'integer' sql statements.
aggregate=yes|no
insert=filename List sql statements and data inside INSERT statements.
sys=no TKPROF does not list sql statements run as user SYS.
record=filename Record non-recursive statements found in the trace file.
waits=yes|no Record summary for any wait events found in the trace file.
sort=option Set of zero or more of the following sort options:
prscnt number of times parse was called
prscpu cpu time parsing
prsela elapsed time parsing
prsdsk number of disk reads during parse
prsqry number of buffers for consistent read during parse
prscu number of buffers for current read during parse
prsmis number of misses in library cache during parse
execnt number of execute was called
execpu cpu time spent executing
exeela elapsed time executing
exedsk number of disk reads during execute
exeqry number of buffers for consistent read during execute
execu number of buffers for current read during execute
exerow number of rows processed during execute
exemis number of library cache misses during execute
fchcnt number of times fetch was called
fchcpu cpu time spent fetching
fchela elapsed time fetching
fchdsk number of disk reads during fetch
fchqry number of buffers for consistent read during fetch
fchcu number of buffers for current read during fetch
fchrow number of rows fetched
userid userid of user that parsed the cursor
Usage: tkprof tracefile outputfile [explain= ] [table= ]
[print= ] [insert= ] [sys= ] [sort= ]
table=schema.tablename Use 'schema.tablename' with 'explain=' option.
explain=user/password Connect to ORACLE and issue EXPLAIN PLAN.
print=integer List only the first 'integer' sql statements.
aggregate=yes|no
insert=filename List sql statements and data inside INSERT statements.
sys=no TKPROF does not list sql statements run as user SYS.
record=filename Record non-recursive statements found in the trace file.
waits=yes|no Record summary for any wait events found in the trace file.
sort=option Set of zero or more of the following sort options:
prscnt number of times parse was called
prscpu cpu time parsing
prsela elapsed time parsing
prsdsk number of disk reads during parse
prsqry number of buffers for consistent read during parse
prscu number of buffers for current read during parse
prsmis number of misses in library cache during parse
execnt number of execute was called
execpu cpu time spent executing
exeela elapsed time executing
exedsk number of disk reads during execute
exeqry number of buffers for consistent read during execute
execu number of buffers for current read during execute
exerow number of rows processed during execute
exemis number of library cache misses during execute
fchcnt number of times fetch was called
fchcpu cpu time spent fetching
fchela elapsed time fetching
fchdsk number of disk reads during fetch
fchqry number of buffers for consistent read during fetch
fchcu number of buffers for current read during fetch
fchrow number of rows fetched
userid userid of user that parsed the cursor
从其命令格式可以看出,tkprof
命令的主要参数只有两个:
如下列子:
[oracle@rhf trace]$
tkprof orcl_ora_29583_rtrace.trc rhf1.prf
TKPROF: Release 11.2.0.3.0 - Development on 星期二 8月 30 15:37:47 2016
Copyright (c) 1982,2011,Oracle and/or its affiliates. All rights reserved.
[oracle@rhf trace]$
ls -l rhf1.prf
-rw-r--r-- 1 oracle oinstall 49829 Aug 30 15:37
rhf1.prf
生成的rhf1.prf可以直接通过文本编辑器查看。
其他重要参数释义:
prsela : 解析的运行时间
exeela : 执行所用的运行时间
fchela : 获取所用的运行时间
table: 指定存储执行计划的表,默认的是explain参数提供的用户架构下的名为plan_table的表。
width : 这是一个确定某些类型的输出行宽度的整型值。
示例:
[oracle@rhf trace]$
tkprof orcl_ora_29583_rtrace.trc rhf2.prf explain=system/oracle sort=exeela,prsela,fchela
[oracle@rhf trace]$
ls -l rhf2.prf
-rw-r--r-- 1 oracle oinstall 49906 Aug 30 16:00 rhf2.prf