ORA-02062: DISTRIBUTED RECOVERY RECEIVED DBID 01010101, EXPECTED DB21020
Cause
The default internal name of the Oracle Database Gateway for DRDA 11.2 is 01010101 (see manual -> HS_DB_INTERNAL_NAME) whereas the TG4DB2 gateway used DB21020.
Checking out the dba_2pc_pending table in the Oracle database hs shown a pending transaction started by the TG4DB2 gateway a long time ago and the Oracle database now tried to recover it using the DRDA gateway.
As the internal names of both gateways do not match, this error is logged in the alert.log of the Oracle database.
Solution
Purge the pending transaction using:
EXECUTE DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY(‘ ‘);
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;