最近再用SSIS做数据归档,里面用到了分布式事务。在开发阶段是在一台计算机上运行只要是启动分布式服务就没什么问题,可是昨天把它部署到uat的时候遇到问题,错误信息是:

最后找到解决方案:

  • 确认"Distribute Transaction Coordinator"服务在Server和本地都是运行状态。(如失败可以 输入:msdtc -resetlog (注意运行此命令时,不要执行挂起的事务)
  • 在Server上打开 Component Services。 Control Panel –> System and Security –> Administrative Tools –> Component Services.
  • 展开至 Component Services –> Computers –> My Computer –> Distributed Transaction Coordinator –> Local DTC, 右键,选择Properties。在弹出的Dialog中选择Tab “Security”, 勾选Network DTC Access 等选项,具体设置如下图。
  • 以上的截图是在win8上的,如果你的系统是xp或是2003则有些变化.展开至 Component Services –> Computers –> My Computer 右键,选择Properties。在弹出的Dialog中选择Tab “MSDTC”–>Security Configuration, 勾选"Network DTC Access", "Allow Remote Client",
    "Allow Inbound/Outbound", "Enable TIP" (Some option may not benecessary, have a try to get your configuration) 等选项,具体设置如下图。
  • 确认后会要求重新启动Service。注:如果在后面的步骤做完后,还是无法解决问题,可能需要重启电脑。
  • 确认DTC不会被你的防火墙阻止。
  • 请注意,如果大家的环境和我一样不在域里面, 请选中不要求进行验证。否者在运行分布式事务时远程计算机会提示“此事务已明地或暗地被确认或终止 ”。 (计算机名称一定要能ping通,否则回报相同的错误), 注意xp系统下一般是ping不通的

    是因为防火墙禁止了icmp数据包.
    具体查看:
    开始-控制面板-防火墙-高级-ICMP-设置.允许了就可以ping通了

    1. 还发现一个问题,数据库也需要开启分布式事务的支持:右键“服务器连接”的属性,在打开的属性窗口选择“连接”,在窗口右侧,勾选“需要将分布式事务用于服务器到服务器的通信”,确定即可。

    2.需要打开分布式的端口,端口号是135,或者添加System32下msdtc.exe的例外( netsh firewall set allowedprogram %windir%/system32/msdtc.exe MSDTC enable )。

    以上是在xp中,以下是win8中防火墙设置 (入站规则和出站规则都需要设置)

    如果 此事务已明地或暗地被确认或终止 问题还没有解决可以参考以下设置:

    To get rid of this error just follow these steps to configure the registry key and REBOOT the machine.

    1. Click Start, click Run, type Regedit, and then click OK.
    2. Locate and then click the following registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT
    3. On the Edit menu, point to New, and then click Key.
    Note If the RPC registry key already exists, go to step 5.
    4. Type RPC, and then press ENTER.
    5. Click RPC.
    6. On the Edit menu, point to New, and then click DWORD Value.
    7. Type RestrictRemoteClients, and then press ENTER.
    8. Click RestrictRemoteClients.
    9. On the Edit menu, click Modify.
    10. In the Value data box, type 0, and then click OK.
    Note To enable the RestrictRemoteClients setting, type1.
    11. Close Registry Editor and restart the computer.

    RESTRICTING THE DCOM PORT RANGE

    1. Go to Start -> Run. Type in 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. You will see a window like this
    EmptyPortRange

    If you don’t see a range above and the window looks exactly like the one above, that would mean that the DCOM port range is not configured on the machine.
    You can click Add in the above window and type the range (let's say as 5000-5100) and say Ok. Make sure it looks like this. (Both the radio buttons should be selected for Internet Range)

    PortRange5000

    参考地址http://www.cnblogs.com/nzperfect/archive/2011/11/03/2234595.html

    3.在事务中,即使存在嵌套的情况,同一个事务内的所有数据库连接对数据都是可访问的。

    windows技术爱好者