How to detect and cleanup pending transactions in Oracle?

匿名网友 匿名网友 发布于: 2015-08-30 00:00:00
阅读 95 收藏 0 点赞 0 评论 0

Usually pending transactions clear up on their own. If not, read on.
If you have a pending transaction that will not go away then check the pending states with the following query:
SELECT local_tran_id, state, mixed
FROM dba_2pc_pending;
Pending transactions can be in any of the following states :
collecting, committed, prepared, forced commit, forced rollback
If the transaction is in the ‘prepared’ state then run
COMMIT FORCE ‘<local_tran_id>’;
or
ROLLBACK FORCE ‘<local_tran_id>’;
If the transaction is any state (other than ‘prepared’) and the transaction is not resolving then Log in as ‘SYS’ and run the following script
exec dbms_transaction.purge_lost_db_entry(<local_tran_id>);

Usually pending transactions clear up on their own. If not, read on.

If you have a pending transaction that will not go away then check the pending states with the following query:

SELECT local_tran_id, state, mixed

FROM dba_2pc_pending;

Pending transactions can be in any of the following states :

collecting, committed, prepared, forced commit, forced rollback

If the transaction is in the ‘prepared’ state then run

COMMIT FORCE ‘<local_tran_id>’;

or

ROLLBACK FORCE ‘<local_tran_id>’;

If the transaction is any state (other than ‘prepared’) and the transaction is not resolving then Log in as ‘SYS’ and run the following script

exec dbms_transaction.purge_lost_db_entry(<local_tran_id>);

评论列表
文章目录