Oracle檢視正在執行的SQL,當前被鎖物件以及解鎖物件
阿新 • • 發佈:2018-11-12
1、檢視正在執行的SQL
SELECT b.sid,
b.username,
b.serial#,
spid,
paddr,
sql_text,--正在執行的SQL,
b.machine --計算機名
FROM v$process a, v$session b, v$sqlarea c
WHERE a.addr = b.paddr AND b.sql_hash_value = c.hash_value
2、檢視oracle當前的被鎖物件
SELECT l.session_id, s.serial#, l.locked_mode, l.oracle_username, l.os_user_name, s.machine, s.terminal, o.object_name, s.logon_time FROM v$locked_object l, all_objects o, v$session s WHERE l.object_id = o.object_id AND l.session_id = s.sid
3、解鎖物件
alter system kill session 'session_id,s.serial#';