【ORACLE】查锁及解锁命令

--查询行锁语句

select sql_text from v$sql a,v$session b
where a.sql_id=b.sql_id and b.event='enq: TX - row lock contention';

--找到被锁定的表

SELECT object_name, machine, s.sid, s.serial#
FROM gv$locked_object l, dba_objects o, gv$session s
WHERE l.object_id = o.object_id
AND l.session_id = s.sid;

查询出来的sid、和serial#结果列,作为解锁的参数

--解锁命令

ALTER SYSTEM KILL SESSION 'sid,serial#';

例:

SQL> alter system kill session '25,34578';

System altered.

你可能感兴趣的:(oracle,oracle,sql,数据库)