ORA-01591

Error: ORA-01591: lock held by in-doubt distributed transaction string

Causa: An attempt was made to access resource that is locked by a dead two-phase commit transaction that is in prepared state.

Acción: The database administrator 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, the database administrator should contact the database administrator at the commit point if known or the 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.

COMENTARIOS:

por Joan Vidal | 15/12/2014 18:03:42

ORA-01591: bloqueo mantenido por la transacción dudosa

Aquí tienes las sentencias que te solucionaran la incidencia, ejecutar como SYSDBA:

select * from DBA_2PC_PENDING;
ROLLBACK WORK FORCE '<local_tran_id>';
COMMIT;
dbms_transaction.purge_lost_db_entry('<local_tran_id>');


Lo primero es consultar la tabla DBA_2PC_PENDING.

Si hay transacciones es que han quedado pendientes e inestables. Hay que forzar rollback, ejecutar el resultado de la siguiente select (obligatorio el commit!) :

select 'ROLLBACK WORK FORCE '''||local_tran_id||'''; --'"-- DDL" from DBA_2PC_PENDING WHERE state <>'forced rollback' UNION ALL
select 'COMMIT;' FROM dual;

Una vez realizado quedan en 'forced rollback' pero ya está todo operativo.
Fin de la incidencia.

Pero si quieres eliminar esos registros 'forced rollback', ejecutar el resultado de la siguiente consulta como script:

select 'BEGIN' "-- DDL" FROM dual UNION ALL
select ' dbms_transaction.purge_lost_db_entry('''||local_tran_id||''');
COMMIT;--'||host from DBA_2PC_PENDING WHERE state ='forced rollback' UNION ALL
select 'END;' "-- DDL" FROM dual;

Un saludo!

por Claudia Flores Villa | 18/11/2015 00:13:39

RE: ORA-01591

Lo máximo muchas gracias!! Me funcionó perfectamente!!

por Andres | 26/11/2020 19:02:01

RE: ORA-01591

Excelente! Me sirvio!