Windows 上的 MSSQL: 恢复数据库时出错。无法连接到 MSDTC 以检查事务的完成状态

Microsoft.SQLServer.Windows.EventRule.DBEngine.Error_recovering_database_._Could_not_connect_to_MSDTC_to_check_the_completion_status_of_transaction_1_5_Rule (Rule)

当您使用 MS DTC 跨多个服务器管理分布式事务且发生连接丢失时,分布式事务将被置为未知或“置疑”状态。中断的常见原因为:

Knowledge Base article:

摘要

当您使用 MS DTC 跨多个服务器管理分布式事务且发生连接丢失时,分布式事务将被置为未知或“置疑”状态。中断的常见原因为:

上停止其他涉及的服务。连接中断之后,MS DTC 使当时正在处理中的所有事务置为不一致状态。“置疑”事务导致这些症状是因为 SQL Server 无法确定要提交还是回滚事务,且 SQL Server 需要 MS DTC 告诉它如何处理。

解决方法

有多种不同的方法可以用于解决不一致的分布式事务: :

使用 MS DTC 管理控制台:

.在“运行”对话框中键入“mmc.exe”(不带引号),以打开 Microsoft 管理控制台 (MMC)

.在 MMC 中的“控制台”菜单上,单击“添加/删除管理单元”

.在“添加/删除管理单元”对话框中,单击“添加”

.在“添加独立管理单元”对话框中,单击“组件服务”,然后单击“添加”以添加管理单元。

.单击“关闭”

.在“添加/删除管理单元”对话框中,单击“确定”

.在“组件服务”下的控制台根目录中,展开“组件服务”,依次指向“计算机”、“我的电脑”,然后单击“分布式事务处理协调器”

.选择“事务列表”。您将在详细信息窗格中看到事务。用鼠标右键单击事务,然后单击“解析”。您现在有三个选项:“提交”、“中止”或“略过”。从中选择适合您的情况的选项

可替代参数

名称

说明

默认值

已启用

启用或禁用工作流。

间隔(秒)

运行工作流的重复间隔时间(秒)。

300

优先级

定义警报优先级。

1

严重性

定义警报严重性。

1

同步时间

同步时间

 

超时(秒)

指定允许工作流在被关闭并标记为失败之前运行的时间。

200

数据库连接超时(秒)

如果在指定期间无法访问数据库,工作流将失败并注册一个事件。

15

Element properties:

TargetMicrosoft.SQLServer.Windows.DBEngine
CategoryEventCollection
EnabledTrue
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
RemotableTrue
Alert Message
Windows 上的 MSSQL: 恢复数据库时出错。无法连接到 MSDTC 以检查事务的完成状态
{0}
CommentMom2017ID='{6B1C776D-E075-4F73-B9C0-66CEF9024905}';MOM2017GroupID={467ECC75-C5DA-42BD-955C-A73BBB51AF74}

Member Modules:

ID Module Type TypeId RunAs 
_F6DA1507_12AF_11D3_AB21_00A0C98620CE_ DataSource Microsoft.SQLServer.Windows.DataSource.EventCollectionFiltered Default
GenerateAlert WriteAction System.Health.GenerateAlert Default

Source Code:

<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>