当您使用 MS DTC 跨多个服务器管理分布式事务且发生连接丢失时,分布式事务将被置为未知或“置疑”状态。中断的常见原因为:
当您使用 MS DTC 跨多个服务器管理分布式事务且发生连接丢失时,分布式事务将被置为未知或“置疑”状态。中断的常见原因为:
网络错误
停止 MSSQLSERVER 或 MS DTC
在分布式事务涉及的一台或多台计算机
上停止其他涉及的服务。连接中断之后,MS DTC 使当时正在处理中的所有事务置为不一致状态。“置疑”事务导致这些症状是因为 SQL Server 无法确定要提交还是回滚事务,且 SQL Server 需要 MS DTC 告诉它如何处理。
有多种不同的方法可以用于解决不一致的分布式事务: :
您可以使用 SQL Server 联机丛书中的“MS DTC 事务疑难解答”中描述的方法
如果您在该分布式事务(或多个事务)中涉及的一个或多个服务器上停止了 MS DTC,则重新启动 MS DTC 可能会解决问题。
通常,您可以使用 MS DTC 管理控制台。
使用 MS DTC 管理控制台:
.在“运行”对话框中键入“mmc.exe”(不带引号),以打开 Microsoft 管理控制台 (MMC)
.在 MMC 中的“控制台”菜单上,单击“添加/删除管理单元”
.在“添加/删除管理单元”对话框中,单击“添加”
.在“添加独立管理单元”对话框中,单击“组件服务”,然后单击“添加”以添加管理单元。
.单击“关闭”
.在“添加/删除管理单元”对话框中,单击“确定”
.在“组件服务”下的控制台根目录中,展开“组件服务”,依次指向“计算机”、“我的电脑”,然后单击“分布式事务处理协调器”
.选择“事务列表”。您将在详细信息窗格中看到事务。用鼠标右键单击事务,然后单击“解析”。您现在有三个选项:“提交”、“中止”或“略过”。从中选择适合您的情况的选项
名称 | 说明 | 默认值 |
已启用 | 启用或禁用工作流。 | 是 |
间隔(秒) | 运行工作流的重复间隔时间(秒)。 | 300 |
优先级 | 定义警报优先级。 | 1 |
严重性 | 定义警报严重性。 | 1 |
同步时间 | 同步时间 |
|
超时(秒) | 指定允许工作流在被关闭并标记为失败之前运行的时间。 | 200 |
数据库连接超时(秒) | 如果在指定期间无法访问数据库,工作流将失败并注册一个事件。 | 15 |
Target | Microsoft.SQLServer.Windows.DBEngine | ||
Category | EventCollection | ||
Enabled | True | ||
Alert Generate | True | ||
Alert Severity | Warning | ||
Alert Priority | Normal | ||
Remotable | True | ||
Alert Message |
| ||
Comment | Mom2017ID='{6B1C776D-E075-4F73-B9C0-66CEF9024905}';MOM2017GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74} |
ID | Module Type | TypeId | RunAs |
---|---|---|---|
_F6DA1507_12AF_11D3_AB21_00A0C98620CE_ | DataSource | Microsoft.SQLServer.Windows.DataSource.EventCollectionFiltered | Default |
GenerateAlert | WriteAction | System.Health.GenerateAlert | Default |
<Rule ID="Microsoft.SQLServer.Windows.EventRule.DBEngine.Error_recovering_database_._Could_not_connect_to_MSDTC_to_check_the_completion_status_of_transaction_1_5_Rule" Target="SqlDiscW!Microsoft.SQLServer.Windows.DBEngine" Enabled="true" ConfirmDelivery="true" Remotable="true" Comment="Mom2017ID='{6B1C776D-E075-4F73-B9C0-66CEF9024905}';MOM2017GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="_F6DA1507_12AF_11D3_AB21_00A0C98620CE_" Comment="{F6DA1507-12AF-11D3-AB21-00A0C98620CE}" TypeID="Microsoft.SQLServer.Windows.DataSource.EventCollectionFiltered">
<MachineName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</MachineName>
<NetbiosComputerName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/NetbiosComputerName$</NetbiosComputerName>
<InstanceName>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</InstanceName>
<ConnectionString>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/ConnectionString$</ConnectionString>
<InstanceVersion>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Version$</InstanceVersion>
<InstanceEdition>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/Edition$</InstanceEdition>
<MonitoringType>$Target/Property[Type="SqlDiscW!Microsoft.SQLServer.Windows.DBEngine"]/MonitoringType$</MonitoringType>
<SqlExecTimeoutSeconds>60</SqlExecTimeoutSeconds>
<SqlTimeoutSeconds>15</SqlTimeoutSeconds>
<TimeoutSeconds>200</TimeoutSeconds>
<IntervalSeconds>300</IntervalSeconds>
<SyncTime/>
<EventDisplayNumber>3437</EventDisplayNumber>
</DataSource>
</DataSources>
<WriteActions>
<WriteAction ID="GenerateAlert" TypeID="Health!System.Health.GenerateAlert">
<Priority>1</Priority>
<Severity>1</Severity>
<AlertMessageId>$MPElement[Name="Microsoft.SQLServer.Windows.EventRule.DBEngine.Error_recovering_database_._Could_not_connect_to_MSDTC_to_check_the_completion_status_of_transaction_1_5_Rule.AlertMessage"]$</AlertMessageId>
<AlertParameters>
<AlertParameter1>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/MachineName$</AlertParameter1>
<AlertParameter2>$Target/Property[Type="SqlCoreLib!Microsoft.SQLServer.Core.DBEngine"]/InstanceName$</AlertParameter2>
<AlertParameter3>Event ID: $Data/Property[@Name='EventID']$. $Data/Property[@Name='Message']$</AlertParameter3>
</AlertParameters>
<Suppression>
<SuppressionValue/>
</Suppression>
</WriteAction>
</WriteActions>
</Rule>