Msg 7391 : OLE DB provider "OraOLEDB.Oracle" for linked server "ORACLE" was unable to begin a distributed transaction.

Subba Rao Dasari 6 Reputation points
2021-01-09T14:12:52.277+00:00

Hi

I have encountered a problem in MSSQL trigger that creates the transaction in Oracle database using linked server. When trigger invokes it gives the following message

Msg 7391, Level 16, State 2, Procedure demotrg, Line 6 [Batch Start Line 0]
The operation could not be performed because OLE DB provider "OraOLEDB.Oracle" for linked server "ORACLE" was unable to begin a distributed transaction.

All operations like insert,update,delete are working fine in ORACLE database when I issue command from MSSQL, but it is not working in MSSQL trigger.

following is the simple trigger code.

ALTER trigger [dbo].[demotrg] on [Efftronicsrtwms].[dbo].[screendata20] after insert
as
begin
begin distributed tran
SET XACT_ABORT ON;
INSERT INTO [ORACLE]..[TAMS].[DEMO] VALUES (1,'DSR',SYSDATETIME());
-- INSERT OPENQUERY (ORACLE, 'SELECT * FROM TAMS.DEMO') VALUES (12,'DSR',getdate());
commit tran;

end;

I tried all combinations with begin transaction, set exact_abor on, but no vain.

Requesting the solution if you had encountered.

Regards
Subbarao Dasari

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,771 questions
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. Olaf Helper 44,501 Reputation points
    2021-01-11T11:32:12.913+00:00

    You have to enable the RPC = "Remote Procedure Call" setting in the linked server properties, a trigger is nothing else then a procedure.

    0 comments No comments

  2. AmeliaGu-MSFT 13,976 Reputation points Microsoft Vendor
    2021-01-12T07:50:50.177+00:00

    Hi SubbaRaoDasari-5162,

    Here is an article which might help.

    Is Microsoft Distributed Transaction Coordinator (MSDTC) running?
    Please try to enable Allow Remote Clients and Allow Outbound on Component Services -> Distributed Transaction Coordinator ->Local DTC Properties-> Security tab.
    And please check the registry key value on the client computer that is running SQL Server is correct.

    55701-01.jpg

    If your Oracle database is 8.0, your client dll file will be “Oraclient8.dll” and if you are using Oracle 11g, the filename would be “Oraclient11.dll”. Please remember to backup registry key first.

    Best Regards,
    Amelia


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  3. Greg Kite 1 Reputation point
    2021-06-02T14:23:53.397+00:00

    I am having exact same problem. My linked server has following settings:
    101745-image.png

    Like original poster, i can manually run insert queries to linked server fine, trigger procedures don't work.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.