oracle檢視被鎖的表和解鎖

2021-09-13 08:54:18 字數 1563 閱讀 7273

–以下幾個為相關表

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

sessio

n;se

lect

∗fro

mvprocess ;

select * from vloc

kedo

bjec

t;se

lect

∗fro

mall

obje

cts;

sele

ct∗f

romv

locked_object; select * from all_objects; select * from v

locked

o​bj

ect;

sele

ct∗f

roma

llo​

bjec

ts;s

elec

t∗fr

omvsession_wait;

–檢視被鎖的表

select b.owner,b.object_name,a.session_id,a.locked_mode from vkatex parse error: expected 'eof', got '#' at position 113: …,b.sid,b.serial#̲,logon_time fro…locked_object a,vkatex parse error: expected 'eof', got '#' at position 90: …ect sid, serial#̲, username, osu…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 vses

sion

s,

vsession s, v

sessio

ns,v

lock l

where s.sid = l.sid

and s.username is not null

order by sid;

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

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

–殺掉程序 sid,serial#

alter system kill session』210,11562』;

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

oracle檢視被鎖的表和解鎖

以下幾個為相關表 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 sele...

oracle檢視被鎖的表和解鎖

以下幾個為相關表 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 sele...