我试图在一个链接服务器上运行 SQL,但是我得到了下面的错误:
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.
提供程序返回两个错误:
错误 # 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
错误 # 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
我如何让微软偏爱功能而不是安全?
或者,至少,我如何让两个 SQLSever 相互通信?
(null)
) ,无法执行此操作我所做的 有是无关紧要的,但我会张贴它无论如何。
被诅咒,被诅咒。
砸碎的东西。
检查了 SELECT
是否可以使用 链接服务器:
SELECT * FROM ASILive.CustomerManagementSystem.dbo.Users
....
(763 row(s) affected)
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
检查远程服务器是否可以通过名称与发起服务器通信:
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
检查 @@SERVERNAME
是否与两台服务器上的服务器名称匹配 :
SELECT @@SERVERNAME, SERVERPROPERTY('MachineName')
------------- -------------
ASITESTSERVER ASITESTSERVER
还有
SELECT @@SERVERNAME, SERVERPROPERTY('MachineName')
---------- ----------
ASIGROBTEST ASIGROBTEST
尖叫
在发出查询 之前发出 SET XACT_ABORT ON
:
SET XACT_ABORT ON
GO
BEGIN DISTRIBUTED TRANSACTION
SELECT TOP 1 * FROM Sessions
HKEY_LOCAL_MACHINE\Software\Microsoft\MSSQLServer
在两个服务器上。