ADAMS RESEARCH
EMPNO ENAME DNAME
---------- ---------- --------------
7900 JAMES SALES
7902 FORD RESEARCH
7934 MILLER ACCOUNTING
14 rows selected.
用oradebug tracefile_name命令就可以一目了然的看到当前session激活10046事件后所对应的trace文件的路径和名称:
SQL> oradebug tracefile_name
/u01/app/oracle/admin/OMR/udump/omr_ora_16192.trc
关掉10046事件:
SQL> oradebug event 10046 trace name context off
Statement processed.
查看/u01/app/oracle/admin/OMR/udump/omr_ora_16192.trc文件
[oracle@even ~]$ vi /u01/app/oracle/admin/OMR/udump/omr_ora_16192.trc
/u01/app/oracle/admin/OMR/udump/omr_ora_16192.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining options
ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1
System name: Linux
Node name: even.oracle.com
Release: 2.6.18-164.el5
Version: #1 SMP Thu Sep 3 02:16:47 EDT 2009
Machine: i686
Instance name: OMR
Redo thread mounted by this instance: 1
Oracle process number: 15
Unix process pid: 16192, image: oracle@even.oracle.com (TNS V1-V3)
*** 2013-12-06 12:46:25.079
*** SERVICE NAME:(SYS$USERS) 2013-12-06 12:46:25.079
*** SESSION ID:(158.19) 2013-12-06 12:46:25.079
。。。。。。
。。。。。。
这样直接查看此文件,太难看了,格式很乱,不方便读。这个时候我们可以用ORACLE的TKPROF来格式化此文件,操作如下:
[oracle@even ~]$ tkprof /u01/app/oracle/admin/OMR/udump/omr_ora_16192.trc /u01/app/oracle/admin/OMR/udump/watson_omr_ora_16192_tkprof.trc
TKPROF: Release 10.2.0.1.0 - Production on Fri Dec 6 12:57:28 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
这个时候下面的格式就是格式化过的,方便读的
[oracle@even ~]$ vi /u01/app/oracle/admin/OMR/udump/watson_omr_ora_16192_tkprof.trc
TKPROF: Release 10.2.0.1.0 - Production on Fri Dec 6 12:57:28 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Trace file: /u01/app/oracle/admin/OMR/udump/omr_ora_16192.trc
Sort options: default
********************************************************************************
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
********************************************************************************
The following statement encountered a error during parse:
select empno,ename,dname,from scott.emp,scott.dept where emp.deptno=dept.deptno
Error encountered: ORA-00936
********************************************************************************
select obj#,type#,ctime,mtime,stime,status,dataobj#,flags,oid$, spare1,
spare2
from
obj$ where owner#=:1 and name=:2 and namespace=:3 and remoteowner is null
and linkname is null and subname is null
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.03 0 0 0 0
Fetch 1 0.00 0.00 0 3 0 1
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 3 0.00 0.03 0 3 0 1
Misses in library cache during parse: 1
Misses in library cache during execute: 1
Optimizer mode: CHOOSE
Parsing user id: SYS (recursive depth: 1)
Rows Row Source Operation
------- ---------------------------------------------------
1 TABLE ACCESS BY I