Saturday, June 18, 2016

User error while running the application

ERROR:

Nested exception is:
java.sql.SQLException: [SQLState=72000][ErrorCode=1591]ORA-01591: lock held by in-doubt distributed transaction 21.3.3075

       at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
       at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:745)
       at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:219)
       at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:970)
       at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:911)
       at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)

WORK AROUND:

As per meta link note 1012842.102 we followed below steps:

select * from dba_2pc_pending;
select * from dba_2pc_neighbors;
select * from pending_trans$;
select * from pending_sessions$;
select * from pending_sub_sessions$;

From the above queries keep all the value of LOCAL_TRAN_ID in each table and try to force commit or rollback.

1)     ALTER SYSTEM DISABLE DISTRIBUTED RECOVERY;
2)     EXEC DBMS_TRANSACTION.rollback_force('LOCAL_TRAN_ID');  (Need to mention the TRAN_ID which we got from the above queries)
3)   COMMIT ;
4)   ALTER SYSTEM ENABLE DISTRIBUTED RECOVERY;
5)   EXEC DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('LOCAL_TRAN_ID');
 6)    COMMIT;

Repeat each steps for each LOCAL_TRAN_ID, turn on recovery for distributed transaction
crosscheck these tables (must be empty):

select * from dba_2pc_pending;
select * from dba_2pc_neighbors;
select * from pending_trans$;
select * from pending_sessions$;
select * from pending_sub_sessions$;

No comments:

Post a Comment