oracle锁表查询

select machine,a.sid,a.serial#,blocking_session,username,event,a.sql_id,b.sql_text 
from v$session a,v$sql b,v$lock c
 where a.prev_sql_id=b.sql_id 
     and  a.sid=c.sid 
     and c.type in('TX','TM');
     
select b.username,b.sid,b.serial#,logon_time,'ALTER SYSTEM KILL SESSION '''||b.sid||','||b.serial#||',@'||b.inst_id||''';' kill_sql
from v$locked_object a,gv$session b
where a.session_id = b.sid order by b.logon_time;

你可能感兴趣的:(oracle)