SQL> select distinct sid from v$mystat;
SID
----------
357
SQL> select spid from v$process p,v$session s where p.addr=s.paddr and s.sid=357;
SPID
------------------------------------------------
9100
2.另外开一个窗口,设置10046
SQL> conn / as sysdba
SQL> oradebug setospid 9100;
SQL> oradebug event 10046 trace name context forever,level 12;
执行下边的语句可以么?
SELECT b.sid oracleID,b.username 登录Oracle用户名,b.serial#,spid 操作系统ID,
paddr,sql_text 正在执行的SQL,b.machine 计算机名 FROM v$session b left join
v$process a on a.addr =b.paddr left join
v$sqlarea c on b.sql_hash_value = c.hash_value;