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 ...
随机推荐
- C#字节图片互转、字节转换图片、图片转换字节、byte[]转换图片、图片转换成byte[]
原文地址:http://www.cnblogs.com/wifi/articles/3522773.html /// <summary> /// 图片转换成字节流 /// </sum ...
- angular input 为file on-change 无效
l转自:https://blog.csdn.net/klo220/article/details/53331229 侵删 出现这个问题是因为input的type是file,这时如果用ng-change ...
- [20181031]12c 在线移动数据文件.txt
[20181031]12c 在线移动数据文件.txt --//12c以前,移动或者改名数据文件是一项比较麻烦的事情,至少要停一下业务.而12c支持在线移动或者改名数据文件,并且有点不可思议--//的是 ...
- Python输出和输入
一.input()函数 在 Python 中,使用内置函数 input()可以接收用户的键盘输入. input()函数的基本用法如 下: variable = input("提示文字") 其中,var ...
- c/c++ const this指针
const this指针 方法列表后面的const是什么含义呢?答案:不可以在方法里修改成员变量 class Test{ public: void fun()const{ //data = 10;// ...
- Windows Server 2016-Active Directory复制概念(二)
本章继续补充有关Active Directory复制概念,具体内容如下: 连接对象: 连接对象是一个Active Directory对象,表示从源域控制器到目标域控制器的复制连接.域控制器是单个站点的 ...
- js实现的省市联动
最近工作,要用到省市联动的功能.网上搜了一下,发现有很多这样的例子,看了不少实例,把觉得写得不错的代码穿上来,好给大家分享一下. <!DOCTYPE html PUBLIC "-//W ...
- 2802:小游戏利用bfs来实现
之前使用的是递归的方法来解决的问题,后来有点想用bfs(宽度优先搜索来尝试一下的想法,在网上看到有人使用了dfs(深度优先搜索)更加坚定了自己的这种想法. 这个方法首先是以顶点的四组开始,加入那些没有 ...
- webpack常见的配置项
使用vue init webpack test(项目文件夹名)命令初始化一个vue项目,cd test,然后安装依赖npm install之后会生成一些默认的文件夹和文件,这些文件和文件夹中有些和配置 ...
- if else; while; break;continue ----流程控制系列
第一种语法: if 条件: # @引号是为了把条件和结果分开. 结果1 # 一个Tab或者4个空格 @告诉程序满足上面的if条件才会执行结果1结果2 #如果条件为真(True),执行结果1,然后执行结 ...