A SQL Server replica database—an Always On availability group secondary, a log-shipping subscriber, or a replication subscriber—recovers in completely different ways depending on which one it is, and picking the wrong method is the most common reason a recovery makes things worse. In Always On, a secondary that's merely disconnected needs no restore at all: you resume data movement. In log shipping, a subscriber behind on restores needs the missing transaction log backups applied. In transactional replication, a broken subscriber usually needs a fresh snapshot. Only when the underlying data is damaged or missing do you fall back to a full restore or reseed. The sections below walk through each case in the order you'd actually do the work, with the checks that confirm success.

First Identify the Replica Type and the Actual Failure

Before touching anything, answer three questions: what kind of replica is it, what exactly stopped working, and is the primary healthy? Recovering the wrong layer is the classic mistake—for example, reinitializing an availability group secondary that only had its data movement suspended, or restoring a snapshot onto a subscriber when the distributor had simply stopped its agent jobs.

Gather the state from the primary or distributor, because a replica may be unreachable itself. For Always On, run SELECT ar.replica_server_name, drs.database_id, drs.synchronization_state_desc, drs.synchronization_health_desc, drs.is_suspended FROM sys.dm_hadr_database_replica_states drs JOIN sys.availability_replicas ar ON ar.replica_id = drs.replica_id; on each replica that is reachable. For log shipping, check msdb.dbo.log_shipping_monitor_secondary (or the monitor's reports). For replication, check the distribution database's agent history and sp_replmonitorhelpsubscription.

Then classify the problem into one of four buckets: (1) connection or agent interruption with intact data, (2) a delay or gap that can still be closed with existing log backups, (3) a replica database that is corrupt, suspect, or physically gone, or (4) a logical inconsistency where the replica's data no longer matches the primary. Buckets 1 and 2 are cheap and reversible; buckets 3 and 4 usually mean a full restore or reseed. Confirm you have a recent full backup and the log chain from the primary before you start, and confirm no one else is mid-recovery on the same replica.

Recovering an Always On Secondary That Is Suspended or Disconnected

This is the most common "recover replica" scenario, and often the least destructive. A secondary can be suspended (is_suspended = 1), disconnected, or in a NOT SYNCHRONIZED state while its database files remain perfectly valid. The immediate action is to resume data movement, not to restore.

Prerequisites: the secondary instance is online, the database is joined to the availability group, and the primary is healthy. Run these on the secondary replica, in order:

1: Confirm the state: SELECT database_id, synchronization_state_desc, synchronization_health_desc, is_suspended, suspend_reason_desc FROM sys.dm_hadr_database_replica_states; 2: Verify the endpoint is listening and the replica is connected: SELECT * FROM sys.dm_hadr_availability_replica_states; and check connection_state_desc. If it's DISCONNECTED, check the availability group endpoint port, firewall, and that both instances can resolve each other. 3: Resume movement: ALTER DATABASE [YourDb] SET HADR RESUME; 4: If the replica is far behind and resuming produces a long catch-up, monitor log_send_queue_size and redo_queue_size on the secondary; both should trend down. 5: If the primary's log has been truncated past the secondary's last received LSN (for example, the secondary was down for days), resuming will fail with an error indicating the log is needed. That's the stop condition: you cannot close the gap with existing logs, and the secondary must be resynchronized from a fresh backup or reseeded.

Success check: synchronization_state_desc moves to SYNCHRONIZED (or SYNCHRONIZING with health HEALTHY and a shrinking redo queue), and is_suspended returns to 0. Failure signature: the resume command returns an error about missing log records or LSN mismatch, which means the gap is unrecoverable by resume alone—proceed to the reseed/restore path below.

Recovering a Secondary by Restore or Reseed

When the secondary's database is damaged or its log gap is too large, you restore the primary's full backup with WITH NORECOVERY, then either let automatic seeding catch it up or apply log backups manually. Automatic seeding is the simpler path if it's enabled: suspend data movement, remove the database from the availability group on the secondary, drop it (after confirming it's the secondary copy, not the primary), then re-add it with ALTER AVAILABILITY GROUP ... ADD DATABASE and GRANT CREATE ANY DATABASE to the AG service account. SQL Server streams the backup over the endpoint.

Manual restore, in order, for a large database where seeding would be too slow:

1: Take or locate a recent full backup of the primary. 2: On the secondary, RESTORE DATABASE [YourDb] FROM DISK = '...' WITH NORECOVERY, REPLACE; 3: Restore all transaction log backups since that full backup with WITH NORECOVERY, in LSN order. 4: Join the database back to the AG: ALTER DATABASE [YourDb] SET HADR AVAILABILITY GROUP [YourAG]; 5: Resume and monitor the redo queue.

Success check: the database appears in sys.dm_hadr_database_replica_states with a valid synchronization state and a redo queue that drains to zero. The failure mode to watch for is a restore that leaves the database in RECOVERY PENDING because a log backup in the chain is missing or out of order—check RESTORE HEADERONLY and RESTORE FILELISTONLY before committing.

Recovering a Log-Shipping Subscriber

Log shipping has its own recovery logic, and it's more forgiving than Always On because the primary doesn't need to know about the secondary. The subscriber is restored continuously with WITH STANDBY or WITH NORECOVERY, and a lagging subscriber usually just needs the missing log backups applied.

Prerequisites: the primary's log backups exist in the share, the copy job has delivered them, and the restore job is enabled on the secondary.

1: Check the monitor tables on the monitor server: msdb.dbo.log_shipping_monitor_secondary shows last_restored_file, last_restored_date, and restore_threshold. A restore_threshold of minutes or hours that's been exceeded tells you how far behind the subscriber is. 2: On the secondary, list what's in the copy destination folder and compare it to last_restored_file. Apply any undelivered or unapplied backups in order: RESTORE LOG [YourDb] FROM DISK = '...' WITH NORECOVERY; (or WITH STANDBY = '...' if the subscriber must be readable). 3: If the restore job itself is failing, check that the SQL Server service account on the secondary can read the share and that no one has the database in use—WITH STANDBY requires exclusive access to the standby file. 4: If the gap is too large (the primary truncated logs past the subscriber's last restore), you must reinitialize the subscriber with a fresh full backup: restore it WITH NORECOVERY, then let the restore job pick up subsequent logs.

Success check: the restore job completes without error, last_restored_date advances, and the subscriber's lag drops to within its configured threshold. The stop condition for further work is a restore that keeps failing on a specific log file due to a torn or missing backup—that needs the backup chain re-established from the primary, not repeated retries on the secondary.

Recovering a Transactional Replication Subscriber

Replication subscribers break in a different way: the data may be intact but out of sync, or the subscription may be marked inactive because the distribution agent stopped. The recovery depends on whether the subscriber can be brought current by replaying pending commands or must be reinitialized.

Prerequisites: the distributor and publisher are healthy, and you know the subscription's state.

1: Check the subscription status: sp_replmonitorhelpsubscription on the distributor, or sp_helpsubscription for configuration. Look for a status of "inactive" or a latency value. 2: If the distribution agent is simply stopped, restart it with sp_start_job for the agent job (find it via sp_helpdistributor or the agent profile). Pending commands in the distribution database will replay. 3: If the subscriber database is corrupt or the data has diverged, reinitialize: sp_reinitsubscription @publication = '...', @subscriber = '...', @destination_db = '...'; This marks the subscription for reinitialization; the next snapshot agent run generates a new snapshot, and the distribution agent applies it. 4: For a large subscriber where a fresh snapshot is impractical, you can restore a backup of the publisher and then configure the subscription with @sync_type = 'initialize with backup'—but this is only valid if the backup was taken after the publication was created and you have the exact LSN. This is the point where a DBA familiar with the topology should be involved; getting the LSN wrong produces a subscription that appears healthy but has silent divergence.

Success check: the distribution agent reports a successful snapshot application and the subscriber's latency returns to near zero. A subtle failure case: reinitialization can succeed on the subscriber while the subscriber has triggers or constraints that reject replicated commands—check the distribution agent history for "command rejected" errors, not just the agent's success status.

When the Replica Data Is Corrupt or Physically Destroyed

If the replica database is suspect, in RECOVERY PENDING, or the file is gone, restore is the only path, and the replica's role determines what you can restore from. Always On secondaries can be restored only with WITH NORECOVERY (they must remain in restoring state to receive log). Log-shipping subscribers are the same. Replication subscribers can be restored from a publisher backup or reinitialized.

The one rule that saves hours: never run DBCC CHECKDB with repair options on a database that's part of a replica topology without first removing it from the topology. Repair can change page contents, which makes the replica's log chain invalid and forces a reseed anyway—but now you've also lost the chance to investigate the original corruption. Instead, restore a known-good backup to the secondary and let it catch up, or reseed.

For an Always On secondary with corruption, the sequence is: remove it from the availability group, restore the primary's full and log backups WITH NORECOVERY, rejoin, and let redo apply. For a log-shipping subscriber with corruption, restore the last good full backup and apply the logs that followed. Both cases share a success check: the database reaches a synchronized state without errors in the SQL Server error log or the restore job.

Recovering After a Failover

If the replica you need to recover is now the primary because of a failover, the situation is reversed: you're recovering the old primary to become a secondary again. The steps are the same as restoring a secondary—restore WITH NORECOVERY or reseed—but the failure mode is different. The old primary may have a divergent log chain if it was forced to fail over before the new primary had all its transactions, which means it has transactions the new primary lacks (a "split brain" scenario). SQL Server 2016 and later can detect this: a secondary that has extra log records fails to join with a message about the log containing records the primary doesn't have. The fix is to restore from the new primary's backup, not to try to force the old primary's logs in. Don't attempt to resolve a split brain by forcing the old primary to rejoin as-is; the data will diverge silently.

Trade-Offs: Which Recovery Path Fits Which Situation

The choice between reseed and manual restore, or between reinitialize and backup-based initialization, comes down to time, size, and whether the replica can be offline.

Situation Recommended path Data loss risk Main constraint
Always On secondary suspended, intact data Resume (SET HADR RESUME) None Log gap must be within the primary's retained log
Always On secondary with large gap Automatic seeding or manual restore WITH NORECOVERY None if backups verified Seeding streams over endpoint; time scales with database size
Log-shipping subscriber behind Apply missing log backups in order None Gap must be within retained log backups
Log-shipping subscriber beyond log retention Reinitialize from full backup None if backup is current Requires exclusive access for WITH STANDBY
Replication subscriber out of sync Reinitsubscription (new snapshot) None for snapshot path; some for backup-init Snapshot size can be huge; backup-init needs exact LSN
Corrupt replica Restore known-good backup Whatever is between backup and failure Must remove from topology before repair

A worked sense of scale: if a 2 TB database reseeds over a 1 Gbps endpoint, expect several hours of transfer plus redo, so schedule it in a maintenance window; a manual restore from a 500 MB log backup applied to a subscriber with a small gap is typically minutes. These are illustrative, not measured on your hardware.

Recovery Failure Cases and Stop Conditions

The recovery path fails in predictable ways, and each has a specific stop condition where further work needs a DBA or vendor support rather than more retries.

Always On log gap too large: the primary's log was truncated past the secondary's last LSN. Stop and reseed; do not try to force resume with undocumented flags. Replication with an expired snapshot: sp_reinitsubscription reuses the snapshot, but if the snapshot has been deleted or is older than the publication's retention, the subscription can't be applied—regenerate the snapshot. Log-shipping with a torn backup: RESTORE VERIFYONLY returns "The backup set on file X is damaged." Stop; re-establish the chain from the primary. Replication with command rejection: the distribution agent reports a failed command due to a constraint or trigger; the subscriber is partway through replay and the transaction needs manual resolution by someone who knows the data model—this is a legitimate stop condition.

Practical Checks That Catch Most Problems Early

Three checks would prevent most failed recoveries. First, verify your backups before you need them: run RESTORE VERIFYONLY on the latest full and log backups on a schedule, not after an outage. Second, monitor replica lag continuously—sys.dm_hadr_database_replica_states for Always On, log_shipping_monitor_secondary for log shipping, sp_replmonitorhelpsubscription for replication—so a suspended replica is caught within minutes rather than days. Third, know your topology's LSN boundaries before you act: for Always On, confirm the secondary's last received LSN is still in the primary's log via sys.dm_hadr_database_replica_states on the primary; for replication backup-based initialization, confirm the backup LSN with RESTORE HEADERONLY.

One version difference worth noting: SQL Server 2016 introduced automatic seeding for Always On, and SQL Server 2019 improved it, so a reseed that required manual backup share configuration in 2014 can now be done over the endpoint. Older versions (2012 and earlier) have no automatic seeding and require the manual restore path, which changes your recovery plan. If you're on SQL Server 2022 or later, sys.dm_hadr_physical_seeding_stats gives live progress for a seeding operation, which is the check to confirm a reseed is actually moving rather than stalled.

None of these steps require a special tool, but every one requires that you know which replica type you have and whether the replica's data is intact. Start with the identification step, confirm the log boundaries before resuming, and treat "log too far behind" as a reseed signal rather than something to force. That sequence keeps a routine recovery from becoming a data-loss event.