oracle中檢視和刪除被鎖表

2021-05-23 12:19:45 字數 1319 閱讀 7122

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_table varchar2(40);

v_sql varchar2(100);

cursor c_fk is

select sid, serial#

from v$session

where sid in (select a.sid from v$lock a, all_objects b

where type = 'tm'

and a.id1 = b.object_id);

begin

open c_fk;

loop

fetch c_fk into v_table,v_index;

exit when c_fk%notfound;

v_sql:='alter system kill session ('||v_table||', '||v_index||')';

execute immediate v_sql;

end loop;

close c_fk;

end;

oracle中檢視表是否被鎖

檢視表是否被鎖

select

a.sid, b.owner, object_name, object_type

from v$lock a, all_objects b

where type = 'tm'

and a.id1 = b.object_id;

查到的都是被鎖的表

這樣可以把它殺掉

select sid,serial# from v$session where sid = &sid;

alter system kill session 『sid,serial#』;

合成查詢

select

sid,

serial#

from

v$session

where

sid in (select

a.sid

from

v$lock a,

all_objects b

where

type = 'tm' and

a.id1 = b.object_id

)

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檢視被鎖的表和解鎖

檢視鎖表程序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...