0> conn /as sysdba;
1> 激活10046
alter session set events ‘10046 trace name context forever,level 12’
oradebug event 10046 trace name context forever,level 12
2> oradebug setmypid –准备当前session使用oradebug命令
3》要执行的sql
select empno,ename,dname from scott.emp,scott.dept where
emp.deptno=dept.deptno;
4> ORADEBUG TRACEFILE_NAME –查看生成的事件文件路径
5》分析
consistent reads—cr
physical reads–pr
Cardinality–card
5.1> tkprof 命令格式化查看
1> cmd
2> 将原有的ORADEBUG TRACEFILE_NAME路径typrof
C:\Users\Administrator>tkprof c:\app\administrator\diag\rdbms\orcl\orcl\trace\orcl_ora_2788.trc e:\orcl_ora_tkprof_2788;
6》关闭10046
alter session set events ‘10046 trace name context off’
oradebug event 10046 trace name context off