回覆列表
-
1 # 使用者3923567137517
-
2 # Peak1997scenery
--檢視被鎖的表 select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id; --檢視那個使用者那個程序照成死鎖 select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id =
b.sid
order by b.logon_time;
Oracle資料庫操作中,我們有時會用到鎖表查詢以及解鎖和kill程序等操作,那麼這些操作是怎麼實現的呢?本文我們主要就介紹一下這部分內容。(1)鎖表查詢的程式碼有以下的形式:select count(*) from v$locked_object;select * from v$locked_object;(2)檢視哪個表被鎖select b.owner,b.object_name,a.session_id,a.locked_mode from v$locked_object a,dba_objects b where b.object_id = a.object_id;(3)檢視是哪個session引起的select b.username,b.sid,b.serial#,logon_time from v$locked_object a,v$session b where a.session_id = b.sid order by b.logon_time; (4)殺掉對應程序執行命令:alter system kill session"1025,41";其中1025為sid,41為serial#.