从进程列表中选择ORACLE.EXE => 从线程列表中选择TID为11076的线程 => 点击"Trace"按钮
在被追踪的会话中执行一条语句:
SQL代码
HELLODBA.COM>select * from demo.t_test1 where owner='DEMO' and object_name like 'T_TEST%';
OWNER OBJECT_NAME SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED
LAST_DDL_TIME TIMESTAMP STATUS T G S
------------------------------ ------------------------------ ------------------------------ ---------- -------------- ------------------- -----------
-------- ------------------- ------------------- ------- - - -
DEMO T_TEST1 AAA 97819 97819 TABLE 2007-06-07
13:48:08 2007-06-07 13:48:08 2007-06-07:13:48:08 VALID N N N
OWNER OBJECT_NAME SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE CREATED
LAST_DDL_TIME TIMESTAMP STATUS T G S
------------------------------ ------------------------------ ------------------------------ ---------- -------------- ------------------- -----------
-------- ------------------- ------------------- ------- - - -
DEMO T_TEST1 AAA 97819 97819 TABLE 2007-06-07
13:48:08 2007-06-07 13:48:08 2007-06-07:13:48:08 VALID N N N
注意:为了避免回滚调用也被追踪,你最好在追踪之前先运行一次该语句。
我们可以从追踪窗口看到数据fetch调用情况:
SQL代码
[2010-5-28 6:28:29.649]User call: _qertbFetchByRowID (TID: 11076)
[2010-5-28 6:28:29.711]User call: _qerixtFetch (TID: 11076)
[2010-5-28 6:28:29.727]User call: _qertbFetchByRowID (TID: 11076)
[2010-5-28 6:28:29.727]User call: _qerixtFetch (TID: 11076)
[2010-5-28 6:28:29.711]User call: _qerixtFetch (TID: 11076)
[2010-5-28 6:28:29.727]User call: _qertbFetchByRowID (TID: 11076)
[2010-5-28 6:28:29.727]User call: _qerixtFetch (TID: 11076)
有了这样的追踪记录,你可以尝试将他们与执行计划中节点映射:
SQL代码
HELLODBA.COM>select * from demo.t_test1 where owner='DEMO' and object_name like 'T_TEST%';
Execution Plan
----------------------------------------------------------
Plan hash value: 698582444
-------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 5 | 495 | 4 (0)| 00:00:04 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_TEST1 | 5 | 495 | 4 (0)| 00:00:04 | ==> _qertbFetchByRowID
|* 2 | INDEX RANGE SCAN | T_TEST_IDX7 | 5 | | 1 (0)| 00:00:02 | ==> _qerixtFetch
Execution Plan
----------------------------------------------------------
Plan hash value: 698582444
-------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
-------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 5 | 495 | 4 (0)| 00:00:04 |
| 1 | TABLE ACCESS BY INDEX ROWID| T_TEST1 | 5 | 495 | 4 (0)| 00:00:04 | ==> _qertbFetchByRowID
|* 2 | INDEX RANGE SCAN | T_TEST_IDX7 | 5 | | 1 (0)| 00:00:02 | ==> _qerixtFetch