補充1:
根據pid找到sql語句
SELECT
sql_text,hash_value
FROM v$sqltext a
WHERE (a.hash_value, a.address) IN (
SELECT DECODE (sql_hash_value,
0, prev_hash_value,
sql_hash_value
),
DECODE (sql_hash_value, 0, prev_sql_addr, sql_address)
FROM v$session b
WHERE b.paddr = (SELECT addr
FROM v$process c
WHERE c.spid = '&pid'))
ORDER BY piece ASC
補充2:
根據pid,找到sid,serial#,再刪除
select sid,serial# FROM v$session b
WHERE b.paddr = (SELECT addr
FROM v$process c
WHERE c.spid = '&pid')
ORDER BY piece ASC
說明: 這里的v$process的spid-就是top中的pid
補充3:
根據sid,serial#,找到PID=
Select c.spid from v$process c where c.addr=(select b.paddr from v$session b where b.sid= ' ' and b.serial#= ' ')