oracle檢視被鎖的表和解鎖

2022-09-23 00:52:11 字數 1367 閱讀 5703

--以下幾個為相關表

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

';

170308 oracle檢視被鎖的表和解鎖

以下幾個為相關表 select from v lock select from v sqlarea select from v sessio...

Oracle的表被鎖後的恢復

執行下列sql,找出資料庫的serial 執行結果如下圖所示 select t2 username t2 sid t2 serial t2 logon time from v locked object t1 v session t2 where t1 session id t2 sid order...

Oracle 表物件被鎖的解決辦法

1 下面的語句用來查詢哪些物件被鎖 select object name machine s sid s serial from v loc...