Monthly Archives: 07月 2013

ORACLE 锁表的解决方法及查找引起锁表SQL语句方法

2013-07-31 by Jinyang | No Comments | Filed in Oracle

1. ORACLE中查看当前系统中锁表情况 select * from v$locked_object 可以通过查询v$locked_object拿到sid和objectid,然后用sid和v$session链表查询是哪里锁的表,用v$session中的objectid字段和dba_objects的id字段关联,查询详细的锁表情况。 查询SQL如下: 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$session sess, v$process p where ao.object_id = lo.object_id and lo.session_id = sess.sid; 查询是什么SQL引起了锁表的原因,SQL如下: select l.session_id sid, s.serial#, l.locked_mode, l.oracle_username, s.user#, l.os_user_name, s.machine, s.terminal, a.sql_text, a.action from v$sqlarea a, v$session s, v$locked_object l where l.session_id = […]

返回顶部