How to fix Error 1478 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 1478 — “The mirror database… is not caught up with the principal database”

Why This Error Happens

Error 1478 occurs when database mirroring (or an Always On session using mirroring-style synchronization) cannot keep the mirror database synchronized with the principal, typically because the network link between the principal and mirror instances is too slow, unstable, or saturated to transmit the transaction log fast enough. This can also be triggered by high transaction log generation rates on the principal that outpace the mirror’s I/O or CPU capacity, or by firewall/port blocking (default mirroring endpoint port 5022) causing intermittent packet loss. In some cases, a corrupted or paused mirroring endpoint certificate/authentication configuration on Windows Server 2025 can also cause repeated synchronization failures that surface as this error.

Step-by-Step Resolution Guide

Step 1: Verify Network Connectivity and Endpoint Status

  • Open a PowerShell or Command Prompt session on both the principal and mirror servers and run Test-NetConnection -ComputerName <MirrorServerName> -Port 5022 to confirm the mirroring endpoint port is reachable.
  • Check Windows Defender Firewall (Windows Server 2025 / Windows 11) under Windows Defender Firewall with Advanced Security > Inbound Rules to ensure TCP port 5022 is allowed for both SQL Server instances.
  • Run SELECT * FROM sys.database_mirroring_endpoints; in SQL Server Management Studio (SSMS) on both servers to confirm the endpoint state is STARTED, not STOPPED or DISABLED.

Step 2: Check Mirroring Session Health and Log Send Queue

  • On the principal database, run SELECT mirroring_state_desc, mirroring_role_desc, mirroring_safety_level_desc FROM sys.database_mirroring WHERE database_id = DB_ID('YourDatabaseName'); to check the current mirroring state.
  • Query sys.dm_db_log_stats or check the Log Send Queue / Redo Queue size via SSMS’s Database Mirroring Monitor (right-click database > Tasks > Launch Database Mirroring Monitor) to see if the mirror is falling significantly behind.
  • If the queue is large, pause non-essential transactional workloads on the principal temporarily to allow the mirror to catch up.

Step 3: Review SQL Server Error Logs and Resource Usage

  • Navigate to C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Log\ERRORLOG on both servers (adjust instance folder name as needed for your SQL Server 2025 installation) and search for repeated mirroring timeout or communication errors.
  • Open Performance Monitor (perfmon.exe) and add the counters SQLServer:Database Mirroring > Log Bytes Sent/sec and Log Send Queue KB to identify sustained bottlenecks.
  • Check CPU, disk I/O, and memory utilization on the mirror server via Task Manager or Resource Monitor to rule out hardware-level bottlenecks.

Step 4: Resynchronize or Restart the Mirroring Session

  • If the mirror is critically behind, run ALTER DATABASE YourDatabaseName SET PARTNER SUSPEND; on the principal, followed by ALTER DATABASE YourDatabaseName SET PARTNER RESUME; to force a resync attempt.
  • If corruption or endpoint misconfiguration is suspected, drop and recreate the mirroring endpoint using CREATE ENDPOINT with correct certificate authentication, then re-establish the mirroring partnership via ALTER DATABASE ... SET PARTNER = 'TCP://MirrorServer:5022';.

Alternative or Verification Steps

  • After applying fixes, re-run the Database Mirroring Monitor and confirm the mirroringstatedesc returns SYNCHRONIZED and the Log Send/Redo Queue sizes trend toward zero.
  • If mirroring continues to fail intermittently, consider migrating to an Always On Availability Group (recommended in SQL Server 2025, since Database Mirroring is deprecated) for more robust synchronization and automatic failover handling.