鎖表查詢 處理

2021-10-13 05:36:22 字數 1234 閱讀 9711

--以下幾個為相關表

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;

1、saddr  --session address session位址

2、sid --session identifier session id

--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 not null

order by sid;

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

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

--殺掉程序 sid,serial#

alter system kill session'210,11562';

Oracle 鎖表 鎖表查詢 結束鎖表程序

1.oracle 鎖表 lock table 表名字in exclusive mode 所記錄 select from 表名字 for update 2.oracle 鎖表查詢 selectb.owner,b.object name,a.session id,a.locked mode from v...

Oracle鎖表處理

1 查詢出被鎖的表的session id,和serial select l.session id sid,s.serial l.locked mode,l.oracle username,l.os user name,s.machine,s.terminal,o.object name,s.logo...

oracle鎖表處理

1 select from v locked object 查出被鎖定的物件,其中object id是物件的id,session id是被鎖定物件有session id 2 select object name,object type from dba objects where object id...