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

Troubleshooting Guide: Error 1458 – Database Mirroring Principal Copy Error

Why This Error Happens

Error 1458 occurs when the principal server in a SQL Server database mirroring or Always On session cannot communicate properly with the mirror/secondary copy of the database, often due to a broken network connection, endpoint misconfiguration, or certificate/authentication failure between the partners. This can also be triggered by insufficient disk space, a corrupted transaction log, or the mirroring endpoint being stopped or blocked by a firewall rule on Windows Server 2025. In many cases, the underlying issue is a transient network interruption that causes the mirroring session to enter a suspended or error state, which SQL Server then surfaces as Error 1458 on the principal.

Step-by-Step Resolution Guide

Step 1: Verify Mirroring Endpoint Status and Connectivity

  • Run SELECT * FROM sys.database_mirroring_endpoints; on both the principal and mirror instances to confirm the endpoint state is STARTED.
  • Test network connectivity between servers using Test-NetConnection -ComputerName <MirrorServerName> -Port 5022 in PowerShell.
  • Check Windows Firewall rules on both Windows Server 2025 instances to ensure the mirroring port (default 5022) is allowed for inbound/outbound traffic.

Step 2: Inspect SQL Server Error Logs and Mirroring State

  • Open SQL Server Management Studio (SSMS) and navigate to Management > SQL Server Logs to locate the exact timestamp of Error 1458.
  • Run SELECT mirroring_state_desc, mirroring_role_desc FROM sys.database_mirroring WHERE database_id = DB_ID('YourDatabaseName'); to check if the database is SUSPENDED, DISCONNECTED, or SYNCHRONIZING.
  • If suspended, resume mirroring manually with ALTER DATABASE YourDatabaseName SET PARTNER RESUME;.

Step 3: Validate Certificates and Authentication (If Using Certificate-Based Mirroring)

  • Confirm certificates have not expired by running SELECT name, expiry_date FROM sys.certificates; on both servers.
  • Re-issue or renew the mirroring certificates if expired, then re-establish the endpoint authentication using ALTER ENDPOINT with the updated certificate.
  • Restart the SQL Server service via services.msc or Restart-Service MSSQLSERVER after certificate updates.

Step 4: Check Disk Space and Transaction Log Health

  • Verify available disk space on the drive hosting the .ldf transaction log file using File Explorer or Get-PSDrive in PowerShell.
  • Run DBCC SQLPERF(LOGSPACE); to check if the transaction log is nearing capacity, which can halt log shipping to the mirror.
  • If the log is full, back up the transaction log with BACKUP LOG YourDatabaseName TO DISK = 'D:\Backups\YourDatabaseName_log.trn'; to free up space.

Step 5: Re-Establish the Mirroring Session

  • If the above steps don’t resolve it, break the mirroring session with ALTER DATABASE YourDatabaseName SET PARTNER OFF; on the principal.
  • Re-establish mirroring by restoring a fresh full backup and transaction log backup (with NORECOVERY) on the mirror server, then reconfigure the partnership using ALTER DATABASE YourDatabaseName SET PARTNER = 'TCP://MirrorServer:5022';.

Alternative or Verification Steps

  • To confirm the fix worked, re-run SELECT mirroring_state_desc FROM sys.database_mirroring WHERE database_id = DB_ID('YourDatabaseName'); and verify it returns SYNCHRONIZED.
  • If mirroring continues to fail, consider migrating to an Always On Availability Group, which offers more robust failover diagnostics and health monitoring via the AlwaysOn_health Extended Events session.