我正在尝试从我的计算机(SQL Server 2012)到客户端服务器(SQL Server 2008)运行分布式事务。
我正在尝试运行:
begin distributed transaction
select * from [172.01.01.01].master.dbo.sysprocesses
Commit Transaction
我得到:
OLE DB provider "SQLNCLI11" for linked server "172.01.01.01" 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 "172.01.01.01" was unable to begin a distributed transaction.
我可以在服务器返回数据的情况下对它运行SELECT,所以至少我知道服务器可以互相看见,并且链接服务器存在并且正在运行
现在,网络上有很多与此相关的帖子,但我无法使其正常运行。到目前为止,这是我尝试过的:
将DTC属性设置为以下(在两台服务器上)
从控制面板->服务(在两台服务器上)重新启动分布式事务处理协调器(MSDTC)。
卸载和安装的DTC(在两台服务器上)。
重新启动远程服务器。
关闭两台服务器上的防火墙。
启用了sp_configure'Ad Hoc Distributed Queries',1(在两台服务器上)。
我运行了DTCPing,并成功ping通。
还有什么可以尝试的?
更新:从另一台服务器到172.01.01.01运行事务。因此,问题不在目标服务器上,而是在源机器上。
If after configuring your MS Distributed Transaction Coordinator (MSDTC) on the two SQL server's according to the OP's original post, you still get "no transaction active", you should check that each host is reachable via the IP (assuming that's what you've used) registered in the linked server.
For example; on a recent setup, two SQL servers were reachable through a network in the 192.168.200.x range (same subnet), but each server was also indirectly connected through an IP in the 10.x.x.x range. On one SQL Server, the DNS server it used kept resolving the target SQL server to it's 10.x.x.x IP (which was firewalled) even though the linked server entry used the IP in the 192.168.200.x of the target server.
It appears that MSDTC uses the hostname of the server, while SQL server connects over any linked connection using the IP or hostname defined in the linked server entry, leading to this confusing behaviour of apparent connectivity when checking the target linked server within SQL Management Studio, but inability to execute remote procedures on the target.
The solution was to add entries in the host file's (%windir%\system32\drivers\etc\hosts) to explicitly force each SQL server to resolve the other to the IP address on the 192.168.200.x network.
On host 1 (IP 192.168.200.15):
# TARGET SERVER
192.168.200.20 targetserverhostname.and.any.domain.suffix targetserverhostname
On host 2 (IP 192.168.200.20)
# SOURCE SERVER
192.168.200.15 sourceserverhostname.and.any.domain.suffix sourceserverhostname
Don't forget to ensure MSDTC has been configured according to the OP's screenshot above allowing network access and (if required) No Authentication.
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句