oracle鎖表檢視被鎖的表和解鎖

2022-02-28 05:17:55 字數 1282 閱讀 1711

--

以下幾個為相關表

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

byb.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

bysid;

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

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

--殺掉程序 sid,serial#

alter system kill session'

210,11562

oracle中檢視和刪除被鎖表

grant alter system to sa grant select on v lock to sa grant select on all objects to sa create or replace procedure d debug asv index varchar2 40 v ta...

ORACLE檢視鎖表

以下幾個為相關表 select from vloc k se lect fro mv lock select from v lock s elec t fr omvsqlarea select from vses sion sel ect from vsession select from v se...

Oracle檢視鎖表

檢視鎖表程序sql語句1 select sess.sid,sess.serial lo.oracle username,lo.os user name,ao.object name,lo.locked mode from v locked object lo,dba objects ao,v ses...