I have an application that I would like to have support SQL Server Mirroring. However, the architecture is currently such that multiple WCF services and DB connections will be enlisted in a single MSDTC transactions, and Microsoft states that MSDTC is not supported when using Mirroring.

Their explanation is not terribly informative:

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.

What I am having a problem understanding is the last sentence. How is this any different than if the DB server was not mirrored, and just died at that same point in time? Can someone explain that to me? I need to be able to explain this to others in my organization (as well as customers), but I don't understand why MSDTC can properly rollback/compensate in one scenario, but it cannot if one of the participants is a mirrored SQL server (in Full Safety mode).

有帮助吗?

解决方案

MSDTC is no aware of mirroring. So when it enrolls a resource manager in a distributed transaction it will know that RM by its name, say Server A. After a fail over occurs, the log will tell the new principal 'go contact DTC and see what is the status of transaction T'. The new principal, named Server B, goes to DTC and says 'I am server B, what is the result of transaction T?' and the DTC will tell him 'Go away, I don't know you, you are not enrolled in transaction T'. This is what the KB article describes too:

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

You are asking "How is this any different than if the DB server was not mirrored, and just died at that same point in time?". The difference is that if this would had occur, then when the database is recovered it will be recovered on the same server and this server can contact the DTC and ask it to rollback the distributed transaction in which it was enrolled.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top