linked server "LK_SERVER_NAME" was unable to begin a distributed transactio
vijaiMay 6 2013 — edited May 7 2013Hi,
I have two DBs namely MS SQL 2008 and ORACLE 11g. I need to transfer data from MS SQL to ORACLE using the linked server. I did the following,
I have a stored procedure in ORACLE as call_linked_oracle_procedure which needs to be called from the MS SQL server to transfer the data.
So the steps I did to achieve this is provided as a sample as follows,
/* Creating a sample table */
create table source_tab3
(
id numeric,
name varchar(MAX)
)
GO
---------------------------------------------------------
/* Creating a insert trigger for the sample table which calls the oracle through the linked server*/
IF OBJECT_ID ('dbo.source_tab3Trigger','TR') IS NOT NULL
DROP TRIGGER dbo.source_tab3Trigger;
GO
CREATE TRIGGER source_tab3Trigger ON source_tab3
AFTER INSERT
AS
DECLARE @output varchar(600)
EXEC [dbo].[call_linked_oracle_procedure] @parameter1 =N'value1', @parameter2 =N'value2'
select @output
GO
-----------------------------------------------------
/* Insert a sample data */
insert into source_tab3 (id,name) (1,'vijai');
GO
Now when I insert the data, It give the following error
_____________________________________________________________________________________
OLE DB provider "OraOLEDB.Oracle" for linked server "LK_SERVER_NAME" returned message "New transaction cannot enlist in the specified transaction coordinator. ".
Msg 7391, Level 16, State 2, Procedure source_tab3Trigger, Line 11
The operation could not be performed because OLE DB provider "OraOLEDB.Oracle" for linked server "LK_ORACLE" was unable to begin a distributed transaction.
_____________________________________________________________________________________
The things I did to solve this were,
1. Enabled the MSDTC services (Distributed Transaction Coordinator is started ).
2. Enabled the Network DTC access from the control panel, component services to 'Allow InBound' etc.
3. My 'OracleMTSRecoveryService' is running in my services list.
Also, I have done all these where my machine where MS SQL 2008 is installed. Dono what needs to be done in the ORACLE server.
Also to note, that I am able to query the tables/procedure via linked server individually, but not able to do that within the triggers.
Any tip is much appreciated.
regards,
Vijai