How to detect and cleanup pending transactions in Oracle?

Oracle

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>);

同类其他面试题 点击新一篇或旧一篇可浏览全部同类面试题

新一篇:
旧一篇:

你有答案? 你对以上面试题有意见? 你想发表你的见解? 写下来吧!你的分享将会让很多人受益!

相关面试题

·如何查询表空间总量,剩余,已用情况
·Oracle计算时间差表达式
·Oracle如何解除被锁表
·oracle中聚合函数rank()使用方法
·如何查看Oracle数据库的字符编码

版权声明:本站大部分内容为原创! 另有少部分内容整理于网络,如需转载本站内容或关切版权事宜请联系站长。未经允许,严禁复制转载本站内容,否则将追究法律责任。 本站欢迎与同类网站建立友情链接,请联系QQ:176687814