oracle鎖表與解鎖表方法

2021-10-06 12:00:00 字數 1346 閱讀 6544

–以下幾個為主要相關表

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;

–檢視被鎖的表

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;

–檢視連線的程序

select sid,

serial

#, username, osuser from v$session;

–3.查出鎖定表的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

notnull

order

by sid;

這個語句將查詢到資料庫中所有的dml語句產生的鎖,還可以發現,

任何dml語句其實產生了兩個鎖,乙個是表鎖,乙個是行鎖。

–殺掉程序『 sid,serial#』

alter system kill

session

'210,11562'

;

Oracle表被鎖,解鎖方法

1.下面的語句用來查詢哪些物件被鎖 select object name,machine,s.sid,s.serial from v locked object l,dba objects o v session s where l.object id o.object id and l.sessi...

Oracle的鎖表與解鎖

select rule s.username,decode l.type,tm table lock tx row lock null lock level,o.owner,o.object name,o.object type,s.sid,s.serial s.terminal,s.machine...

Oracle的鎖表與解鎖

select rule s.username,decode l.type,tm table lock tx row lock null lock level,o.owner,o.object name,o.object type,s.sid,s.serial s.terminal,s.machine...