Wednesday 2 July 2014

ORA-01591 quick solution

While working on BPEL engine one of my instance goes into recovery.When i tried to recover the same I came across following error from server side


ORA-01591: lock held by in-doubt distributed transaction 5.6.239425

We don't really see this error often. So I did a little research. 

The error message doc from Oracle has pretty good explanation but didn't provide a solution how to resolve the same.Also you will find couple of copy cats copying the same messages to the various forums without proper solution.

ORA-01591:

lock held by in-doubt distributed transaction string
Cause:
Trying to access resource that is locked by a dead two-phase commit transaction that is in prepared state.
Action:
DBA should query the pending_trans$ and related tables, and attempt to repair network connection(s) to coordinator and commit point. If timely repair is not possible, DBA should contact DBA at commit point if known or end user for correct outcome, or use heuristic default if given to issue a heuristic commit or abort command to finalize the local portion of the distributed transaction.

Rollback force didn't do the trick. What I end up did is very easy,  The DBMS_TRANSACTION helped.

SQL> select local_tran_id from dba_2pc_pending;

LOCAL_TRAN_ID
----------------------
 5.6.239425

SQL> rollback force '5.6.239425';

Rollback complete.

SQL> select local_tran_id from dba_2pc_pending;

LOCAL_TRAN_ID
----------------------
 5.6.239425

SQL> exec dbms_transaction.purge_lost_db_entry(' 5.6.239425');

PL/SQL procedure successfully completed.

SQL> commit;

Commit complete.

SQL> select local_tran_id from dba_2pc_pending;


no rows selected

No comments:

Post a Comment