[20160816]使用oradebug跟蹤sql net.txt

lfree發表於2016-08-16

[20160816]使用oradebug跟蹤sql net.txt

--可以oradebug跟蹤包,可以不用修改sqlnet.ora等檔案引數,做一個記錄。

1.環境:
SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

SYS@book> oradebug patch list

Patch File Name                                   State
================                                =========
No patches currently installed

--從客戶端連線(透過網路)

SCOTT@78> @ spid
       SID    SERIAL# SPID       PID  P_SERIAL# C50
---------- ---------- ------ ------- ---------- --------------------------------------------------
       112       4469 5490        34         10 alter system kill session '112,4469' immediate;

--以sys使用者登入:
SYS@book> oradebug setospid 5490
Oracle pid: 34, Unix process pid: 5490, image: oracle@xxxxxxx
SYS@book> oradebug dump event_tsm_test 16
Statement processed.
SYS@book> oradebug dump sqlnet_server_trace 16
Statement processed.

SYS@book> oradebug tracefile_name
/u01/app/oracle/diag/rdbms/book/book/trace/book_ora_5490.trc

--簡單的client執行
SCOTT@78> select 'abcdef' from dual;
'ABCDE
------
abcdef

--注意如果傳輸很大,我的測試有點慢。

--檢視跟蹤檔案:
*** 2016-08-16 08:30:13.645
2016-08-16 08:30:13.645566 : nttrd:socket 16 had bytes read=282
2016-08-16 08:30:13.645656 : nttrd:exit
2016-08-16 08:30:13.645678 : nsprecv:282 bytes from transport
2016-08-16 08:30:13.645699 : nsprecv:tlen=282, plen=282, type=6
2016-08-16 08:30:13.645718 : nsprecv:packet dump
2016-08-16 08:30:13.645742 : nsprecv:01 1A 00 00 06 00 00 00  |........|
2016-08-16 08:30:13.645764 : nsprecv:00 00 11 69 1D FE FF FF  |...i....|
2016-08-16 08:30:13.645783 : nsprecv:FF FF FF FF FF 01 00 00  |........|
2016-08-16 08:30:13.645804 : nsprecv:00 03 00 00 00 03 5E 1E  |......^.|
2016-08-16 08:30:13.645823 : nsprecv:61 80 00 00 00 00 00 00  |a.......|
2016-08-16 08:30:13.645843 : nsprecv:FE FF FF FF FF FF FF FF  |........|
2016-08-16 08:30:13.645862 : nsprecv:19 00 00 00 FE FF FF FF  |........|
2016-08-16 08:30:13.645882 : nsprecv:FF FF FF FF 0D 00 00 00  |........|
2016-08-16 08:30:13.645901 : nsprecv:FE FF FF FF FF FF FF FF  |........|
2016-08-16 08:30:13.645920 : nsprecv:FE FF FF FF FF FF FF FF  |........|
2016-08-16 08:30:13.645940 : nsprecv:00 00 00 00 01 00 00 00  |........|
2016-08-16 08:30:13.645959 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.645979 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.645998 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.646018 : nsprecv:FE FF FF FF FF FF FF FF  |........|
2016-08-16 08:30:13.646038 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.646057 : nsprecv:FE FF FF FF FF FF FF FF  |........|
2016-08-16 08:30:13.646077 : nsprecv:FE FF FF FF FF FF FF FF  |........|
2016-08-16 08:30:13.646096 : nsprecv:FE FF FF FF FF FF FF FF  |........|
2016-08-16 08:30:13.646115 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.646134 : nsprecv:FE FF FF FF FF FF FF FF  |........|
2016-08-16 08:30:13.646153 : nsprecv:FE FF FF FF FF FF FF FF  |........|
2016-08-16 08:30:13.646173 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.646221 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.646242 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.646262 : nsprecv:00 00 00 00 19 73 65 6C  |.....sel|
2016-08-16 08:30:13.646282 : nsprecv:65 63 74 20 27 61 62 63  |ect.'abc|
2016-08-16 08:30:13.646303 : nsprecv:64 65 66 27 20 66 72 6F  |def'.fro|
2016-08-16 08:30:13.646323 : nsprecv:6D 20 64 75 61 6C 01 00  |m.dual..|
2016-08-16 08:30:13.646343 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.646362 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.646382 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.646402 : nsprecv:00 00 01 00 00 00 00 00  |........|
2016-08-16 08:30:13.646422 : nsprecv:00 00 00 80 00 00 00 00  |........|
2016-08-16 08:30:13.646442 : nsprecv:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.646461 : nsprecv:00 00                    |..      |
2016-08-16 08:30:13.646479 : nsprecv:normal exit
...

2016-08-16 08:30:13.650931 : nspsend:packet dump
2016-08-16 08:30:13.650953 : nspsend:01 0C 00 00 06 00 00 00  |........|
2016-08-16 08:30:13.650975 : nspsend:00 00 10 17 00 00 00 CF  |........|
2016-08-16 08:30:13.650995 : nspsend:D9 8F F2 87 6D 45 AD D2  |....mE..|
2016-08-16 08:30:13.651016 : nspsend:78 B5 96 69 64 A2 64 78  |x..id.dx|
2016-08-16 08:30:13.651036 : nspsend:74 08 10 09 1F 0E 06 00  |t.......|
2016-08-16 08:30:13.651056 : nspsend:00 00 01 00 00 00 51 60  |......Q`|
2016-08-16 08:30:13.651076 : nspsend:80 00 00 06 00 00 00 00  |........|
2016-08-16 08:30:13.651096 : nspsend:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.651116 : nspsend:00 00 00 00 00 54 03 01  |.....T..|
2016-08-16 08:30:13.651136 : nspsend:06 00 00 00 01 08 08 00  |........|
2016-08-16 08:30:13.651156 : nspsend:00 00 08 27 41 42 43 44  |...'ABCD|
2016-08-16 08:30:13.651175 : nspsend:45 46 27 00 00 00 00 00  |EF'.....|
2016-08-16 08:30:13.651212 : nspsend:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.651233 : nspsend:00 07 00 00 00 07 78 74  |......xt|
2016-08-16 08:30:13.651274 : nspsend:08 10 09 1F 0E 00 00 00  |........|
2016-08-16 08:30:13.651295 : nspsend:00 E8 1F 00 00 02 00 00  |........|
2016-08-16 08:30:13.651315 : nspsend:00 02 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.651335 : nspsend:00 06 22 01 00 00 00 00  |..".....|
2016-08-16 08:30:13.651355 : nspsend:00 01 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.651374 : nspsend:00 00 00 00 00 00 00 07  |........|
2016-08-16 08:30:13.651394 : nspsend:06 61 62 63 64 65 66 08  |.abcdef.|
2016-08-16 08:30:13.651414 : nspsend:06 00 28 04 86 15 03 00  |..(.....|
2016-08-16 08:30:13.651434 : nspsend:00 00 02 00 00 00 00 00  |........|
2016-08-16 08:30:13.651454 : nspsend:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.651473 : nspsend:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.651516 : nspsend:00 00 04 01 00 00 00 1C  |........|
2016-08-16 08:30:13.651536 : nspsend:00 01 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.651556 : nspsend:00 00 00 02 00 15 00 03  |........|
2016-08-16 08:30:13.651576 : nspsend:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.651596 : nspsend:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.651615 : nspsend:00 00 00 00 00 00 00 1E  |........|
2016-08-16 08:30:13.651635 : nspsend:00 00 01 00 00 00 00 00  |........|
2016-08-16 08:30:13.651654 : nspsend:00 00 00 00 00 00 00 00  |........|
2016-08-16 08:30:13.651675 : nspsend:00 00 00 00              |....    |
2016-08-16 08:30:13.651695 : nspsend:268 bytes to transport
2016-08-16 08:30:13.651713 : nspsend:normal exit

--關閉:
SYS@book> oradebug dump event_tsm_test 0
Statement processed.
SYS@book> oradebug dump sqlnet_server_trace 0
Statement processed.

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2123538/,如需轉載,請註明出處,否則將追究法律責任。

相關文章