(Oracle)批量生成2PC_PENDING 处理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';

你可能感兴趣的:(oraclesql批量分布式锁)