无法开始分布式事务
我尝试对链接服务器运行 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
如何我如何让微软更看重功能而不是安全?
或者,至少,我怎样才能让两个 SQL Server 相互通信?
相关问题
- 操作无法执行,因为 OLE DB 提供程序“SQLNCLI10”... (*链接服务器名称为
(null)
) - 分布式事务错误?(使用 Oracle 提供程序)
- 无法使用 NHibernate 登记分布式事务 (使用 Hibernate)
- 使用分布式时出错SQL Server 2008 R2 中的事务(SQL Server 2008 R2,无应答)
- 仅通过代码出现分布式事务错误(由连接池引起 )
- 在链接中执行分布式事务协调器时出错服务器(SQL Server 2008,无答案)
- 分布式事务错误?(没有接受的答案;唯一的答案没有帮助)
- 如何使用事务内的链接服务器插入远程表?(接受的答案无法解析)
我所做的无关紧要,但我会无论如何发布它。
诅咒并发誓。
砸碎东西。
检查
SELECT
是否可以使用链接服务器:从 ASILive.CustomerManagementSystem.dbo.Users 中选择 * .... (受影响的 763 行)
C:\Documents and Settings\avatar>ping asicmstest.contoso.com 使用 32 字节数据 Ping asicmstest.contoso.com [10.0.0.40]: 来自 10.0.0.40 的回复:字节=32 时间<1ms TTL=128 来自 10.0.0.40 的回复:字节=32 时间<1ms TTL=128 来自 10.0.0.40 的回复:字节=32 时间<1ms TTL=128 来自 10.0.0.40 的回复:字节=32 时间<1ms TTL=128 10.0.0.40 的 Ping 统计数据: 数据包:发送 = 4,接收 = 4,丢失 = 0(0% 丢失), 大约往返时间(以毫秒为单位): 最小值 = 0ms,最大值 = 0ms,平均值 = 0ms
检查远程服务器是否可以按名称与发起服务器进行通信:
C:\Documents and Settings\avatar>ping asitestserver.contoso.com 使用 32 字节数据 Ping asitestserver.contoso.com [10.0.0.22]: 10.0.0.22 回复:字节=32 时间<1ms TTL=128 10.0.0.22 回复:字节=32 时间<1ms TTL=128 10.0.0.22 回复:字节=32 时间<1ms TTL=128 10.0.0.22 回复:字节=32 时间<1ms TTL=128 10.0.0.22 的 Ping 统计数据: 数据包:发送 = 4,接收 = 4,丢失 = 0(0% 丢失), 大约往返时间(以毫秒为单位): 最小值 = 0ms,最大值 = 0ms,平均值 = 0ms
检查
@@SERVERNAME
与两台服务器上的服务器名称匹配:SELECT @@SERVERNAME, SERVERPROPERTY('MachineName') ------------- ------------- 测试服务器 测试服务器
和
SELECT @@SERVERNAME, SERVERPROPERTY('MachineName') ---------- ---------- ASIGROBTEST ASIGROBTEST
尖叫
在发出查询之前发出
SET XACT_ABORT ON
:< /p>设置 XACT_ABORT ON 去 开始分布式交易 从会话中选择前 1 个 *
HKEY_LOCAL_MACHINE\Software\Microsoft\MSSQLServer
在两台服务器上。
I'm trying to run SQL against a linked server, but I get the errors below :
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 least, how can I get two SQL Severs to talk to each other?
Related questions
- The operation could not be performed because OLE DB provider “SQLNCLI10”... (*linked server name is
(null)
) - Distributed transaction error? (using Oracle provider)
- Unable to enlist in a distributed transaction with NHibernate (using Hibernate)
- Error using distributed transaction in SQL Server 2008 R2 (SQL Server 2008 R2, no answer)
- Distributed Transaction Error Only Through Code (caused by connection pooling)
- Error performing distributed transaction coordinator in linked server (SQL Server 2008, no answer)
- Distributed transaction error? (no accepted answer; only answer doesn't help)
- How to Insert into remote table using Linked server withint Transaction? (accepted answer doesn't resolve)
What I have done is irrelevant, but I'll post it anyway.
Ensure
Distributed Transaction Coordinator
service is running on both machies:Disable all MSDTC security on both machines:
Turn on random options on the linked server:
Cursed and swore.
Smashed things.
Checked that a
SELECT
can use the linked server:SELECT * FROM ASILive.CustomerManagementSystem.dbo.Users .... (763 row(s) affected)
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
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
Checked that
@@SERVERNAME
matches the server name on both servers:SELECT @@SERVERNAME, SERVERPROPERTY('MachineName') ------------- ------------- ASITESTSERVER ASITESTSERVER
and
SELECT @@SERVERNAME, SERVERPROPERTY('MachineName') ---------- ---------- ASIGROBTEST ASIGROBTEST
Screamed
Issued
SET XACT_ABORT ON
before issuing my query:SET XACT_ABORT ON GO BEGIN DISTRIBUTED TRANSACTION SELECT TOP 1 * FROM Sessions
Granted
Everyone
Full Control
to:HKEY_LOCAL_MACHINE\Software\Microsoft\MSSQLServer
on both servers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
发现了,远程服务器上的MSDTC是本地服务器的克隆。
从 Windows 应用程序事件日志:
运行
然后停止并重新启动 SQL Server 服务修复了该问题。
Found it, MSDTC on the remote server was a clone of the local server.
From the Windows Application Events Log:
Running
and then stopping and restarting SQL Server service fixed it.
我能够通过禁用“启用 RPC 分布式事务升级”(即将其设置为
False
)来解决此问题(正如其他人在评论中提到的那样):根据要求@WonderWorker,您可以通过 SQL 脚本执行此操作:
I was able to resolve this issue (as others mentioned in comments) by disabling "Enable Promotion of Distributed Transactions for RPC" (i.e. setting it to
False
):As requested by @WonderWorker, you can do this via SQL script:
好的,服务已启动,它们之间有一个以太网路径,名称解析工作,链接服务器工作,并且您禁用了事务身份验证。
我的直觉说防火墙有问题,但我想到了一些事情......
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...
对我来说,它与防火墙设置有关。转到您的防火墙设置,允许 DTC 服务并且它起作用了。
For me, it relate to Firewall setting. Go to your firewall setting, allow DTC Service and it worked.
如果服务器已集群并且存在集群 DTC,则必须禁用集群 DTC 而非本地 DTC 上的安全性。
If the servers are clustered and there is a clustered DTC you have to disable security on the clustered DTC not the local DTC.
我上次使用 MSDTC 的经历和今天的这个错误结果证明是 DNS 问题。您询问机器是否位于同一域中是正确的,EBarr。顺便说一句,这个问题的清单很棒!
我的情况:我需要子域中的服务器能够通过防火墙针对父域中的服务器运行分布式事务。多年来我经常使用链接服务器,因此我在 SQL 中为链接服务器和 MSDTC 中设置了所有常用设置,Ian 在上面详细记录了这些设置。我为 MSDTC 设置了一系列 TCP 端口 (5000-5200) 以在两台服务器上使用,并在端口 1433 和 5000-5200 的盒子之间安排了一个防火墙漏洞。那应该有效。链接服务器测试正常,我可以通过链接服务器很好地查询远程 SQL 服务器,但我无法让它允许分布式事务。我什至可以看到来自 DEV 服务器的 QA 服务器上的连接,但有些东西没有返回。
我可以使用 FQDN 从 QA PING DEV 服务器,例如: PING DEVSQL.dev.domain.com
我无法仅使用计算机名称 PING DEV 服务器: PING DEVSQL
DEVSQL 服务器应该是两个域的成员,但是该名称未在父域的 DNS 中解析...父域中 DEVSQL 的计算机帐户发生了问题。一旦我们将 DEVSQL 添加到父域的 DNS,并且“PING DEVSQL”可以从远程 QA 服务器工作,这个问题就为我们解决了。
我希望这有帮助!
My last adventure with MSDTC and this error today turned out to be a DNS issue. You're on the right track asking if the machines are on the same domain, EBarr. Terrific list for this issue, by the way!
My situation: I needed a server in a child domain to be able to run distributed transactions against a server in the parent domain through a firewall. I've used linked servers quite a bit over the years, so I had all the usual settings in SQL for a linked server and in MSDTC that Ian documented so nicely above. I set up MSDTC with a range of TCP ports (5000-5200) to use on both servers, and arranged for a firewall hole between the boxes for ports 1433 and 5000-5200. That should have worked. The linked server tested OK and I could query the remote SQL server via the linked server nicely, but I couldn't get it to allow a distributed transaction. I could even see a connection on the QA server from the DEV server, but something wasn't making the trip back.
I could PING the DEV server from QA using a FQDN like: PING DEVSQL.dev.domain.com
I could not PING the DEV server with just the machine name: PING DEVSQL
The DEVSQL server was supposed to be a member of both domains, but the name wasn't resolving in the parent domain's DNS... something had happened to the machine account for DEVSQL in the parent domain. Once we added DEVSQL to the DNS for the parent domain, and "PING DEVSQL" worked from the remote QA server, this issue was resolved for us.
I hope this helps!
如果您的目标服务器位于其他云或数据中心,则需要在源服务器中添加 MSDTC 服务(目标服务器) 的主机条目。
如果问题没有解决,请在启用 MSDTC 设置后尝试此操作。
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.
除了安全设置之外,我还必须在两台服务器上打开一些端口才能运行事务。我必须打开端口 59640,但根据以下建议,端口 135 必须打开。
http://support.microsoft.com/kb/839279
Apart from the security settings, I had to open some ports on both servers for the transaction to run. I had to open port 59640 but according to the following suggestion, port 135 has to be open.
http://support.microsoft.com/kb/839279
我遇到了同样的错误,我设法通过在源服务器上正确配置 MSDTC 以允许出站并允许 DTC 通过 Windows 防火墙来解决该问题。
允许分布式事务协调器,勾选域,私有和公共选项
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
允许 DTC 勾选“私有”、“公共”以及“域”的防火墙设置就可以解决问题。仅域名是不够的(感觉应该是这样,但不是)。
The Firewall settings to Allow the DTC the ticking Private and Public as well as Domain did the trick. Just Domain is not enough (it feels like it should be, but nah).
昨天我遇到了类似的问题,所以我想我会分享我的经验和解决方案。
我们尝试使用链接服务器将行从源表插入到目标表,但收到错误“无法开始分布式事务”
在尝试了多种方法后,我们发现发现问题是我们直接在同义词中使用目标表名
我们最终在目标服务器中创建了一个插入行的存储过程,并从我们的源同义词中调用了该存储过程,一切顺利,希望它有帮助。
Yesterday i had a similiar issue so i thought i will share my experience and the solution.
We were trying to insert rows from source to a destination table using linked server, but we were getting the error "Unable to begin a distributed transaction"
After trying multiple things we found out that the problem was we were using the destination table name directly in the synonyms
We ended up creating a stored procedure in the destination server which inserts the row, and from our source synonyms we called the stored procedure and wollah everything worked out, Hope it helps.