Asynchronous database mirroring vs availability groups: a primary and a DR database with a quorum witness between them

Async Database Mirroring vs. Async Availability Groups: The Quorum Trap in DR Designs

Compare asynchronous database mirroring with asynchronous availability groups for SQL Server DR, learn why quorum can take production offline, and how to design and migrate safely.

May 5, 2023

For years, asynchronous database mirroring was the simplest way to keep a copy of a SQL Server database at a disaster recovery site. Mirroring is now deprecated, so most teams replace it with an asynchronous Always On availability group. On paper the two look almost identical: one primary, one remote copy, no waiting for the DR site on commit, and a forced failover with possible data loss when disaster strikes.

There’s one difference that catches teams out, though. An availability group depends on cluster quorum, and database mirroring doesn’t. Copy a mirroring design one-to-one into a two-node cluster, and taking the DR server down for maintenance can take your production databases offline with it.

This guide compares asynchronous database mirroring and asynchronous availability groups, explains the quorum trap, and shows how to design and migrate a DR setup that keeps production running when the DR site goes away.

Database Mirroring vs. Availability Groups at a Glance

Asynchronous database mirroring Asynchronous availability group
Status Deprecated since SQL Server 2012; to be removed in a future version Microsoft’s recommended replacement
Depends on Only the two SQL Server instances A Windows Server Failover Cluster (or Pacemaker on Linux) and its quorum
Scope One database per session; databases can’t fail over as a group A group of databases that fail over together
Remote copies One mirror Up to eight secondaries (Enterprise); one (basic AG, Standard)
Readable copy No, only through database snapshots Yes on Enterprise; no on basic AGs
Failover to DR Forced service, possible data loss Forced failover, possible data loss
Client redirection Failover Partner in the connection string Availability group listener
Edition Asynchronous mode needs Enterprise; Standard supports full safety (synchronous) only Enterprise; Standard through basic AGs, which support asynchronous commit
SQL Server High Availability

Move from mirroring to availability groups safely

In a free assessment meeting, we'll review your current mirroring or DR setup, your quorum design and your migration plan with you.

Free Assessment Meeting

What Happens When the DR Server Goes Down

The real difference between the two technologies shows up when the DR side disappears, whether for planned maintenance, a crash or a broken link between sites.

With Asynchronous Database Mirroring

Production keeps running. The principal doesn’t wait for the mirror, so users notice nothing. The only side effect is in the transaction log: log records that haven’t reached the mirror can’t be truncated, even after a log backup. The log keeps growing until the mirror comes back and catches up. As long as the log drive has enough free space, the outage on the DR side is invisible to production.

With an Asynchronous Availability Group

An availability group lives inside a cluster, and the cluster only stays online while a majority of its votes is present. Picture the typical mirroring replacement: two nodes, one in each data center, and no witness. Each node has one vote. When the DR node or the link between sites fails, the primary node can be left without a majority, and the cluster can go offline. When that happens, the availability group goes offline too. The primary SQL Server is perfectly healthy, yet the application can no longer reach its databases, and someone has to bring the cluster back by hand.

Critical

In an availability group, the DR site can take production down with it. If the cluster loses quorum, the primary replica goes offline even though nothing is wrong with the primary server. Mirroring never had this dependency, so a design that was safe with mirroring isn’t automatically safe with an availability group.

Dynamic quorum in modern Windows Server versions adjusts votes as nodes leave the cluster and makes this less likely, especially during a planned shutdown. In a two-node cluster without a witness, though, it can’t protect you against every unplanned failure or a network split between sites. Don’t rely on it as your quorum design.

Both technologies share one more behavior. While an asynchronous secondary is disconnected, the primary can’t truncate the log records it hasn’t sent yet. In sys.databases, the database’s log_reuse_wait_desc shows AVAILABILITY_REPLICA, and the log grows until the secondary catches up or is removed from the group.

Warning

A DR replica that’s down for days can fill the primary’s log drive. Size the log drive for the longest DR outage you’re willing to tolerate, alert on log usage, and if the DR site will be gone longer than that, remove the database from the group and re-seed it later.

How to Design an Asynchronous Availability Group for DR

Microsoft’s quorum guidance for availability groups addresses this problem directly. Three changes turn the fragile two-node design into one where production survives the loss of the DR site.

1. Don’t Give the DR Node a Vote

Microsoft’s guidance is to give votes to the node hosting the primary replica and to any automatic failover targets, and generally not to nodes at a secondary DR site. You don’t want the DR site to take part in a decision to take the cluster offline when there’s nothing wrong with the primary site. Remove its vote by setting its NodeWeight to 0.

2. Keep the Number of Votes Odd With a Witness

If the remaining voting members are even, add a witness so a tie can’t take the cluster down. A file share witness should sit outside the cluster nodes and be visible to all of them. A cloud witness uses an Azure Storage account instead and is a good fit when there’s no reliable third location.

Both changes take a few lines of PowerShell on a cluster node:

# Remove the vote from the DR-site node
(Get-ClusterNode -Name "SQLDR01").NodeWeight = 0

# Add a file share witness outside both cluster nodes
Set-ClusterQuorum -FileShareWitness "\\witness-server\SQLCluster-Witness"

# Check the result
Get-ClusterNode | Format-Table Name, State, NodeWeight, DynamicWeight
Get-ClusterQuorum

You can check the same thing from SQL Server. number_of_current_votes shows the votes after dynamic quorum has made its adjustments:

SELECT cluster_name, quorum_type_desc, quorum_state_desc
FROM sys.dm_hadr_cluster;

SELECT member_name,
       member_type_desc,
       member_state_desc,
       number_of_quorum_votes,
       number_of_current_votes
FROM sys.dm_hadr_cluster_members;

3. Write Down the Real Disaster Procedure

A DR node without a vote can’t form quorum on its own. That’s what you want day to day, but it means a real disaster needs a documented manual procedure. When the primary site is lost:

  1. Force the cluster to start without quorum on the DR node.
  2. Run a forced failover on the DR replica with ALTER AVAILABILITY GROUP [AG_Name] FORCE_FAILOVER_ALLOW_DATA_LOSS;
  3. Resume the suspended secondary databases once the old primary comes back, and decide what to do with transactions that never reached the DR site.
  4. Re-check vote assignments so the cluster has a healthy quorum in its new shape.

Keep this procedure next to your outage runbook and rehearse it. Nobody should be reading cluster documentation for the first time during a disaster.

Tip

Before going live, shut down the DR node and cut the link between sites in a maintenance window. If the primary replica stays online and the application keeps working, your quorum design is right. It’s a short test that catches the most common flaw in availability group DR designs.

Migrating From Mirroring to an Availability Group

  • Pick the right edition path. On Enterprise, use a regular availability group. On Standard, use one basic availability group per database; basic AGs support asynchronous commit.
  • Build the cluster and quorum first. Apply the vote and witness design above before any database joins the group.
  • Plan the cut-over. A database can’t be in a mirroring session and an availability group at the same time. Remove mirroring, then prepare the secondary copy (a restore WITH NORECOVERY or automatic seeding) and join it to the group.
  • Copy what lives outside the database. Logins, SQL Server Agent jobs, linked servers and credentials aren’t part of the group. Create them on the DR replica too.
  • Change the connection strings. Applications should connect to the listener instead of using Failover Partner. With only two replicas and no readable secondary, Microsoft notes that a mirroring connection string still works temporarily, which can soften the cut-over.
  • Watch the queues. In our experience, unmonitored availability group latency is one of the most common problems in environments we take over. Alert on the log send queue and on log usage on the primary; the query in our SQL Server high availability guide is a good starting point.
  • Test both failovers. Test a forced failover to DR and the return to the primary site before you rely on the design.

When an Availability Group Isn’t the Answer

If you only need a DR copy and don’t want any cluster dependency, log shipping is still a solid choice. It works without a cluster, supports several secondaries and can delay restores on purpose as a buffer against accidental changes. Failover is manual, just as it is with asynchronous mirroring. Read-scale availability groups also run without a cluster, but Microsoft positions them for read scale-out rather than high availability. For a full comparison of the options, see our SQL Server high availability guide, and for availability group basics, our SQL Server Always On guide.

It still exists in current SQL Server versions, but it has been deprecated since SQL Server 2012 and will be removed in a future version. Microsoft recommends availability groups for new work: basic availability groups on Standard edition and regular availability groups on Enterprise edition.
The cluster lost quorum. In a two-node cluster without a witness, losing one node can leave the other without a majority of votes, and the cluster takes the availability group offline. Add a witness and remove the vote from the DR-site node.
No. Standard edition supports database mirroring only in full safety (synchronous) mode. For an asynchronous DR copy on Standard edition, use a basic availability group in asynchronous-commit mode or log shipping.
It can. The only failover available to an asynchronous replica is a forced failover, and any log records the primary hadn’t sent yet are lost. The size of the log send queue at that moment is the amount of data at risk.
With an Enterprise availability group, yes: a secondary can be configured for read-only access. Basic availability groups don’t allow reads on the secondary, and a mirror database can only be read through a database snapshot.

SQL Server High Availability

Replace mirroring without creating a new single point of failure

Aryasoft’s senior DBA team designs the cluster, quorum and availability group layout for your DR site, migrates your mirrored databases and tests every failover path with your team.

4.7/5