Oracle

게시글 보기
작성자 유건데이타 등록일 2015-05-18
제목 DISTRIBUTED TRANSACTION 이 실패한 경우 해결 방안 ORA-02068 ORA-20
DISTRIBUTED TRANSACTION 이 실패한 경우 해결 방안
================================================

PURPOSE
-------
실패한 Distributed Transactions을 cleansing하는 방법에 대해 알아본다.

Probelm Description
-------------------
때때로 failed distributed transactions 을 처리하는 경우가 발생하는데
이 경우는 다음과 같이 처리한다.
이 경우 error message 는 alert.log 에 나타나며, 이는 local
transaction id를 알 수 있게 해준다.
이 error message 는 대략 다음과 같다.
:
ORA-02019: "connection description for remote database not found"
Cause: The user attempted to connect or log in to a remote
database using a connection description that could not
be found.
Action: Specify an existing database link. Query the data
dictionary to see all existing database links. See
your operating system-specific SQL*Net documentation
for valid connection descriptors.

ORA-02058: "no prepared transaction found with ID %s"
Cause: A COMMIT FORCE was attempted on a transaction, but the
transaction with LOCAL_TRAN_ID or GLOBAL_TRAN_ID was
not found in the DBA_2PC_INDOUBT table in prepared
state.
Action: Check the DBA_2PC_INDOUBT table to ensure the proper
transaction ID is used and attempt the commit again.

다음의 "dbmsutil.sql" 를 살펴보면 왜 transaction 이 이 error 를 끝까지
풀지 못하고 error message 를 계속 발생시키는 지를 알수있게 한다.

"commit processing 이 진행 중인 순간에 fail이 발생하면, 이 결과를
해결하기 위해 계속해서 모든 site 에 automatic recovery 가 시행된다.
그러나, remote database recovery 가 완료되기 전에 destroyed 또는
recreated 되어지면 DBA_2pc_pending 에서 control 에 사용되어지는 entry와
관련된 table 은 제거되지 않고 recovery 가 계속 일정 시간마다 시도
되어진다."


Workaround
----------


Solution Description
--------------------

Cleanup Steps:
===============

먼저 error message 에 나타나는 local transaction ID,
기록해 둔다.

1. 해당 transaction 을 commit 할지 rollback 할지 여부를 결정한다.

SQL> select state, advice from dba_2pc_pending
where local_tran_id = '';

2. Commit 또는 rollback 을 실시한다.

commit 하기 위해 :

SQL> commit force '';

rollback 하기 위해:

SQL> rollback force '';

3. Step 2 대신 다음을 이용할 수도 있다.

SQL> execute dbms_transaction.purge_lost_db_entry('');

NOTE: purge_lost_db_entry function 은
$ORACLE_HOME/rdbms/admin/dbmsutil.sql" 에 자세히 언급되어 있다.


4. Steps 2 and 3 이 실패하는 경우 다음을 이용할 수 있다.

SQL> set transaction use rollback segment system;
SQL> delete from pending_trans$ where
local_tran_id = '';
SQL> delete from pending_sessions$ where
local_tran_id = '';
SQL> delete from pending_sub_sessions$ where
local_tran_id = '';
SQL> commit;
Comment
등록된 코멘트가 없습니다.