HelloDBA [中文]
Search Internet Search HelloDBA
  Oracle Technology Site. email: fuyuncat@gmail.com  MSN: fuyuncat@hotmail.com Add to circle  acoug  acoug 

OraTracer upgrade

[中文]

Author:  fuyuncat

Source:  www.HelloDBA.com

Date:  2010-06-01 08:27:13

Share to  Twitter Facebook GMail Blogger Orkut Google Bookmarks Sina Weibo QQ Renren Tieba Kaixin Douban Taobao

    Warning: This tool is a beta version, it may cause unexpected error. Never play it in any crytical system!

    New Features: 

    *  Flexible function parameters setting 

#Example: _kcbgtcr*-1 (8*1, 4)
#   _kcbgtcr is call name#
#   *-1: print whole call stack when the call be traced;
#   (8*1, 0): Detect 2 arguments value.
#                  The first argument is a pointer with 1 recursive deep, it point to 8 byte data;
#                  The second argument is unkown, let me detect it.
 

    Note: Previous setting ArgNum*PointerDeep has been obsoleted!

    For example, you want to trace the consistent gets calling.

  Set TracePoints.txt as below:

SQL代码
  1. _kcbgtcr (8*1)  

    Then trace a session and execute a query in the session:

SQL代码
  1. HELLODBA.COM>select * from demo.tt;   
  2.   
  3.          X   
  4. ----------   
  5.          8   
  6.         10   
  7.         10   
  8.         11   
  9.          1   
  10.          1   
  11.          2   
  12.          3   
  13.   
  14. rows selected.  

    And you will get the call tracing log from log window:

SQL代码
  1. [2010-6-1 8:5:27.986]User call: _kcbgtcr (TID: 3804)    
  2.     [Args(1)]:    
  3.         0x84dd204(=>0x050000004be64001)   
  4. [2010-6-1 8:5:27.986]User call: _kcbgtcr (TID: 3804)    
  5.     [Args(1)]:    
  6.         0x84dd018(=>0x050000004be64001)   
  7. [2010-6-1 8:5:28.2]User call: _kcbgtcr (TID: 3804)    
  8.     [Args(1)]:    
  9.         0x73731c0(=>0x050000004ce64001)   
  10. [2010-6-1 8:5:28.17]User call: _kcbgtcr (TID: 3804)    
  11.     [Args(1)]:    
  12.         0x73731c0(=>0x050000004ce64001)   
  13. [2010-6-1 8:5:28.33]User call: _kcbgtcr (TID: 3804)    
  14.     [Args(1)]:    
  15.         0x73731c0(=>0x050000004de64001)   
  16. [2010-6-1 8:5:28.49]User call: _kcbgtcr (TID: 3804)    
  17.     [Args(1)]:    
  18.         0x73731c0(=>0x050000004ee64001)   
  19. [2010-6-1 8:5:28.64]User call: _kcbgtcr (TID: 3804)    
  20.     [Args(1)]:    
  21.         0x73731c0(=>0x050000004fe64001)   
  22. [2010-6-1 8:5:28.64]User call: _kcbgtcr (TID: 3804)    
  23.     [Args(1)]:    
  24.         0x73731c0(=>0x0500000050e64001)  

   Here you get 8 times calling, whose first argment contents the data block address (DBA).

   Let review it's statistics data:

SQL代码
  1. HELLODBA.COM>select * from demo.tt;   
  2.   
  3. rows selected.   
  4.   
  5.   
  6. Execution Plan   
  7. ----------------------------------------------------------   
  8. Plan hash value: 264906180   
  9.   
  10. --------------------------------------------------------------------------   
  11. | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |   
  12. --------------------------------------------------------------------------   
  13. |   0 | SELECT STATEMENT  |      |     8 |    24 |     2   (0)| 00:00:03 |   
  14. |   1 |  TABLE ACCESS FULL| TT   |     8 |    24 |     2   (0)| 00:00:03 |   
  15. --------------------------------------------------------------------------   
  16.   
  17.   
  18. Statistics  
  19. ----------------------------------------------------------   
  20.           0  recursive calls   
  21.           0  db block gets   
  22.           8  consistent gets   
  23.           0  physical reads   
  24.           0  redo size  
  25.         485  bytes sent via SQL*Net to client   
  26.         385  bytes received via SQL*Net from client   
  27.           2  SQL*Net roundtrips to/from client   
  28.           0  sorts (memory)   
  29.           0  sorts (disk)   
  30.           8  rows processed  

   8 consistent gets!

    * Disassembling to ASM code

    To disassemble a function, just input the funcation name in the editor, for example, _opiprs. Then click "Disassemble" button. You will get its ASM code from log window.

SQL代码
  1. Disassembling ORACLE.EXE!_opiprs    
  2.   00EB31C4: INT3    ;    
  3.   00EB31C5: MOV EBP, ESP    ;    
  4.   00EB31C7: SUB ESP, 10 ;    
  5.   00EB31CA: MOV DWORD PTR SS:[EBP-10H],EDI  ;    
  6.   00EB31CD: MOV DWORD PTR SS:[EBP-0CH],ESI  ;    
  7.   00EB31D0: MOV DWORD PTR SS:[EBP-08H],EBX  ;    
  8.   00EB31D3: MOV EDI,DWORD PTR SS:[EBP+14H]  ;    
  9. ...  

   Enjoy the new features!

    Download new version at here:

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

    --- Fuyuncat ---

Top

Copyright ©2005, HelloDBA.Com All reseverd.

Declaration
by fuyuncat