DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Thursday, December 29, 2016

Steps to Purge a Distributed Transaction from a Database. (ORA-24756: transaction does not exist tips)





Please follow the below steps.






If the remote database cannot be accessed, a failed distributed transaction cannot be committed or rolled back and so must be purged from the list of pending transactions.




For ex. the error we will get in alert log as ORA-24756: transaction does not exist 







1. Identify the id of the transaction:


SQL> column global_tran_id format a25
SQL> column database format a22
SQL> column global_name format a22
SQL> SELECT * from global_name;
SQL> SELECT LOCAL_TRAN_ID, GLOBAL_TRAN_ID,to_char(FAIL_TIME,'dd-mon-yyyy HH24:MI:SS'),STATE, MIXED FROM DBA_2PC_PENDING;
SQL> SELECT LOCAL_TRAN_ID, IN_OUT,INTERFACE, DATABASE FROM DBA_2PC_NEIGHBORS;




2. Purge the transaction:



SQL> EXECUTE DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('<transaction_id>');
SQL> COMMIT;




3. Confirm that the transaction has been purged:



SQL> SELECT LOCAL_TRAN_ID, GLOBAL_TRAN_ID,to_char(FAIL_TIME,'dd-mon-yyyy HH24:MI:SS'),STATE, MIXED FROM DBA_2PC_PENDING;



SQL> SELECT LOCAL_TRAN_ID, IN_OUT,INTERFACE, DATABASE FROM DBA_2PC_NEIGHBORS;





While trying to purge the transactions, if you hit error ORA-06510 as shown below :

======================================================



BEGIN DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('9.32.558'); END;

*
ERROR at line 1:
ORA-06510: PL/SQL: unhandled user-defined exception
ORA-06512: at "SYS.DBMS_TRANSACTION", line 96
ORA-06512: at line 1



you can run the below command to get rid of them.

SQL> rollback force '9.32.558';






No comments: