sql-serverazure-sql-databasemsdtc

Azure Linked SQL server from on Premise SQL Server - MSDTC exception


  1. I have a SQL Db in Azure
  2. Then created a linked server for the SQL Db from the on premises SQL Server
  3. I am using a table present in the Azure SQL db in a SP in on premises SQL db

This setup works fine except when there MSDTC service is running.

When the 'DTC' service is running, I am getting the following exception

Top level exception message : System.ServiceModel.FaultException: The OLE DB provider "SQLNCLI11" for linked server "Azure_SQLDb" reported an error. One or more arguments were reported invalid by the provider. The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server "Azure_SQLDb" was unable to begin a distributed transaction. OLE DB provider "SQLNCLI11" for linked server "Azure_SQLDb" returned message "The parameter is incorrect.".

I dont need the Azure linked server for any of the DTC transaction, so I tried disabling this option in the linked server properties to see if it helps but it did not help.

enter image description here

I read that we cant have MSDTC connection to the azure SQL db, which is good with me as I will not have any transaction involving between my local db and azure sql db.

I would like to have a solution to run DTC service running in my server machine when there is a linked server connection to the azure sql db.


Solution

  • @dks The problem you are hitting is not normal - generally it would only happen if your application is trying to start a distributed transaction to coordinate state changes. (Sometimes applications use distributed transactions to coordinate state change between an app and data tier, so perhaps that is happening in your case). If you are running from EF or similar, please check to make sure that it is not starting a DTC on your behalf.

    In any event, I suggest you move to the latest OLEDB provider. Last year Microsoft introduced an updated provider and you can download it here:

    https://www.microsoft.com/en-us/download/details.aspx?id=56730