sql-server - 为什么使用 SQL Server 镜像和自动故障转移时不支持 MSDTC?

标签 sql-server msdtc failover high-availability database-mirroring

我有一个应用程序希望支持 SQL Server 镜像。但是,目前的架构是在单个 MSDTC 事务中登记多个 WCF 服务和数据库连接,并且 Microsoft 声明使用镜像时不支持 MSDTC。

Their explanation信息量不大:

A similar scenario can occur when you use database mirroring with MS DTC transactions. For example, the new principal server contacts the MS DTC after a failover. However, the MS DTC has no knowledge of the new principal server. Therefore, the MS DTC stops any transactions that are in the "preparing to commit" phase, even though the transactions are considered committed in other databases.

我无法理解的是最后一句话。这与数据库服务器没有镜像并且在同一时间点挂掉有什么不同?有人可以向我解释一下吗?我需要能够向组织中的其他人(以及客户)解释这一点,但我不明白为什么 MSDTC 可以在一种情况下正确回滚/补偿,但如果参与者之一是镜像 SQL 服务器则不能(在完全安全模式下)。

最佳答案

MSDTC 不知道镜像。因此,当它在分布式事务中注册资源管理器时,它会知道 RM 的名称,例如服务器 A。发生故障转移后,日志将告诉新主体“联系 DTC 并查看事务 T 的状态是什么” '。新的委托(delegate)人,名为服务器 B,前往 DTC 并说“我是服务器 B,事务 T 的结果是什么?” DTC 会告诉他“走开,我不认识你,你没有注册事务 T”。这也是知识库文章所描述的内容:

After a failover, the new principal server cannot connect to the MS DTC of the previous principal server that uses the same resource ID. Therefore, the new principal server cannot obtain the transaction status

您问“这与数据库服务器没有镜像并且在同一时间点死亡有何不同?”。区别在于,如果发生这种情况,那么当数据库恢复时,它将在同一服务器上恢复,并且该服务器可以联系 DTC 并要求其回滚它所注册的分布式事务。

关于sql-server - 为什么使用 SQL Server 镜像和自动故障转移时不支持 MSDTC?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3231765/

相关文章:

php - 用于 MS SQL Server 的 PDO DBLIB 驱动程序 : Cannot find php_pdo_driver. h

sql-server - 使用 SQL Server Windows 身份验证时解析权限

mongodb - 在 J=1 和 W=Majority 的 MongoDB 副本集上是否仍然可以回滚?

SQL Server select where sql_variant equal 不起作用?

MySQL 从结果中获取平均值,平均值必须在 8 到 12 之间

sql - 分布式事务如何在线程环境中与同一个 DB 的多个连接一起工作?

.net-4.0 - PROMOTE TRANSACTION 请求失败,因为没有事件的本地事务

sql-server-2008 - 无法开始分布式事务 : Linked Server -> Access database

redis - 集群故障转移

apache - httpd mod_proxy_balancer 故障转移 failonstatus - 透明切换