Troubleshooting Guide: Error 9642 – Service Broker/Database Mirroring Transport Connection Endpoint Error
Why This Error Happens
Error 9642 typically occurs when the TCP transport layer used by Service Broker or Database Mirroring encounters a disruption while establishing or maintaining a connection endpoint. This is commonly caused by a blocked or conflicting port in the Windows Firewall, an expired or mismatched SSL/TLS certificate used for endpoint authentication, or network instability between the mirroring/broker partners. In some cases, the issue stems from incorrect endpoint configuration (wrong state, protocol, or authentication mode) on one of the SQL Server instances.
Step-by-Step Resolution Guide
Step 1: Verify Endpoint Configuration and State
- Run
SELECT * FROM sys.database_mirroring_endpoints;orSELECT * FROM sys.service_broker_endpoints;on both instances to confirm the endpoint exists and is in aSTARTEDstate. - If the state shows
STOPPEDorDISABLED, runALTER ENDPOINT [EndpointName] STATE = STARTED;. - Confirm the correct port (default 5022) is assigned using
SELECT port FROM sys.tcp_endpoints;.
Step 2: Check Windows Firewall and Network Connectivity
- Open Windows Defender Firewall with Advanced Security on Windows Server 2025 / Windows 11.
- Create or verify an Inbound Rule allowing TCP traffic on port 5022 (or your custom mirroring/broker port).
- Test connectivity between partner servers using
Test-NetConnection -ComputerName <PartnerServer> -Port 5022in PowerShell. - Ensure no intermediate network firewalls or NSGs (if on Azure VMs) are blocking the connection.
Step 3: Validate SSL/TLS Certificates Used for Authentication
- Check certificate expiration dates using
SELECT name, expiry_date FROM sys.certificates;. - If a certificate has expired or is mismatched between partners, regenerate and re-exchange certificates using
CREATE CERTIFICATEandBACKUP CERTIFICATE. - Re-import the updated certificate on the partner server and recreate the endpoint authentication using:
ALTER ENDPOINT [EndpointName] FOR DATABASE_MIRRORING (AUTHENTICATION = CERTIFICATE [CertName]);
Step 4: Review SQL Server Error Logs and Extended Events
- Open SQL Server Management Studio (SSMS) and navigate to Management > SQL Server Logs.
- Look for related entries near Error 9642, such as network timeout messages or certificate validation failures.
- Enable an Extended Events session targeting the
broker_loginormirroring_state_changeevents for deeper diagnostics.
Step 5: Restart the Endpoint and SQL Server Service
- Run
ALTER ENDPOINT [EndpointName] STATE = STOPPED;followed byALTER ENDPOINT [EndpointName] STATE = STARTED;to reset the connection. - If the issue persists, restart the SQL Server (MSSQLSERVER) service via Services.msc or
Restart-Service MSSQLSERVERin PowerShell.
Alternative or Verification Steps
- Verify the fix by checking
sys.dm_broker_connectionsandsys.database_mirroringDMVs to confirm active, healthy connections without error states. - If the issue persists after certificate and firewall checks, consider recreating the Mirroring/Broker endpoints entirely using
DROP ENDPOINTfollowed by a freshCREATE ENDPOINTstatement with validated authentication settings.