檢視oracle中是否有鎖表的sql,具體是那個使用者那個程序造成死鎖,鎖的級別等。
1、檢視是否有鎖表的sql
select 'blocker('||lb.sid||':'||sb.username||')-sql:'|| qb.sql_text blockers,
'waiter ('||lw.sid||':'||sw.username||')-sql:'|| qw.sql_text waiters
from v$lock lb,
v$lock lw,
v$session sb,
v$session sw,
v$sql qb,
v$sql qw
where lb.sid=sb.sid
and lw.sid=sw.sid
and sb.prev_sql_addr=qb.address
and sw.sql_address=qw.address
and lb.id1=lw.id1
and sw.lockwait is not null
and sb.lockwait is null
and lb.block=1 ;
2、檢視被鎖的表
select p.spid,a.serial#,c.object_name,b.session_id,b.oracle_username,b.os_user_name
from v$process p,v$session a, v$locked_object b,all_objects c --www.jbxue.com
where p.addr=a.paddr and a.process=b.process and c.object_id=b.object_id ;
3、檢視那個使用者那個程序造成死鎖,鎖的級別
select b.owner,b.object_name,l.session_id,l.locked_mode fromv$locked_object l, dba_objects
4、檢視連線的程序
select sid, serial#, username, osuser fromv$session;
5、檢視是哪個session引起的
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;
6、殺掉程序
alter system kill session 'sid,serial#';
此處的sid是第5步查詢出的sid和serid 。 檢視Oracle中是否有鎖表的sql
檢視oracle中是否有鎖表的sql,具體是那個使用者那個程序造成死鎖,鎖的級別等等,感興趣的朋友可以參考下 1 檢視是否有鎖表的sql 複製 如下 select blocker lb.sid sb.username sql qb.sql text blockers,waiter lw.sid sw...
檢視Oracle中是否有鎖表的sql
1 檢視是否有鎖表的sql select blocker lb.sid sb.username sql qb.sql text blockers,waiter lw.sid sw.username sql qw.sql text waiters from v lock lb,v lock lw,v ...
檢視Oracle中是否有鎖表的sql
1 檢視是否有鎖表的sql 複製 如下 select blocker lb.sid sb.username sql qb.sql text blockers,waiter lw.sid sw.username sql qw.sql text waiters from v lock lb,v lock...