直接上菜:
select username,lockwait,status,machine,program from v$session where sid in
(select session_id from v$locked_object)
select sql_text from v$sql where hash_value in(select sql_hash_value from v$session where sid in
(select session_id from v$locked_object))
--查询数据库所有死锁进程
SELECT s.username,l.OBJECT_ID,l.SESSION_ID,s.SERIAL#,l.ORACLE_USERNAME,l.OS_USER_NAME,l.PROCESS
FROM V$LOCKED_OBJECT l,V$SESSION S WHERE l.SESSION_ID=S.SID;
---查出 SESSION_ID,SERIAL#
杀死进程:
alter system kill session '21,17293';
21--SESSION_ID; 17293--SERIAL#