【问题标题】:linked server : "No transaction is active." and "unable to begin a distributed transaction"链接服务器:“没有交易处于活动状态。”和“无法开始分布式事务”
【发布时间】:2015-03-12 18:51:33
【问题描述】:

我的本​​地计算机上有一个 CRM 软件。在软件的 SQL 数据库中,我添加了一个链接服务器(我们的测试网站和我们的测试数据库:Windows Small Business Server 2011)。 链接服务器设置为

RPC => True
RPC Out => True
Enable Promotion of Distributed Transaction => True

我创建了一个触发器,以便在通过 CRM 软件更新公司时,它会启动一个存储过程,例如:

proc [dbo].[Proc_UpdateInstitutionWeb]
@Company_ID nvarchar(50)

as

DECLARE @id int = 0;

BEGIN TRY
    SET @id = CONVERT(int, @Company_ID)
END TRY
BEGIN CATCH
    ...
END CATCH

update [myserver].[mydatabase].[dbo].[company] 
set founded = 2000
where company.id= @id

当我在 CRM 中进行更改时,这不起作用。所以我在CRM SQL DB中的company表上尝试了一个简单的更新查询,但它抛出了以下错误:

OLE DB provider "SQLNCLI10" for linked server "myserver" returned message "No transaction is active.". Msg 7391, Level 16, State 2, Procedure Proc_UpdateInstitutionWeb, Line 34 The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "myserver" was unable to begin a distributed transaction.

这是我尝试做的:

在我的电脑和测试服务器上:

  • 在管理工具 -> 服务 -> 分布式事务协调器中: 启动服务
  • 在管理工具中 -> 组件服务 -> 计算机 -> 我的电脑 -> 分布式事务协调器 -> 本地 DTC -> 右键单击​​ -> 安全选项卡 -> 检查网络 DTC 访问和允许远程客户端并允许入站和出站。
  • 终于重启了测试服务器

这些都没有解决问题。我该怎么办?

谢谢

【问题讨论】:

    标签: sql-server transactions ssms linked-server msdtc


    【解决方案1】:

    在我脱发很多天后,这对我有用,以防有人需要。

    首先我禁用了自动 6to4 地址生成。

     1. Open Command
     2. Type the command `netsh interface 6to4 set state disabled`
    

    然后我限制了两台机器上的 DCOM 端口范围

     1. Start -> Run -> Type DCOMCNFG
     2. Go to the properties of the My Computer node under the Computers folder underneath Component Services. 
     3. Under the My Computer Properties look under the Default Protocols tab. 
     4. Over there make sure that Connection-oriented TCP/IP is selected and then click on Properties. 
     5. No range was listed. I added one. Example 5000-5100
    

    我认为之前在Component servicesServices 中对 DTC 所做的所有工作也需要进行此项工作。

    我最终得到了与DTCPing.exe 和以下参考一起使用的解决方案:

    【讨论】:

    • 您的第一步“禁用自动6to4地址生成”是针对服务器还是计算机?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-04
    • 1970-01-01
    • 1970-01-01
    • 2014-10-21
    • 2013-04-21
    • 1970-01-01
    • 2013-09-10
    相关资源
    最近更新 更多