TKPROF工具使用说明及其输出的简单解释

简单分析tkprof输出文件的内容 [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. 阅读详情
--TKPROF工具使用说明及其输出的简单解释


TKPROF是命令行工具,它的主要作用是输入一个原始的跟踪文件并输出一个格式化后的文本文件。


tkprof filename1 filename2 [waits=yes|no] [sort=option] [print=n]
    [aggregate=yes|no] [insert=filename3] [sys=yes|no] [table=schema.table]

    [explain=user/password] [record=filename4] [width=n]


--不加参数输出tkprof会出现简单的说明。	
[oracle@ocm1 tmp]$ 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
	
--简单演示使用tkprof
EODA@PROD1> exec dbms_session.session_trace_enable;

PL/SQL procedure successfully completed.

EODA@PROD1> select count(*) from big_table;

  COUNT(*)
----------
  10000000

EODA@PROD1> exec dbms_session.session_trace_disable;

PL/SQL procedure successfully completed.

EODA@PROD1> select value from v$diag_info where name='Default Trace File';

VALUE
----------------------------------------------------------------------------------------------------
/u01/app/oracle/diag/rdbms/prod1/PROD1/trace/PROD1_ora_7923.trc

[oracle@ocm1 tmp]$ tkprof /u01/app/oracle/diag/rdbms/prod1/PROD1/trace/PROD1_ora_7923.trc 7923.txt sys=no sort=prsela,exeela,fchela

TKPROF: Release 11.2.0.3.0 - Development on Mon Feb 27 19:09:16 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

--解释TKPROF输出
[oracle@ocm1 tmp]$ cat 7923.txt 

以下为头部信息,包含跟踪文件名,生成输出的sort参数等信息。
TKPROF: Release 11.2.0.3.0 - Development on Mon Feb 27 19:09:16 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Trace file: /u01/app/oracle/diag/rdbms/prod1/PROD1/trace/PROD1_ora_7923.trc
Sort options: prsela  exeela  fchela  
********************************************************************************
count    = number of times OCI procedure was executed
cpu      = cpu time in seconds executing 
elapsed  = elapsed time in seconds executing
disk     = number of physical reads of buffers from disk
query    = number of buffers gotten for consistent read
current  = number of buffers gotten in current mode (usually for update)
rows     = number of rows processed by the fetch or execute call
********************************************************************************

以下开始为每条SQL语句的信息。
SQL ID: 6fxg0qj7j7ftd Plan Hash: 1764098166

select count(*) 
from
 big_table


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        2      1.92       2.20      22167      22188          0           1
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        4      1.92       2.20      22167      22188          0           1

--count:数据库调用执行的次数。
--cpu:花费在数据库调用上CPU时间的总和,单位秒。
--elapsed:花费在数据库调用上的运行时间综合,单位秒。如果值高于cpu则会在统计后部分找到等待事件信息。
--disk:代表物理读的块数。如果这值比逻辑读大(disk>query+current)则代表块涌入了临时表空间。
--query:一致性逻辑读的块数。通常查询会用到这种逻辑读。
--current:在当前模式下使用逻辑读读取的块数。通常INSERT/UPDATE/MERGE/DELETE会产生此类。
--rows:处理的行数。对于查询来说是获取的行数,对于修改语句来说是影响的行数。

Misses in library cache during parse: 1
--代表在解析期间的硬解析数。

Optimizer mode: ALL_ROWS
--优化器模式。

Parsing user id: 97 
--解析次SQL语句的用户ID。 

Number of plan statistics captured: 1

Rows (1st) Rows (avg) Rows (max)  Row Source Operation
---------- ---------- ----------  ---------------------------------------------------
         1          1          1  SORT AGGREGATE (cr=22188 pr=22167 pw=0 time=2200607 us)
  10000000   10000000   10000000   INDEX FAST FULL SCAN BIG_TABLE_PK (cr=22188 pr=22167 pw=0 time=4917338 us cost=6256 size=0 card=9980600)(object id 85100)
--cr是一致性逻辑读的块数。
--pr是物理读的块数。
--pw是物理写的块数。
--time是执行操作运行时间总和,单位微秒。
--cost是操作的估计成本。
--size是操作返回的预计数据大小(byte)。
--card是操作返回的预估行数。

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       2        0.00          0.00
  Disk file operations I/O                        1        0.00          0.00
  db file sequential read                        63        0.01          0.02
  db file scattered read                        204        0.04          1.03
  SQL*Net message from client                     2        0.00          0.00
********************************************************************************

--等待时间的统计,包括发生次数,发生最大时间,发生总时间。

SQL ID: 9arnynjk2xh7g Plan Hash: 0

BEGIN dbms_session.session_trace_enable; END;


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        0      0.00       0.00          0          0          0           0
Execute      1      0.00       0.02          1         74          0           1
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        1      0.00       0.02          1         74          0           1

Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 97  

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       1        0.00          0.00
  SQL*Net message from client                     1        0.00          0.00
********************************************************************************

SQL ID: 9babjv8yq8ru3 Plan Hash: 0

BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        2      0.00       0.00          0          0          0           0
Execute      2      0.00       0.01          0         33          0           2
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        4      0.00       0.01          0         33          0           2

Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: ALL_ROWS
Parsing user id: 97  

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       2        0.00          0.00
  SQL*Net message from client                     2       12.46         22.37
********************************************************************************

SQL ID: 4pzfk82288xrc Plan Hash: 0

BEGIN dbms_session.session_trace_disable; END;


call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      0.00       0.00          0          0          0           0
Execute      1      0.00       0.00          0          0          0           1
Fetch        0      0.00       0.00          0          0          0           0
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        2      0.00       0.00          0          0          0           1

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 97  



********************************************************************************
--在所有SQL语句的报告后,可以看到执行统计信息,解析和等待事件的综合统计。
--这里需要注意的就是非递归SQL从递归SQL里分离出来。
--Recursive SQL是指sys用户执行的语句,非业务SQL,在TKPROF可以显示Recursive SQL,也可以过滤掉,过滤掉的方法就是,TKPROF后加参数sys=no。

OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        4      0.00       0.00          0          0          0           0
Execute      5      0.00       0.03          1        107          0           4
Fetch        2      1.92       2.20      22167      22188          0           1
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total       11      1.94       2.24      22168      22295          0           5

Misses in library cache during parse: 3
Misses in library cache during execute: 2

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       5        0.00          0.00
  SQL*Net message from client                     5       12.46         22.37
  db file sequential read                        63        0.01          0.02
  Disk file operations I/O                        1        0.00          0.00
  db file scattered read                        204        0.04          1.03


OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS

call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse       10      0.00       0.00          0          0          0           0
Execute     31      0.00       0.05          0          0          0           0
Fetch       68      0.00       0.05          3        118          0          44
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total      109      0.01       0.10          3        118          0          44

Misses in library cache during parse: 6
Misses in library cache during execute: 6

Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  db file sequential read                         3        0.04          0.05

--对当前会话的SQL数量进行概括。
    5  user  SQL statements in session.
   21  internal SQL statements in session.
   26  SQL statements in session.
********************************************************************************
Trace file: /u01/app/oracle/diag/rdbms/prod1/PROD1/trace/PROD1_ora_7923.trc
Trace file compatibility: 11.1.0.7
Sort options: prsela  exeela  fchela  
       1  session in tracefile.
       5  user  SQL statements in trace file.
      21  internal SQL statements in trace file.
      26  SQL statements in trace file.
      21  unique SQL statements in trace file.
     593  lines in trace file.
      24  elapsed seconds in trace file.


使用TKPROF 工具分析跟踪文件 使用TKPROF 工具分析跟踪文件 实验目的:让学员熟练掌握使用TKPROF 进行跟踪文件分析 实验环境:VmWare Server 1.0.4+RHEL as 4+Oracle 10g 10.2.0.1.0 实验场景: Tkprof 是一个用于分析Oracle 跟踪文件并且产生一个更加清晰合理的输出结果的可执行工具。如果一个 系统的执行效率比较低,一个比较好的方法是通过跟踪用户的会话并且使用Tkprof 工具使用排序功能格式 化输出,从而找出有问题的SQL 语句。 TKPROF 工具是oracle 提供的免费工具,有人习惯称之为"Trace Kernel Profile",也有人称之为"Tool Kit Profiler"或"transient kernel profiler. "。不过,这都不重要,重要的是我们应该掌握究竟应该如何 使用该工具对TRACE 文件进行分析。 立即下载

相关推荐

Axure RP 9在Windows 11环境下的高效安装与配置指南

本文提供Axure RP 9在Windows 11系统下的详细安装步骤与配置指南。针对Win11安全特性,从获取官方安装资源、调整系统权限,到定制化安装路径、精准汉化及性能优化,系统性地解决了安装闪退、汉化失败、运行卡顿等常见问题,确保用户获得稳定流畅的原型设计体验。

mango的博客 488

oracle tkprof 工具详解

select s.sid,s.serial#,s.username,s.logon_time,s.osuser,(select sys_context('userenv','ip_address') from dual) as ipad,s.machine,p.username,p.program,p.spid   2     from v$session s,v$process p   3

Rhys learn oracle! 3007

HR效率翻倍!用Dify+飞书AI表格打造自动化简历处理流水线(附完整代码)

本文详细介绍了如何利用Dify工作流和飞书多维表格构建自动化简历处理系统,实现简历上传、AI智能解析与结构化数据入库的全流程自动化。通过整合大语言模型进行信息抽取,该系统能显著提升HR处理简历的效率与准确性,将HR从重复劳动中解放出来。

1a2s3d4f5g的博客 1036

tkprof工具详解二

TKPROF是一个可执行文件,自带在Oracle Server软件中,无需额外的安装。 该工具文件可以用来解析ORACLE的SQL TRACE(10046) 以便生成更可读的内容。 实际上tkprof是对10046 SQL trace的内容作了汇总,例如一个语句遇到过的wait event 、其在PARSE、Execute、Fetch三阶段的耗时、CPU_T...

aiduo1030的博客 421

Qt 文件对话框(QFileDialog)实战指南 —— 从基础到高级应用

本文是Qt文件对话框(QFileDialog)的实战指南,从基础静态函数调用到高级对象模式应用,全面解析了文件选择、保存、目录选取及多选等核心功能。文章深入探讨了MIME类型过滤、自定义侧边栏、信号槽实时响应及状态持久化等高级技巧,并提供了跨平台开发中的避坑指南与最佳实践,帮助开发者高效、稳健地集成文件操作功能。

weixin_29306261的博客 378

EAST算法(Efficient and Accuracy Scene Text))

1.EAST模型简介 本文介绍的文本检测模型EAST,便简化了中间的过程步骤,直接实现端到端文本检测,优雅简洁,检测的准确性和速度都有了进一步的提升。如下图: 其中,(a)、(b)、(c)、(d)是几种常见的文本检测过程,典型的检测过程包括候选框提取、候选框过滤、bouding box回归、候选框合并等阶段,中间过程比较冗长。而(e)即是本文介绍的EAST模型检测过程,从上图可看出,其过程简化为只有FCN阶段(全卷积网络)、NMS阶段(非极大抑制),中间过程大大缩减,而且输出结果支持文本行、单词的多个角度

博客 9582

TKPROF 工具

原文转自:http://blog.csdn.net/tianlesoftware/article/details/4977827 一、Oracle跟踪文件  Oracle跟踪文件分为三种类型,一种是后台报警日志文件,记录数据库在启动、关闭和运行期间后台进程的活动情况,如表空间创建、回滚段创建、某些alter命令、日志切换、错误消息等。在数据库出现故障时,应首先查看该文件,但文件中的信息与任

changyanmanman的专栏 2550

海思SD3403/SS928V100开发(6)单路GMSL-MIPI-YUV相机视频输入调试

硬件连接:森云GMSL相机 -> GMSL 解串器 -> SD3403 MIPI0暂时先进行单路视频输入通路调试。

jzwjzw19900922的博客 1940

sql的跟踪与Tkprof工具

 2011年1月14日  /2011-12-15增加修改sql跟踪方法介绍 一、sql_trace的介绍--打开trace文件设置,把sql trace设置为true,就会在udump目录中增加一个trc文件。alter session set sql_trace=true;show parameter sql_trace;(select * from v$parameter where name...

weixin_34370347的博客 282

图解B+树的插入过程

B+ 树在现代数据库中很常见,如果我们了解它,在工作中可能对性能优化会有更好的帮助! 最近我一直在思考 B+ 树的高度是由什么决定的。知道我了解了 B+ 树的插入过程,才有一种恍然大悟的感觉! 网上的一些资料杂乱无章,不同的数据库可能还有对 B+ 树有不同的实现。但是万变不离其宗,B+ 树的定义,大致如下所示: 总结一下,B+ 树有下面 5 个重要的特点。 B+ 树包含 2 种类型的结点: 内部结点(也称索引结点)和叶子结点。 根结点本身即可以是内部结点,也可以是叶子结点。 根结点的关键字个数最

愿君出走半生,归来时仍是少年 2137

博途PLC S7-1200/1500 ModbusTcp通信SCL代码篇(轮询)

博途PLC MODBUS TCP的详细讲解和注意事项,可以参看下面这篇博文,这里不在赘述。这篇作为SCL代码篇主要给出SCL语言下的轮训写法和注意事项。博途PLC1200/1500PLC ModbusTcp通信(轮询处理)_RXXW_Dor的博客-CSDN博客。............

RXXW_Dor的博客 8448

tkprof_oracle之工具

Tkprof工具可用来格式化sql trace产生的文件,让你更容易看懂trace的内容 用法: tkprof tracefile outputfile [explain= ] [table= ] [prin...

congshi5749的博客 243

机器人中的数值优化(十四)——罚函数法(Penalty Method)、障碍函数法(Barrier Method)、拉格朗日松弛法(Lagrangian Relaxation)

本系列文章主要是我在学习《数值优化》过程中的一些笔记和相关思考,主要的学习资料是深蓝学院的课程《机器人中的数值优化》和高立编著的《数值最优化方法》等,本系列文章篇数较多,不定期更新,上半部分介绍无约束优化,下半部分介绍带约束的优化,中间会穿插一些路径规划方面的应用实例

慕羽★的博客 5226

笔记:格式化输出跟踪文件 tkprof

Tkprof是一个用于分析Oracle跟踪文件并且产生一个更加清晰合理的输出结果的可执行工具。如果一个系统的执行效率比较低,一个比较好的方法是通过跟踪用户的会话并且使用Tkprof工具使用排序功能格式化输出,从而找出有问题的SQL语句。 一. TKPROF 命令语法: TKPROF filename1, filename2 [ SORT = [ opion][,option] ] [ P...

Lizi_TT的博客 322

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

oracle怎么使用跟踪,Oracle SQL跟踪分析工具TKPROF使用说明

存放目录:$ORACLE_HOME/bin/tkprofTKPROF 工具SQL_TRACE 生成最原始的trace文件的可读性比较差,所以通常我们使用tkprof 工具来处理trace文件。 Tkprof 工具是Oracle 自带的一个工具,用于处理原始的trace文件,它的作用主要是合并汇总trace文件中的一些项,规范化文件的格式,使文件更具有可读性。注意:tkprof 工具只能用在处理SQ...

weixin_42169674的博客 664

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

oracle 工具:tkprof

1 定义           用于分析oracle跟踪文件并且可按需产生一个更加清晰合理的输出结果的可执行工具       2 首选项 F:\>tkprof Usage: tkprof tracefile outputfile [explain= ] [table= ] [print= ] [insert= ] [sys= ] [sort= ] tab

记录创业路上的一些想法 2168

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

tkprof工具简介

Tkprof工具介绍和分析    Tkprof是一个用于分析oracle跟踪文件并且产生一个更加清晰合理的输出结果的可执行工具。如果一个系统的执行效率比较低,一个比较好的方法是通过跟踪用户的会话并且使用Tkprof工具使用排序功能格式化输出,从而找出有问题的SQL语句。Tkprof的使用步骤1,  在数据库级别上设置Timed_statistics为true。8i数据库需要修改

47522341的专栏 1631

TKPROF解析

TKPROF命令之前我们收集的trace日志仍为Raw Trace,如果要做性能分析的话,往往要转换为TKPROF,TKPROF可以把Raw Trace转换为更易读的形式。TKPROF Command $tkprof tracefile outputfile [explain= ] [table= ] [print= ] [insert= ] [sys= ] [sort= ] ...

田攀的日志 6755

tkprof用法总结

tkprof是Oracle自带的命令行工具,主要用于将trace跟踪日志转化为易于阅读的格式化文本。 最简单的是 f:\app\WXH-NOTE\diag\rdbms\orcl\orcl\trace>tkprof  orcl_ora_15096.trc  orcl_ora_15096.txt 直接在cmd命令行里面输入tkprof查看相关参数 C:\Users\WXH-NOTE>tk

王小辉的专栏 1756

Tkprof工具介绍和分析

Tkprof是一个用于分析Oracle跟踪文件并且产生一个更加清晰合理的输出结果的可执行工具。如果一个系统的执行效率比较低,一个比较好的方法是通过跟踪用户的会话并且使用Tkprof工具使用排序功能格式化输出,从而找出有问题的SQ...

ciren660440648的博客 415

使用TKPROF查看跟踪文件

tkprof是安装数据自带的查看跟踪文件的命令工具,其将跟踪文件xx.trc转化为易于阅读的xx.prf文件,其在创建跟踪文件的同时也可以运行tkprof程序。 TKPROF语法格式: tkprof t...

cuanzhutang8944的博客 260

Tkprof使用说明

Tkprof是一个用于分析Oracle跟踪文件并且产生一个更加清晰合理的输出结果的可执行工具。如果一个系统的执行效率比较低,一个比较好的方法是通过跟踪用户的会话并且使用Tkprof工具使用排序功能格式化输出,从而找出有问题的SQ...

ciqian8449的博客 251

TKProf 的使用

tkprof 的目的是将sql trace 生成的跟踪文件转换成用户可以理解的格式1. 格式tkprof inputfile outputfile [optional | parameters ]参数和选项:explain=user/password 执行explain命令将结果放在SQL trace的输出文件中table=schema.table 指定tkprof处理sq

专注Oracle EBS---低调的奢华 1032

TKPROF工具

ORACLE系统中的性能调整方法主要分为两类:应用系统的调整和数据库系统的性能调整。应用系统的调整关注的焦点在应用设计相关的方面,比如:事务规则的调整、数据的设计、应用程序的设计,ORACLE系统的性能与应用系统的设计密切相关,性能调整90%的项目都集中在应用程序的调整。 在应用程序调整结束后就将进行数据库方面的调整。在进行数据库的性能调整之前,要做的一项关键工作是利用工具进行SQL语句的性能分

欧辰的专栏 3221
上一篇: 使用DBMS_HPROF进行PL/SQL代码探查
下一篇: 操作系统统计信息v$osstat
blockheading
博客等级 码龄13年 54粉丝 178原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值