Anar Godjaev
http://anargodjaev.wordpress.com/

ORA-01591: lock held by in-doubt distributed
transaction
Error:
ADKPOST001...
Anar Godjaev
http://anargodjaev.wordpress.com/

Connect to sys user
Set serveroutput on
Exec SYS.clear_ora_1591('606.36.30...
Anar Godjaev
http://anargodjaev.wordpress.com/
EXECUTEIMMEDIATE'alter system disable distributed recovery';
INSERTINTOpend...
Anar Godjaev
http://anargodjaev.wordpress.com/
/
*************************************************************************...
Anar Godjaev
http://anargodjaev.wordpress.com/
Session altered.
SQL> commit;
Commit complete.
SQL> exec dbms_transaction.p...
Upcoming SlideShare
Loading in …5
×

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

1,728 views
1,476 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,728
On SlideShare
0
From Embeds
0
Number of Embeds
42
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

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

  1. 1. Anar Godjaev http://anargodjaev.wordpress.com/ ORA-01591: lock held by in-doubt distributed transaction Error: ADKPOST001: BOJ at Mon Jul 20 15:00:15 2013 with PID=07314 ORACLE_SID=AZKKDB LOGON COMMIT - U065025 U065025 LOGON_LG U065025 LOGON_LG U065025 C ADKPOST BEBEK HATA ALDI -- txsrv.serno = -1591 ORA-01591: lock held by in-doubt distributed transaction 606.36.301120 ORA-01591: lock held by in-doubt distributed transaction 606.36.301120 ORA-06512: at "AZKKDB.REPCC_ADKPOST", line 5922 ORA-06512: at line 1 ****************************************************************************** Select * fromdba_2pc_pendingwherelocal_tran_id='606.36.301120'; Here, according to the situation before the commit is issued after the rollback. commit force rollback force '606.36.301120'; '606.36.301120'; If you can not solve the problem, go purge. alter system enable distributed recovery; alter session set "_smu_debug_mode" = 4; commit; exec DBMS_TRANSACTION.PURGE_LOST_DB_ENTRY('606.36.301120'); commit; After this stage transaction dba_2pc_pending from are eliminated. -------------------------------------------------------------------------------------------------------------------After this step, the problem should be solved. Or not go to next step:
  2. 2. Anar Godjaev http://anargodjaev.wordpress.com/ Connect to sys user Set serveroutput on Exec SYS.clear_ora_1591('606.36.301120'); -----------------------------------------------------------------CREATEORREPLACEPROCEDURESYS.clear_ora_1591(p_transaction_idINVARCHAR2) /* ORA-1591 Metalink note 401302.1 2.2 Distributed transaction without corresponding dba_2pc entries In this case dba_2pc views are empty but users are receiving distributed txn related errors, e.g. ORA-2054, ORA-1591. */ AS v_dummyNUMBER(1); v_statusVARCHAR2(30); v_usernameVARCHAR2(30); BEGIN SELECTSYS_CONTEXT('USERENV','SESSION_USER') INTOv_username FROMDUAL; IFv_username<>'SYS' THEN DBMS_OUTPUT.put_line('run to SYS user’); RETURN; ENDIF; SELECT1 INTOv_dummy FROMdba_2pc_pending WHERElocal_tran_id=p_transaction_id; DBMS_OUTPUT.put_line ('ifdba_2pc yes entries then other solutions should be considered in'); EXCEPTION WHENNO_DATA_FOUND THEN DBMS_OUTPUT.put_line('if dba_2pc noentries); SELECTktuxesta INTOv_status FROMx$ktuxe WHEREktuxesta !='INACTIVE' ANDktuxeusn= SUBSTR(p_transaction_id,1,INSTR(p_transaction_id,'.')-1); IFv_status='PREPARED' THEN DBMS_OUTPUT.put_line; DBMS_OUTPUT.put_line;
  3. 3. Anar Godjaev http://anargodjaev.wordpress.com/ EXECUTEIMMEDIATE'alter system disable distributed recovery'; INSERTINTOpending_trans$ (local_tran_id,global_tran_fmt,global_oracle_id, state,status,session_vector, reco_vector,type#,fail_time,reco_time ) VALUES(p_transaction_id,306206,'XXXXXXX.12345.1.2.3', 'prepared','P',HEXTORAW('00000001'), HEXTORAW('00000000'),0,SYSDATE,SYSDATE ); INSERTINTOpending_sessions$ VALUES(p_transaction_id,1,HEXTORAW('05004F003A1500000104'), 'C',0,30258592,'',146); COMMIT; DBMS_OUTPUT.put_line; BEGIN DBMS_OUTPUT.put_line('commit force'); EXECUTEIMMEDIATE'commit force ''' || p_transaction_id || ''''; EXCEPTION WHENOTHERS THEN DBMS_OUTPUT.put_line ('if commit force error took then delete entries'); DELETEFROMpending_trans$ WHERElocal_tran_id=p_transaction_id; DELETEFROMpending_sessions$ WHERElocal_tran_id=p_transaction_id; COMMIT; EXECUTEIMMEDIATE'alter system enable distributed recovery'; DBMS_OUTPUT.put_line ('COMMIT FORCE FAIL , INSERT The recordings have been deleted' ); RETURN; END; DBMS_OUTPUT.put_line('commit force successful'); EXECUTEIMMEDIATE'alter system enable distributed recovery'; EXECUTEIMMEDIATE'alter session set "_smu_debug_mode" = 4'; COMMIT; DBMS_TRANSACTION.purge_lost_db_entry(p_transaction_id); DBMS_OUTPUT.put_line ('COMMIT FORCE successfulpurge transaction was, control should beagain'); ENDIF; END;
  4. 4. Anar Godjaev http://anargodjaev.wordpress.com/ / ***************************************************************************** Other Step’s: ORA-01591: lock held by in-doubt distributed transaction 2508.16.36962 Oracle Support id Note: 401302.1 alter system disable distributed recovery; insert into pending_trans$ ( LOCAL_TRAN_ID, GLOBAL_TRAN_FMT, GLOBAL_ORACLE_ID, STATE, STATUS, SESSION_VECTOR, RECO_VECTOR, TYPE#, FAIL_TIME, RECO_TIME) values( '2508.16.36962', /* <== Replace this with your local tran id */ 306206, /* */ 'XXXXXXX.12345.1.2.3', /* These values can be used without any 'prepared','P', /* modification. Most of the values are hextoraw( '00000001' ), /* constant. hextoraw( '00000000' ), /* */ */ */ */ 0, sysdate, sysdate ); insert into pending_sessions$ values( '2508.16.36962',/* <==Replace only this with your local tran id */ 1, hextoraw('05004F003A1500000104'), 'C', 0, 30258592, '', 146 ); commit; commit force '2508.16.36962'; SQL> alter system enable distributed recovery; System altered. SQL> alter session set "_smu_debug_mode" = 4;
  5. 5. Anar Godjaev http://anargodjaev.wordpress.com/ Session altered. SQL> commit; Commit complete. SQL> exec dbms_transaction.purge_lost_db_entry('2508.16.36962'); PL/SQL procedure successfully completed. SQL> commit; Commit complete.

×