--以下幾個(gè)為相關(guān)表
SELECT * FROM v$lock;
SELECT
* FROM v$sqlarea;
SELECT * FROM v$session;
SELECT * FROM v$process
;
SELECT * FROM v$locked_object;
SELECT * FROM all_objects;
SELECT *
FROM v$session_wait;
創(chuàng)新互聯(lián)公司企業(yè)建站,十載網(wǎng)站建設(shè)經(jīng)驗(yàn),專(zhuān)注于網(wǎng)站建設(shè)技術(shù),精于網(wǎng)頁(yè)設(shè)計(jì),有多年建站和網(wǎng)站代運(yùn)營(yíng)經(jīng)驗(yàn),設(shè)計(jì)師為客戶打造網(wǎng)絡(luò)企業(yè)風(fēng)格,提供周到的建站售前咨詢和貼心的售后服務(wù)。對(duì)于成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站中不同領(lǐng)域進(jìn)行深入了解和探索,創(chuàng)新互聯(lián)在網(wǎng)站建設(shè)中充分了解客戶行業(yè)的需求,以靈動(dòng)的思維在網(wǎng)頁(yè)中充分展現(xiàn),通過(guò)對(duì)客戶行業(yè)精準(zhǔn)市場(chǎng)調(diào)研,為客戶提供的解決方案。
--查看被鎖的表
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;
--查看那個(gè)用戶那個(gè)進(jìn)程照成死鎖
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;
--查看連接的進(jìn)程
SELECT sid, serial#, username, osuser FROM v$session;
--****查出鎖定表的sid, serial#,os_user_name, machine_name,
terminal,鎖的type,mode
SELECT s.sid, s.serial#, s.username,
s.schemaname, s.osuser, s.process, s.machine,
s.terminal, s.logon_time,
l.type
FROM v$session s, v$lock l
WHERE s.sid = l.sid
AND s.username IS
NOT NULL
ORDER BY sid;
這個(gè)語(yǔ)句將查找到數(shù)據(jù)庫(kù)中所有的DML語(yǔ)句產(chǎn)生的鎖,還可以發(fā)現(xiàn),
任何DML語(yǔ)句其實(shí)產(chǎn)生了兩個(gè)鎖,一個(gè)是表鎖,一個(gè)是行鎖。
--*****殺掉進(jìn)程 sid,serial#
alter system kill session
'210,11562';