乐趣区

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

着眼立刻解决问题,只生成解决命令,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';
退出移动版