|
|
Question : Insert code in Trigger causes ORA01591 lock held by in doubt transaction
|
|
Hi there, We use the Oracle transparent gateway for informix to access an informix db from oracle. This is generally working.
When I create a trigger on the oracle db and it is fired, it causes the ORA-01591 error message. It looks like there is a problem with the 2point commit phase.
Here the trigger code: CREATE OR REPLACE TRIGGER BTO_QMAP.AI_CELLS AFTER INSERT ON BTO_QMAP.QMAP_GROUPS_CELLS REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW WHEN ( new.CELLID like '%G' ) BEGIN insert into "qmap_groups_cells"@IFMX_METRICA ("fk_subgroup_name","fk_user_id","cellid") VALUES (:new.fk_subgroup_name, :new.fk_user_id, :new.cellid); END ;
The values are inserted correctly into the informix database. But in oracle a lock is created for this dirstributed transaction. After accessing the involved table, the ORA-01591 "lock held by in-doubt transaction" is raised. After a COMMIT force 'transaction id', the lock is released.
When I execute a similar insert statement directly (not via trigger), then everything works fine.
Any ideas would be appreciated....
br Kenny
|
Answer : Insert code in Trigger causes ORA01591 lock held by in doubt transaction
|
|
I am not able to reproduce this on my Oracle 9.2.0.4. However I would suggest to enclose the remote access in an autonomous transaction: ------------------------------------------- CREATE OR REPLACE TRIGGER BTO_QMAP.AI_CELLS AFTER INSERT ON BTO_QMAP.QMAP_GROUPS_CELLS REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW WHEN ( new.CELLID like '%G' ) declare PRAGMA AUTONOMOUS_TRANSACTION; BEGIN insert into "qmap_groups_cells"@IFMX_METRICA ("fk_subgroup_name","fk_user_id","cellid") VALUES (:new.fk_subgroup_name, :new.fk_user_id, :new.cellid); commit; exception when others then rollback; raise; END ; ------------------------------------------------
|
|
|
|
|