ImageVerifierCode 换一换
格式:DOCX , 页数:6 ,大小:18.23KB ,
资源ID:2432857      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/2432857.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(使用TKPROF格式化TRACE输出之解剖麻雀.docx)为本站会员(b****1)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

使用TKPROF格式化TRACE输出之解剖麻雀.docx

1、使用TKPROF格式化TRACE输出之解剖麻雀【TKPROF】使用TKPROF格式化TRACE输出之“解剖麻雀” 2009-10-21 11:26:54 【SQL_TRACE】SQL优化及性能诊断好帮手1.与之上次使用到的SQL_TRACE功能相比,我们这次将使用更高级的trace命令(10046)来做演示。我们先启用“高级”的10046事件生成一份待格式化的trace文件1)连接到普通用户secsysora10g conn sec/secConnected.2)先将timed_statistics参数设置为true,这样可以使TKPROF工具能提供更多的有意义的信息,方便性能诊断secora

2、10g alter session set timed_statistics=true;Session altered.3)“高级”之所在,我们这里启用10046的level 12对当前会话进行跟踪。(1)在此,给出10046各level的解释参考:level 1 to enable the standard SQL_TRACE facility (same as SQL_TRACE=TRUE)等同于标准的SQL_TRACE=TRUE;level 4 to enable SQL_TRACE and also capture bind variable values in the trace f

3、ile启用SQL_TRACE,并捕捉跟踪文件中的绑定变量;level 8 to enable SQL_TRACE and also capture wait events into the trace file启用SQL_TRACE,并捕捉跟踪文件中的等待事件;level 12 to enable standard SQL_TRACE and also capture bind variables and wait events启用SQL_TRACE,并捕捉跟踪文件中的绑定变量和等待事件(捕获信息能力最强)。(2)对当前会话启用level 12的跟踪:secora10g alter sessi

4、on set events 10046 trace name context forever, level 12;Session altered.(3)【补充】如果想使用这种高级方法对其他的会话进行跟踪的话,可以使用如下的SQL语句开启和关闭:开启:execute dbms_system.set_ev(sid,serial#,10046,12,);关闭:execute dbms_system.set_ev(sid,serial#,10046,0,);举例如下:A.获得sid, serial#的信息sysora10g select sid, serial# from v$session;B.开启

5、sysora10g execute dbms_system.set_ev(543,1306,10046,12,);C.关闭sysora10g execute dbms_system.set_ev(543,1306,10046,0,);4)在该会话中运行一条具体的SQL语句,此处使用到的实验表t中包含1亿条数据。该SQL语句的执行情况将被细致的记录到trace文件中。secora10g select count(*) from t; COUNT(*)-1000000005)关闭当前会话的跟踪secora10g alter session set events 10046 trace name c

6、ontext off;Session altered.2.在udump目录中找到刚刚生成的trace文件(关于如何快速获得生成的trace文件的方法有很多种,选择一个适合自己的就OK),并使用TKPROF对其进行格式化,然后打印一下全部输出,后面将对每一个输出项做一下“解剖麻雀”:)ora10gsecDB /oracle/app/oracle/admin/ora10g/udump$ tkprof ora10g_ora_21213.trc ora10g_ora_21213.prfTKPROF: Release 10.2.0.3.0 - Production on Wed Oct 21 10:04

7、:40 2009Copyright (c) 1982, 2005, Oracle. All rights reserved.ora10gsecDB /oracle/app/oracle/admin/ora10g/udump$ cat ora10g_ora_21213.prfTKPROF: Release 10.2.0.3.0 - Production on Wed Oct 21 10:05:43 2009Copyright (c) 1982, 2005, Oracle. All rights reserved.Trace file: ora10g_ora_21213.trcSort optio

8、ns: default*count = number of times OCI procedure was executedcpu = cpu time in seconds executingelapsed = elapsed time in seconds executingdisk = number of physical reads of buffers from diskquery = number of buffers gotten for consistent readcurrent = number of buffers gotten in current mode (usua

9、lly for update)rows = number of rows processed by the fetch or execute call*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 0Execute 2 0.00 0.00 0 0 0 2Fetch 0 0.00 0.00 0 0 0 0- - - - - - - -total 4 0.00 0.00 0

10、 0 0 2Misses in library cache during parse: 0Optimizer mode: ALL_ROWSParsing user id: 51Elapsed 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 5.60 7.74*select count(*)fromtcall

11、count cpu elapsed disk query current rows- - - - - - - -Parse 1 0.00 0.00 0 0 0 0Execute 1 0.00 0.00 0 0 0 0Fetch 2 10.94 10.68 222186 222957 0 1- - - - - - - -total 4 10.94 10.68 222186 222957 0 1Misses in library cache during parse: 0Optimizer mode: ALL_ROWSParsing user id: 51Rows Row Source Operation- - 1 SO

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1