技术开发 频道

Oracle内部函数调用追踪器

  例子 3:

  打印某个特定函数被调用时的线程调用堆栈。

  我们这里追踪"_kkeAdjSingTabCard"。设置追踪点:

  SQL代码

_kkeAdjSingTabCard*-1 6    

   函数名后的"*N"指定输出的调用个数,-1为无限制。

  然后获取到你需要追踪的会话的SPID:

  SQL代码

HELLODBA.COM>select distinct spid from v$mystat m, v$session s, v$process p where s.sid=m.sid and s.paddr=p.addr;    
  
SPID    
------------    
11076  

   从进程列表中选择ORACLE.EXE => 从线程列表中选择TID为11076的线程 => 点击"Trace"按钮

  在被追踪的会话中解释一条语句:

  SQL代码

HELLODBA.COM>explain plan for select /*+full(t)*/ count(*) from demo.t_test2 t;    
  
Explained.  

   我们就可以从监控窗口获取到该函数被调用时的整个调用堆栈的情况:

  SQL代码

[2010-5-28 6:51:55.591]User call: _kkeAdjSingTabCard (TID: 11076)    
    
Call Stacks(-1):    
        0x1460029 (ORACLE.EXE!_kkoitbp
+757)    
        0x144c44d (ORACLE.EXE!_kkoijbad
+8869)    
        0x1445d8b (ORACLE.EXE!_kkoCopyPreds
+851)    
        0x143ee0a (ORACLE.EXE!_kkosta
+1694)    
        0x1d17f6c (ORACLE.EXE!__PGOSF443__apaRequestBindCapture
+156)    
        0x1d18398 (ORACLE.EXE!_apagcp
+388)    
        0x1d1683c (ORACLE.EXE!_apafbr
+464)    
        0xea6682 (ORACLE.EXE!_opitcaNcp
+1450)    
        0x5b4eb0 (ORACLE.EXE!_kksMinimalTypeCheck
+20)    
        0x84d939 (ORACLE.EXE!_rpidrus
+429)    
        0x5b8ce8 (ORACLE.EXE!_kksSetNLSHandle
+5888)    
        0x87732e (ORACLE.EXE!_kxsReleaseRuntimeLock
+1366)    
        0x831815 (ORACLE.EXE!_kkscbt
+7237)    
        0x82e3cf (ORACLE.EXE!_kksParseCursor
+2099)    
        0x82f1b8 (ORACLE.EXE!_kksxsccompat
+148)    
        0x201683e (ORACLE.EXE!_opibrp
+1970)    
        0x13cd5ed (ORACLE.EXE!_kpodrd
+237)    
        0x13cba7c (ORACLE.EXE!_kpocrs
+780)    
        0x85174e (ORACLE.EXE!_opirip
+1102)    
        0x60feff90 (oracommon10.dll!_ttcpro
+1276)    
        0x850a69 (ORACLE.EXE!_opiodr
+1017)    
        0x1221350 (ORACLE.EXE!_opiino3
+1092)    
        0x85174e (ORACLE.EXE!_opirip
+1102)    
        0x420e58 (ORACLE.EXE!_opidcl
+824)    
        0x42164a (ORACLE.EXE!_ksdwri
+50)    
        0x401171 (ORACLE.EXE!_ssthrnfy
+117)    
        0x401061 (ORACLE.EXE!_opimai_init
+97)    
        0x401905 (ORACLE.EXE!_osnsoiint
+713)    
        0x7c80b729 (KERNEL32.dll!GetModuleFileNameA
+442)    
    [Args(
6)]:    
        0x81e58d0    
        0x81e5da8    
        
0    
        0x40a03000    
        0x8559500    
        
0  

   到这里下载最新版本的OraTracer:

  http://www.HelloDBA.com/download/OraTracer.zip

  --- Fuyuncat ---

0
相关文章