Unable to begin a distributed transaction

2020-01-27 00:56发布

i'm trying to run SQL against a linked server, but i get the errors.

BEGIN DISTRIBUTED TRANSACTION
SELECT TOP 1 * FROM Sessions


OLE DB provider "SQLNCLI" for linked server "ASILIVE" returned message "No transaction is active.".

Msg 7391, Level 16, State 2, Line 3
The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "ASILIVE" was unable to begin a distributed transaction.

There are two errors returned by the provider:

Error #1:

Number: $80040E14
Source: Microsoft OLE DB Provider for SQL Server
Description: OLE DB provider "SQLNCLI" for linked server "ASILIVE" returned message "No transaction is active.".
HelpFile: 
HelpContext: $00000000
SQLState: 01000
NativeError: 7412

Error #2

Number: $80040E14
Source: Microsoft OLE DB Provider for SQL Server
Description: The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "ASILIVE" was unable to begin a distributed transaction.
HelpFile: 
HelpContext: $00000000
SQLState: 42000
NativeError: 7391

How do i get Microsoft to favor functionality over security?

Or, at the very least, how can i get two SQL Severs to talk to each other?

Related questions


What i have done is irrelevant, but i'll post it anyway.

  1. Ensure Distributed Transaction Coordinator service is running on both machies:

    enter image description here

    enter image description here

  2. Disable all MSDTC security on both machines:

    enter image description here

    enter image description here

  3. Turn on random options on the linked server:

enter image description here

  1. Cursed and swore.

  2. Smashed things.

  3. Checked that a SELECT can use the linked server:

       SELECT * FROM ASILive.CustomerManagementSystem.dbo.Users
       ....
    
       (763 row(s) affected)
    
  4. Checked that client server can ping the remote server:

        C:\Documents and Settings\avatar>ping asicmstest.contoso.com
    
        Pinging asicmstest.contoso.com [10.0.0.40] with 32 bytes of data:
    
        Reply from 10.0.0.40: bytes=32 time<1ms TTL=128
        Reply from 10.0.0.40: bytes=32 time<1ms TTL=128
        Reply from 10.0.0.40: bytes=32 time<1ms TTL=128
        Reply from 10.0.0.40: bytes=32 time<1ms TTL=128
    
        Ping statistics for 10.0.0.40:
            Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
        Approximate round trip times in milli-seconds:
            Minimum = 0ms, Maximum = 0ms, Average = 0ms
    
  5. Checked that the remote server can commnicate back, by name, to the initiating server:

        C:\Documents and Settings\avatar>ping asitestserver.contoso.com
    
        Pinging asitestserver.contoso.com [10.0.0.22] with 32 bytes of data:
    
        Reply from 10.0.0.22: bytes=32 time<1ms TTL=128
        Reply from 10.0.0.22: bytes=32 time<1ms TTL=128
        Reply from 10.0.0.22: bytes=32 time<1ms TTL=128
        Reply from 10.0.0.22: bytes=32 time<1ms TTL=128
    
        Ping statistics for 10.0.0.22:
            Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
        Approximate round trip times in milli-seconds:
            Minimum = 0ms, Maximum = 0ms, Average = 0ms
    
  6. Checked that @@SERVERNAME matches the server name on both servers:

      SELECT @@SERVERNAME, SERVERPROPERTY('MachineName')
    
      -------------  -------------
      ASITESTSERVER  ASITESTSERVER
    

    and

      SELECT @@SERVERNAME, SERVERPROPERTY('MachineName')
    
      ----------  ----------
      ASIGROBTEST  ASIGROBTEST
    
  7. Screamed

  8. Issued SET XACT_ABORT ON before issuing my query:

    SET XACT_ABORT ON
    GO
    BEGIN DISTRIBUTED TRANSACTION
    SELECT TOP 1 * FROM Sessions
    
  9. Granted Everyone Full Control to:

    HKEY_LOCAL_MACHINE\Software\Microsoft\MSSQLServer
    

    on both servers.

9条回答
姐就是有狂的资本
2楼-- · 2020-01-27 01:14

If the servers are clustered and there is a clustered DTC you have to disable security on the clustered DTC not the local DTC.

查看更多
看我几分像从前
3楼-- · 2020-01-27 01:16

OK, so services are started, there is an ethernet path between them, name resolution works, linked servers work, and you disabled transaction authentication.

My gut says firewall issue, but a few things come to mind...

  1. Are the machines in the same domain? (yeah, shouldn't matter with disabled authentication)
  2. Are firewalls running on the the machines? DTC can be a bit of pain for firewalls as it uses a range of ports, see http://support.microsoft.com/kb/306843 For the time being, I would disable firewalls for the sake of identifying the problem
  3. What does DTC ping say? http://www.microsoft.com/download/en/details.aspx?id=2868
  4. What account is the SQL Service running as ?
查看更多
再贱就再见
4楼-- · 2020-01-27 01:17

If your Destination server is on another cloud or data-center then need to add host-entry of MSDTC service(Destination Server) in your source server.

Try this one if problem doesn't resolved, After enable the MSDTC settings.

查看更多
forever°为你锁心
5楼-- · 2020-01-27 01:22

Found it, MSDTC on the remote server was a clone of the local server.

From the Windows Application Events Log:

Event Type: Error
Event Source: MSDTC
Event Category: CM
Event ID: 4101
Date: 9/19/2011
Time: 1:32:59 PM
User: N/A
Computer: ASITESTSERVER
Description:

The local MS DTC detected that the MS DTC on ASICMSTEST 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.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

Running

msdtc -uninstall
msdtc -install

and then stopping and restarting SQL Server service fixed it.

查看更多
贪生不怕死
6楼-- · 2020-01-27 01:23

I was getting the same error and i managed to solve it by configuring the MSDTC properly on the source server to allow outbound and allowed the DTC through the windows firewall.

Allow the Distributed Transaction Coordinator, tick domain , private and public options

查看更多
Animai°情兽
7楼-- · 2020-01-27 01:32

For me, it relate to Firewall setting. Go to your firewall setting, allow DTC Service and it worked.enter image description here

查看更多
登录 后发表回答