Database mirroring dropped connection scenarios

In a database mirroring system, when connections between database servers drop, the following notes apply:

  • The time required for a server to notice a dropped network connection depends on:

    1. How the connection is broken. If a network cable is unplugged from the computer, some operating systems detect this problem immediately and cause the connection to be dropped. If the problem was caused by a failure in a network switch, the problem is less likely to be detected by the server immediately.

    2. The liveness timeout setting specified in the mirror connection string. See LivenessTimeout connection property.

  • For the primary server to maintain ownership of a mirrored database, it must be connected to at least one of the other servers (mirror or arbiter). When connections to both of the other servers are lost, the database is restarted and the primary server waits until it can re-establish at least one of those connections to verify its status.

  • The connections between servers are re-established automatically when the problem which caused the connection to be dropped is corrected.

  • Until a server detects a dropped connection, it maintains the role it was previously assigned. This behavior can result in two servers attempting to act as the primary server for a brief period if the server that was previously the mirror server detects a dropped connection to the primary server before the primary server detects that its connection to the mirror server was dropped. The first update made on the original primary server blocks when the server attempts to send its changes to the other server, which limits the potential for lost transactions should this situation occur.

    When the original primary detects a dropped connection from the original mirror server and checks the arbiter's state, it will see that a failover has occurred and it will restart the database.

  • If a server acting as mirror must restart its database, access to the database on that server is not allowed until a connection to the primary server is re-established.

  • Network failures may affect both client connections and mirror server connections, depending on the topology of the network.

The following scenarios help you understand what happens when connections are dropped in a mirroring system. The scenarios use the following database mirroring configuration, which consists of Server 1, Server 2, and an arbiter server running in synchronous mode:

An example database mirroring system, consisting of Server 1, Server 2, and an arbiter server.

At any time, you can use the MirrorState, PartnerState, and ArbiterState database properties to determine the status of the database servers in the mirroring system. See MirrorState database property, PartnerState database property, and ArbiterState database property.

 Scenario 7: Connection between the primary server and the arbiter server is dropped
 Scenario 8: Connection between the mirror server and the arbiter server is dropped
 Scenario 9: Connection between the primary server and the mirror server is dropped
 Scenario 10: Connection from the primary server to the mirror and arbiter servers is dropped
 Scenario 11: Connection from the mirror server to the primary and arbiter servers is dropped
 Scenario 12: Connections from the arbiter server to the primary and mirror servers are dropped
 Scenario 13: Connection between all servers are dropped