How to Fix SQL Server Error 14421 (Msg 14421)
You see sql server error 14421 when a log shipping secondary database misses its restore limit. You fix it by finding the stalled log job and applying the missing log files. This alert carries a severity level of 16 in the database engine. The engine states that the secondary database passed its restore threshold in minutes. It also confirms that the database is out of sync because no restore ran. When this alert fires, your standby node no longer matches the primary database. What causes sql
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You see sql server error 14421 when a log shipping secondary database misses its restore limit. You fix it by finding the stalled log job and applying the missing log files.
This alert carries a severity level of 16 in the database engine. The engine states that the secondary database passed its restore threshold in minutes. It also confirms that the database is out of sync because no restore ran. When this alert fires, your standby node no longer matches the primary database.
What causes sql server error 14421 in log shipping
Log shipping relies on three scheduled jobs to keep a warm standby database current. First, the primary server backs up the transaction log to a local folder. Second, a copy job moves that backup file across the network to the secondary host. Third, a restore job applies that file to the standby database on a schedule.
When the restore job does not finish within your set threshold, the monitor fires this alert. Several common failures break this chain between the two database hosts. Network drops can block the copy job from reaching the shared backup folder. Full disks on either server can stop new log files from writing or copying.
Account changes also break the log shipping chain between hosts. The service account running the copy or restore job may lose folder read rights. Sometimes an engineer runs an extra manual log backup on the primary database. That manual backup breaks the log chain, so the secondary node rejects the next file.
Long-running queries on a readable standby database can also block the restore job. The restore step needs exclusive access to apply transaction logs to the secondary database. If reporting users hold locks on the standby node, the restore job times out.
How to diagnose and fix the out of sync standby
Start your check by reviewing the job history on both the primary and secondary servers. Look at the backup job on the primary server to confirm it still writes files. Next, check the copy job on the secondary server for network or folder errors. Finally, read the restore job logs to see why the last file failed to apply.
Kubernetes API Server Access + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
If a network drop or full disk stopped the copy step, clear that block first. Free up disk space or restore the network link between the two database hosts. Then run the copy job and the restore job in order to catch up. Watch the monitor table to verify that the restore age drops below the threshold.
If an out-of-order log backup broke the chain, inspect the backup history on the primary host. Find the missing log file and copy it to the secondary server folder by hand. Once the missing file sits in the folder, the next restore job will catch up. If that missing file is gone, take a fresh differential or full backup to reseed.
How to keep repairs safe in production
Engineers often grant broad server roles during an outage just to make jobs run. Avoid giving full database owner rights to user accounts or reporting tools during a fix. In SQL Server, the owner role can change settings and even drop the database. Instead, keep user logins and automated jobs limited to the exact permissions they need.
For people who need access to many databases, a login in master is common. For access to one or a few databases, a contained database user is an option. Give reporting users the fixed reader role so they only read user tables and views. Never disable the alert monitor just to hide the error message during a repair.
Govern SQL Server queries and responses in flight
Table grants decide which SQL Server objects a caller may touch. They do not check query intent or rewrite sensitive values in results across every client and agent. By design, hoop.dev sits inline in the TDS wire protocol next to SQL Server as a sidecar for your SQL Server. On every production batch from an engineer or AI agent, hoop.dev decides to pass, mask, block, or hold it for approval.
With hoop.dev guardrails and hoop.dev data masking, banned statements are refused or held for review, matched sensitive fields in supported result columns are masked in memory, and each decision is logged. Check out the code on GitHub.
Frequently asked questions
Does sql server error 14421 stop the primary database from working?
No, this error only means the secondary standby database is behind on log restores. Your primary database still takes reads and writes, but your disaster recovery copy is stale.
Can I raise the restore threshold to clear sql server error 14421?
Raising the threshold only hides the alert if your restore job is truly stuck. Only raise the limit if large log files take longer to copy over slow links.
What happens if the missing transaction log backup file was deleted?
You cannot skip a missing log file in a log shipping sequence. You must apply a differential backup from the primary or reseed the secondary with a full backup.
Related guides
In this post