关于oracle:Oracle批量生成2PCPENDING-处理SQL分布式锁

31次阅读

共计 404 个字符,预计需要花费 2 分钟才能阅读完成。

着眼立刻解决问题,只生成解决命令,commit; 必须执行
相干起因自行搜寻查找

 set lines 150 pagesize 1000;
 col PURGE_CMD for a150;
 select 'execute DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('''||LOCAL_TRAN_ID||''');'||chr(10)||'commit;' as PURGE_CMD
  from DBA_2PC_PENDING
 where STATE in ('collecting', 'committed', 'forced rollback', 'forced commit')
 union all 
 select 'rollback force'''||LOCAL_TRAN_ID||''';'||chr(10)||'commit;' as PURGE_CMD
  from DBA_2PC_PENDING
 where STATE = 'prepared';

正文完
 0