[中文]
Author:
fuyuncat
Source:
www.HelloDBA.com
Date:
2010-06-01 08:27:13
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代码
- _kcbgtcr (8*1)
Then trace a session and execute a query in the session:
SQL代码
- HELLODBA.COM>select * from demo.tt;
- X
- ----------
- 8
- 10
- 10
- 11
- 1
- 1
- 2
- 3
- 8 rows selected.
And you will get the call tracing log from log window:
SQL代码
- [2010-6-1 8:5:27.986]User call: _kcbgtcr (TID: 3804)
- [Args(1)]:
- 0x84dd204(=>0x050000004be64001)
- [2010-6-1 8:5:27.986]User call: _kcbgtcr (TID: 3804)
- [Args(1)]:
- 0x84dd018(=>0x050000004be64001)
- [2010-6-1 8:5:28.2]User call: _kcbgtcr (TID: 3804)
- [Args(1)]:
- 0x73731c0(=>0x050000004ce64001)
- [2010-6-1 8:5:28.17]User call: _kcbgtcr (TID: 3804)
- [Args(1)]:
- 0x73731c0(=>0x050000004ce64001)
- [2010-6-1 8:5:28.33]User call: _kcbgtcr (TID: 3804)
- [Args(1)]:
- 0x73731c0(=>0x050000004de64001)
- [2010-6-1 8:5:28.49]User call: _kcbgtcr (TID: 3804)
- [Args(1)]:
- 0x73731c0(=>0x050000004ee64001)
- [2010-6-1 8:5:28.64]User call: _kcbgtcr (TID: 3804)
- [Args(1)]:
- 0x73731c0(=>0x050000004fe64001)
- [2010-6-1 8:5:28.64]User call: _kcbgtcr (TID: 3804)
- [Args(1)]:
- 0x73731c0(=>0x0500000050e64001)
Here you get 8 times calling, whose first argment contents the data block address (DBA).
Let review it's statistics data:
SQL代码
- HELLODBA.COM>select * from demo.tt;
- 8 rows selected.
- Execution Plan
- ----------------------------------------------------------
- Plan hash value: 264906180
- --------------------------------------------------------------------------
- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
- --------------------------------------------------------------------------
- | 0 | SELECT STATEMENT | | 8 | 24 | 2 (0)| 00:00:03 |
- | 1 | TABLE ACCESS FULL| TT | 8 | 24 | 2 (0)| 00:00:03 |
- --------------------------------------------------------------------------
- Statistics
- ----------------------------------------------------------
- 0 recursive calls
- 0 db block gets
- 8 consistent gets
- 0 physical reads
- 0 redo size
- 485 bytes sent via SQL*Net to client
- 385 bytes received via SQL*Net from client
- 2 SQL*Net roundtrips to/from client
- 0 sorts (memory)
- 0 sorts (disk)
- 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代码
- Disassembling ORACLE.EXE!_opiprs
- 00EB31C4: INT3 ;
- 00EB31C5: MOV EBP, ESP ;
- 00EB31C7: SUB ESP, 10 ;
- 00EB31CA: MOV DWORD PTR SS:[EBP-10H],EDI ;
- 00EB31CD: MOV DWORD PTR SS:[EBP-0CH],ESI ;
- 00EB31D0: MOV DWORD PTR SS:[EBP-08H],EBX ;
- 00EB31D3: MOV EDI,DWORD PTR SS:[EBP+14H] ;
- ...
Enjoy the new features!
Download new version at here:
http://www.HelloDBA.com/Download/OraTracer.zip
--- Fuyuncat ---