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 ...
随机推荐
- 玩游戏 学Flex布局
大家好,今天推荐一个学习Flex布局的网页小游戏,非常不错,是国外的牛人开发的,值得一试,重复几次,就会大概了解Flex的属性了! 地址: http://flexboxfroggy.com/#zh-c ...
- [转]Javascript实现图片的预加载详解
下面的函数实现了一个我们想要的最基本的图片预加载效果 function preloadimages(arr){ var newimages=[] var arr=(typeof arr!=" ...
- java读写properties工具代码
package test612; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundExc ...
- LVS + HAProxy实现跨网负载均衡
- Spotlight on Mysql详细介绍
Spotlight on Mysql详细介绍 by:授客 QQ:1033553122 1. 版本 2. 使用介绍 1) 主页 会话面板 MySQL面板 INNODB面板 存储面板 主机面板 ...
- 利用Selenium爬取淘宝商品信息
一. Selenium和PhantomJS介绍 Selenium是一个用于Web应用程序测试的工具,Selenium直接运行在浏览器中,就像真正的用户在操作一样.由于这个性质,Selenium也是一 ...
- A problem has been detected and windows has been shut down to prevent damage to your computer.他么啥意思?看这里!【蓝屏】
A problem has been detected and windows has been shut down to prevent damage to your computer. 检测到问 ...
- HashMap和Hashtable的同和不同(详细比较)
一.综述 可以直接根据hashcode值判断两个对象是否相等吗?肯定是不可以的,因为不同的对象可能会生成相同的hashcode值.虽然不能根据hashcode值判断两个对象是否相等,但是可以直接根据h ...
- C#-简介(一)
1.C#语言简介 C#计算机语言 是一门高级计算机语言 他的开发模式更接近人类和社会的思维模式,有助于提高开发效率 C#历史 1998年COOL这个项目是C#语言的前身,由微软 Anders Hejl ...
- 信号量的基本概念与使用semget,semop
1.信号量的基本概念 信号量是一个计数器,常用于处理进程或线程的同步问题,特别是对临界资源的同步访问. 临界资源可以简单的理解为在某一时刻只能由一个进程或线程进行操作的资源,这里的资源 可以是一段代码 ...