Last week I had worked on an issue related to Linked Server. The customer had migrated the SQL Server Instances to Virtual Servers. They had quite a few Linked Servers setup. After migration any Distributed Transaction like the one below across the linked servers would fail immediately.
begin distributed tran
select * from RemoteServer.DBName.dbo.TableName
OLE DB provider "SQLNCLI11" for linked server "linkedservername" returned message "No transaction is active.".
Msg 7391, Level 16, State 2, Line 2
The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server "linkedservername" was unable to begin a distributed transaction.
The first place I checked for problems was the Component Services (run –> dcomcnfg).
The options in the Local DTC Properties were correctly set as seen in this screenshot.
Restarting the “Distributed Transaction Coordinator (MSDTC)” service didn’t help either.
The next step was to look for possible error messages in the Event Log. In the Application Event Log, the following error message was logged.
The local MS DTC detected that the MS DTC on ServerName has the same unique identity as the local MS DTC.
This means that the two MS DTC will not be able to communicate with each other.
This problem typically occurs if one of the systems were cloned using unsupported cloning tools.
MS DTC requires that the systems be cloned using supported cloning tools such as SYSPREP. Running 'msdtc -uninstall' and then 'msdtc -install' from the command prompt will fix the problem.
Note: Running 'msdtc -uninstall' will result in the system losing all MS DTC configuration information.
The error message in bold indicates that the Unique Identity for the MS DTC (SID) was same on both the local and the destination servers. How is this possible? While the new servers were being built they had syspreped servers. Hence the configuration of MS DTC was also propagated to all the servers where the same image was used.
Now that we knew the root cause, the resolution was pretty straight forward. Executed the following steps as explained in this article.
- Opened the Command Prompt as an Administrator and executed “msdtc -uninstall”
- Deleted the following registry keys (after exporting them as a precautionary measure)
- Executed “msdtc -install” command in the Command Prompt
- Rebooted the server
After reboot, the linked server queries returned the expected results.