Troubleshooting Guide: Error 9666 – Endpoint Disabled or Stopped State
Why This Error Happens
Error 9666 occurs when a SQL Server endpoint (such as the Database Mirroring, Service Broker, or TSQL endpoint referenced by %S_MSG) has its state explicitly set to DISABLED or STOPPED, preventing it from listening for incoming connections. This typically happens after a server restart where the endpoint state was not persisted correctly, a manual configuration change by an administrator, or a failed upgrade/migration process that left the endpoint in an inconsistent state. In some cases, security policy changes or certificate expiration tied to the endpoint can also trigger an automatic shutdown of the listener.
Step-by-Step Resolution Guide
Step 1: Identify the Affected Endpoint and Its Current State
- Open SQL Server Management Studio (SSMS) and connect to the instance using an account with
sysadminprivileges. - Run the following query to list all endpoints and their states:
SELECT name, protocol_desc, type_desc, state_desc
FROM sys.endpoints;
- Note the specific
nameof the endpoint showingDISABLEDorSTOPPEDin thestate_desccolumn.
Step 2: Restart the Endpoint Using T-SQL
- Execute an
ALTER ENDPOINTcommand to force the endpoint back to aSTARTEDstate. - Use the exact name retrieved in Step 1 (e.g.,
Mirroring_EndpointorTSQL_Default_TCP):
ALTER ENDPOINT [Mirroring_Endpoint] STATE = STARTED;
- If the command fails due to a port conflict, check for other processes binding to the same port using
netstat -ano | findstr <PORT>in PowerShell.
Step 3: Verify Certificate and Permission Validity
- Navigate to
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\DATA\(path may vary based on your 2025 instance ID) to check for encryption certificate files if the endpoint uses SSL/TLS. - Ensure the SQL Server Service Account has “Read” permissions on the certificate’s private key via the Windows Certificate Manager (
certlm.msc). - If the certificate has expired, you must drop the endpoint and recreate it with a renewed certificate, as expired certificates will cause the
STATE = STARTEDcommand to fail silently.
Step 4: Check Windows Firewall and Server Configuration
- On Windows Server 2025, open
Windows Defender Firewall with Advanced Security. - Verify that there is an active Inbound Rule allowing traffic on the specific TCP port used by the endpoint (commonly 5022 for mirroring).
- Restart the SQL Server service via
services.mscto ensure the configuration change takes effect cleanly:net stop MSSQLSERVER && net start MSSQLSERVER.
Alternative or Verification Steps
- Verify the Fix: Re-run the
SELECT name, state_desc FROM sys.endpoints;query. Thestate_desccolumn should now displaySTARTEDfor the specific endpoint. - Alternative Solution: If the endpoint remains stuck in a
STOPPEDstate after a restart, drop the endpoint entirely usingDROP ENDPOINT [EndpointName]and recreate it from scratch using theCREATE ENDPOINTsyntax specific to its type (Database Mirroring, Service Broker, or SOAP).