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

Troubleshooting Guide: SQL Server Error 1431 (Partner/Witness Instance Unavailable)

Why This Error Happens

Error 1431 occurs when the database mirroring session cannot establish a TCP connection to either the partner (mirror) or witness server instance, typically due to the endpoint being offline, stopped, or unreachable over the network. This is commonly caused by a SQL Server service outage on the partner/witness, a Windows Firewall rule blocking the mirroring endpoint port, or an invalid/expired certificate used for endpoint authentication. In some cases, DNS resolution failures or incorrect endpoint URLs (TCP://hostname:port) configured in the ALTER DATABASE SET PARTNER statement also trigger this failure.

Step-by-Step Resolution Guide

Step 1: Verify Service and Endpoint Status on All Instances

  • Confirm the SQL Server service is running on both the principal, mirror, and witness instances via services.msc or Get-Service MSSQLSERVER.
  • Run SELECT * FROM sys.database_mirroring_endpoints; on each instance to confirm the endpoint state_desc is STARTED.
  • If stopped, restart it manually: ALTER ENDPOINT [Mirroring] STATE = STARTED;

Step 2: Check Network Connectivity and Firewall Rules

  • From the principal server, test connectivity to the partner/witness port (default 5022) using Test-NetConnection -ComputerName <PartnerHost> -Port 5022.
  • On Windows Server 2025 / Windows 11, open Windows Defender Firewall with Advanced Security and ensure an inbound rule exists allowing TCP traffic on the mirroring endpoint port for sqlservr.exe.
  • If using a cloud or segmented network, verify NSG/VLAN rules aren’t silently dropping the port.

Step 3: Validate Endpoint Certificates and Authentication

  • Run SELECT name, certificate_id FROM sys.database_mirroring_endpoints; to confirm each instance has a valid certificate bound (if using certificate-based authentication instead of Windows Authentication/Kerberos).
  • Check certificate expiration with SELECT name, expiry_date FROM sys.certificates; — expired certs are a leading cause of silent mirroring failures.
  • If expired, create and re-exchange new certificates between principal, mirror, and witness, then re-run the CREATE ENDPOINT / ALTER ENDPOINT statements with the updated certificate.

Step 4: Re-Verify the Partner and Witness URLs

  • Re-check the exact syntax used: ALTER DATABASE [YourDB] SET WITNESS = 'TCP://WitnessServer.domain.com:5022';
  • Ensure hostnames resolve correctly via nslookup or Resolve-DnsName, especially in mixed Windows Server 2025 / Windows 11 domain environments where DNS suffix search order may differ.
  • Correct any typos, stale IPs, or outdated FQDNs in the mirroring configuration.

Step 5: Restart the Mirroring Session

  • Once connectivity, certificates, and endpoints are confirmed healthy, reissue the failed command (e.g., ALTER DATABASE SET PARTNER or SET WITNESS).
  • Monitor the SQL Server error log and Windows Event Viewer (Application log) for confirmation that the mirroring session re-established.

Alternative or Verification Steps

  • Run SELECT mirroring_state_desc, mirroring_role_desc FROM sys.database_mirroring WHERE database_id = DB_ID('YourDB'); on the principal — a healthy session should show SYNCHRONIZED.
  • If the issue persists after all steps, temporarily remove the witness server from the configuration (ALTER DATABASE SET WITNESS OFF) to confirm whether the witness specifically is the failure point, then re-add it once its connectivity/certificate issues are resolved.