SELECT /*+ ORDERED */ sql_text FROM v$sqltext a WHERE (a.hash_value, a.address) IN ( SELECT DECODE (sql_hash_value, 0, prev_hash_value, sql_hash_value ...
一、通過系統進程id查找sql語句
1 SELECT /*+ ORDERED */ 2 sql_text 3 FROM v$sqltext a 4 WHERE (a.hash_value, a.address) IN ( 5 SELECT DECODE (sql_hash_value, 6 0, prev_hash_value, 7 sql_hash_value 8 ), 9 DECODE (sql_hash_value, 0, prev_sql_addr, sql_address) 10 FROM v$session b 11 WHERE b.paddr = (SELECT addr 12 FROM v$process c 13 WHERE c.spid = '&pid')) ----->&pid是系統進程id 14 ORDER BY piece ASC 15 /
二 、通過sid查找sql語句
1 select sql_text 2 from v$sqlarea sq,v$session se 3 where sq.SQL_ID = se.SQL_ID 4 and se.sid='&sid';
三、刪除當前語句
1 通過SID查詢會話 2 select sid,serial# 3 from v$session where sid='&sid'; 4 5 根據sid,serial# 值刪除會話 6 alter system kill session '&sid,&serial#';