标签:
--查询阻塞的sql( 死锁了,没有执行通过的sql ) select * from pg_stat_activity aa, ( select a.locktype,a.database,a.pid,a.mode,a.relation,b.relname from pg_locks a join pg_class b on a.relation=b.oid where upper(b.relname)=‘FX_WDSJ_DSZH‘ ) bb where aa.pid=bb.pid and aa.waiting=‘t‘ --释放 死锁的sql select pg_cancel_backend(上面查询到的pid) --查询是否锁表了 select oid from pg_class where relname=‘可能锁表了的表‘ --oid是每个表隐藏的id select pid from pg_locks where relation=‘上面查出的oid‘ --如果查询到了结果 则释放锁定 select pg_cancel_backend(上面查到的pid)
标签:
原文地址:http://my.oschina.net/u/877170/blog/377404