col table_name format ax;
从客户端 跟踪SQL到oracle。。
首先准备以下工具
Oracle client:sqlplus
Oracle server: 10g
OS command:netstat
Oracle dynamic Views:
v$transaction;
v$session;
v$sql;
v$process;
SQL> select addr,ses_addr from v$transaction;
ADDR SES_ADDR
-------- --------
BD72B664 BF4E77E4
SQL> select saddr,sid,paddr,prev_sql_addr,username,status from v$session where saddr = 'BF4E77E4';
SADDR SID PADDR PREV_SQL USERNAME STATUS
-------- ---------- -------- -------- -------------------- ----------------
BF4E77E4 144 BF31BCF4 B623C21C ZYJG INACTIVE
SQL> select addr,spid from v$process where addr = 'BF31BCF4';
ADDR SPID
-------- ------------------------------------------------
BF31BCF4 4172
接下来就查看和SPID相同的进程号
DOS下:C:/Users/Administrator>tasklist /fi "PID eq 4172"
linux下:ps -ef | grep 4172
netstat -anp | more 然后找pid为4172的进程。
就可以查看到对应的进程。
SQL> select sql_text,address from v$sql where address = 'B623C21C';
SQL_TEXT ADDRESS
------------------------------------------------------------- ---------------------------
insert into john_test values (3,'222') B623C21C
参考图片: