Oracle 查询正在被锁住的操作并结束

使用SQL Developer执行SQL语句老是有一直执行没反应的情况,特意查询了一下查看pending的语句,如下:

select a.session_id, c.serial#, a.locked_mode, a.oracle_username, a.os_user_name, c.machine,
       c.terminal, b.object_name, c.logon_time
from   v$locked_object a, all_objects b, v$session c
where  a.object_id = b.object_id and a.session_id = c.sid
order  by c.sid, c.serial#; 

查询正在执行的SQL:

select a.program, b.spid, c.sql_text,c.SQL_ID
from v$session a, v$process b, v$sqlarea c
where a.paddr = b.addr
and a.sql_hash_value = c.hash_value
and a.username is not null;

解除锁定:

alter system kill session 'spid,sessionid' ;

 

你可能感兴趣的:(以备不时之需)