本帖最后由 jiawang 于 2020-7-3 16:50 编辑
一、报错现象:
Mon May 25 19:22:09 2020 Error 3135 trapped in 2PCon transaction 18.7.783271. Cleaning up. Error stack returned touser: ORA-02050: transaction18.7.783271 rolled back, some remote DBs may be in-doubt ORA-03135: connection lostcontact ORA-02063: preceding linefrom BAXT
二、分析
此类问题通常是由于网络问题或远程数据库异常导致的分布式事务失败。
执行下面SQL语句
select LOCAL_TRAN_ID,GLOBAL_TRAN_ID,STATE,MIXED,HOST,COMMIT# from dba_2pc_pending;
#dba_2pc_pending视图记录等待恢复的分布式事务的信息
select * from DBA_2PC_NEIGHBORS;
#视图记录未决的分布式事务的输入输出连接信息
三、处理
1.如果在上述视图中查询到记录,则尝试force commit/rollback
commit force '644.3.881743';
2.如果不成功则进行如下操作
(1).Disable分布式恢复
SQL> ALTER SYSTEM DISABLE DISTRIBUTED RECOVERY;System altered.
(2).Puege(清空)in-doubt transaction entry:
SQL> exec DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('644.3.881743');
PL/SQL procedure successfully completed.
(3).然后enable 分布式恢复:
SQL> ALTER SYSTEM ENABLE DISTRIBUTED RECOVERY;
|