oradebug 10046
一、对当前的session使用oradebug命令:
SQL> conn / as sysdba
Connected.
SQL> oradebug setmypid
Statement processed.
或者对其他session做跟踪
--连接到一个外部服务进程,且pid=v$process.pid
oradebug setorapid pid
--连接到一个外部服务进程,且spid=v$process.spid
oradebug setospid spid
二、激活10046事件
SQL> oradebug event 10046 trace name context forever,level 12;
Statement processed.
三、执行目标sql语句
SQL> select empno,ename,dname from scott.emp,scott.dept where emp.deptno=dept.deptno;
EMPNO ENAME DNAME
---------- ---------- --------------
7782 CLARK ACCOUNTING
...省略相同内容
7654 MARTIN SALES
14 rows selected.
四、查看对应的trc文件及目录
SQL> oradebug tracefile_name;
/u01/oracle/diag/rdbms/neal/neal/trace/neal_ora_18691.trc
五、关闭当前的10046跟踪事件
SQL> oradebug event 10046 trace name context off;
Statement processed.
六、使用tkprof来格式化
[oracle@server ~]$ tkprof /u01/oracle/diag/rdbms/neal/neal/trace/neal_ora_18691.trc /tmp/neal_ora_18691.trc
七、查看得到的neal_ora_18691.trc文件
SQL ID: 3yfu3wh150aqt Plan Hash: 844388907
select empno,ename,dname
from
scott.emp,scott.dept where emp.deptno=dept.deptno
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.03 0.04 0 161 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.02 8 10 0 14
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 4 0.03 0.07 8 171 0 14
Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: SYS
Number of plan statistics captured: 1
Rows (1st) Rows (avg) Rows (max) Row Source Operation
---------- ---------- ---------- ---------------------------------------------------
14 14 14 MERGE JOIN (cr=10 pr=8 pw=0 time=29081 us cost=6 size=364 card=14)
4 4 4 TABLE ACCESS BY INDEX ROWID DEPT (cr=4 pr=2 pw=0 time=19696 us cost=2 size=52card=4)
4 4 4 INDEX FULL SCAN PK_DEPT (cr=2 pr=1 pw=0 time=18734 us cost=1 size=0 card=4)(object id 87107)
14 14 14 SORT JOIN (cr=6 pr=6 pw=0 time=9416 us cost=4 size=182 card=14)
14 14 14 TABLE ACCESS FULL EMP (cr=6 pr=6 pw=0 time=9371 us cost=3 size=182 card=14)
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net break/reset to client 2 0.00 0.00
SQL*Net message to client 3 0.00 0.00
SQL*Net message from client 3 10.81 20.69
Disk file operations I/O 1 0.00 0.00
db file sequential read 3 0.01 0.01
db file scattered read 1 0.00 0.00
********************************************************************************
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.03 0.04 0 161 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 2 0.00 0.02 8 10 0 14
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 4 0.03 0.07 8 171 0 14
Misses in library cache during parse: 1
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 6 0.00 0.00
SQL*Net message from client 6 34.85 80.64
Disk file operations I/O 1 0.00 0.00
db file sequential read 3 0.01 0.01
SQL*Net break/reset to client 2 0.00 0.00
db file scattered read 1 0.00 0.00
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 13 0.01 0.01 0 0 0 0
Execute 82 0.03 0.08 0 0 0 0
Fetch 104 0.00 0.00 1 261 0 93
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 199 0.05 0.09 1 261 0 93
Misses in library cache during parse: 12
Misses in library cache during execute: 12
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
Disk file operations I/O 1 0.00 0.00
db file sequential read 1 0.00 0.00
1 user SQL statements in session.
17 internal SQL statements in session.
18 SQL statements in session.
********************************************************************************
Trace file: /u01/oracle/diag/rdbms/neal/neal/trace/neal_ora_18691.trc
Trace file compatibility: 11.1.0.7
Sort options: default
1 session in tracefile.
1 user SQL statements in trace file.
17 internal SQL statements in trace file.
18 SQL statements in trace file.
17 unique SQL statements in trace file.
1323 lines in trace file.
10 elapsed seconds in trace file.
oradebug 10046的更多相关文章
- bbed改动undo段状态(ORA-01578)
ZBDBA@orcl11g>select * from zbdba; select * from zbdba * ERROR at line 1: ORA-01578: ORACLE data ...
- 通过10046 event来获取真实的执行计划
获取SQL执行计划的方式有很多,但是某些时候获取的SQL执行计划并不是准确的,只有在SQL真实执行之后获取到的SQL PLAN才是真实准确的,其他方式(如,explain plan)获取到的执行计划都 ...
- Oracle 11g R2性能优化 10046 event
作为SQL Trace的扩展功能,Oracle 10046 event(10046事件)是一个重要的调试事件,也可以说是系统性能分析时最重要的一个事件,它包含比SQL Trace更多的信息.但可惜的是 ...
- 10046 event 知多少
10046 event 知多少 2017年5月10日 10:08 1.在当前session级打开trace 适用于SQL语句可以在新的session创建后再运行. 在session级收集10046 t ...
- Oracle SQL Trace 和 10046 事件
http://blog.csdn.net/tianlesoftware/article/details/5857023 一. SQL_TRACE 当SQL语句出现性能问题时,我们可以用SQL_TRAC ...
- 网罗收集10046的各种Case,方便trace信息的收集
每逢与遇到SQL相关性能,我们总是需要收集10046的,来查看和诊断问题.因为10046真实的反应的SQL语句执行的时候的真实信息,解析,执行,获取的时间消耗,row source operation ...
- 用10046 跟踪exp
之前写过一个blog,Oracle expdp为什么比exp快,原理是什么,是从官方文档中获知的,如今通过10046来分析exp的过程. C:\Users\Administrator>exp L ...
- 10046事件sql_trace跟踪
查看 sql 执行计划的方法有许多种, 10046 事件就是其中的一种. 与其他查看 sql 执行计划不同, 当我们遇到比较复杂的 sql 语句, 我们可以通过 10046 跟踪 sql 得到执行计划 ...
- 深入理解Oracle调试事件:10046事件详解
10046事件是SQL_TRACE的扩展,被戏称为"吃了兴奋剂的SQL_TRACE" 有效的追踪级别: ① 0级:SQL_TRACE=FASL ...
随机推荐
- CSS3 画基本图形,圆形、椭圆形、三角形等
CSS3圆角#css3-circle{ width: 150px; height: 150px; border-radius: 50%; }CSS3 椭圆形css3 radius#css3-elips ...
- apache配置-html碎片shtml格式
修改SSI 文件 conf–httpd.conf <Directory "D:/Android/Apache2.2/htdocs"> //修改文件目录 # # Pos ...
- FUNCTIONALITY OF ITEM CATEGORY
Item Category Purpose This wiki page will breify discuss about functionality of Item Category in SAP ...
- 广州.net俱乐部12月份ABP框架活动场地征集、志愿者征集、合作讲师\副讲师征集
大家好,我在<被低估的.net(上) - 微软MonkeyFest 2018广州分享会活动回顾>一文中提到,我将在12月份搞一场ABP框架活动,现向大家征集活动场地.志愿者.合作讲师\副讲 ...
- Spotlight on Mysql在Windows平台下的安装及使用简介
Spotlight on Mysql在Windows平台下的安装及使用简介 by:授客 QQ:1033553122 1. 测试环境 Win7 64位 mysql-connector-odbc- ...
- android:Android开发不得不收藏的Utils
AndroidUtils AndroidUtils Android开发不得不收藏的Utils 之前写这篇文章主要是项目应用到的Utils,发现已经有一个更全面的开源库总结,所以还是非常震惊可以总结的这 ...
- (网页)thinkpad 笔记本开机看看坏了没?
嗯!只是想看一下是不是块砖头. 出现许多细节问题: 1.不用注册联机的乱七八糟的,验证还慢,直接选择脱机的. 2.推荐密码:zaq!2wsx直接进去,以后可以改. 3.有很多选项都可以不勾选,(只勾选 ...
- spark RDD,reduceByKey vs groupByKey
Spark中有两个类似的api,分别是reduceByKey和groupByKey.这两个的功能类似,但底层实现却有些不同,那么为什么要这样设计呢?我们来从源码的角度分析一下. 先看两者的调用顺序(都 ...
- Spark SQL整体架构
0.整体架构 注意:Spark SQL是Spark Core之上的一个模块,所有SQL操作最终都通过Catalyst翻译成类似的Spark程序代码被Spark Core调度执行,其过程也有Job.St ...
- HTMLTestRunner修改成Python3版本
修改前:HTMLTestRunner下载地址:http://tungwaiyip.info/software/HTMLTestRunner.html BSTestRunner 下载地址:htt ...