Why This Error Happens
Error 9676 is generated by the SQL Server Service Broker engine during the internal validation of Conversation Priority objects and their associated Service Contracts. This message typically surfaces when the Broker’s priority resolution algorithm encounters a mismatch between the number of contracts registered in sys.service_contracts and the number it can successfully bind to active services. In most cases, this stems from an interrupted Service Broker configuration script, a corrupted system catalog view cache, or insufficient permissions on the msdb database that prevent the Broker from fully enumerating contract metadata during startup.
Step-by-Step Resolution Guide
Step 1: Verify Service Broker Status and GUID Integrity
- Open SQL Server Management Studio (SSMS) and connect to the affected instance.
- Run the following query to confirm Broker is enabled and check the GUID:
SELECT name, service_broker_guid, is_broker_enabled FROM sys.databases WHERE name = 'YourDatabaseName'; - If
is_broker_enabledreturns0, enable it using:
ALTER DATABASE YourDatabaseName SET ENABLE_BROKER;
Step 2: Rebuild the Service Contract Cache
- Navigate to the installation directory, typically
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Binn\. - Stop the SQL Server service via Services.msc or PowerShell:
Stop-Service MSSQLSERVER. - Clear the plan cache for Service Broker by restarting the service, then execute:
DBCC FREESYSTEMCACHE ('ALL'); - Re-run the contract analysis manually using:
EXEC sys.sp_control_dbmasterkey_password;(if master key dependencies are suspected) or re-create the specific contract viaCREATE CONTRACT.
Step 3: Check Permissions on System Objects
- Ensure the service account running SQL Server (visible in
services.mscunder “Log On As”) hasdb_owneror equivalent rights onmsdb. - Grant explicit permissions if needed:
GRANT CONTROL ON CONTRACT::[YourContractName] TO [YourServiceAccount]; - Restart the SQL Server service to apply the permission changes.
Step 4: Validate with Windows Event Viewer
- Open Event Viewer on Windows Server 2025 and navigate to Applications and Services Logs > Microsoft > Windows > SQL Server.
- Filter for Event ID 9676 to confirm the timestamp aligns with your repair actions and check for correlating Broker errors (such as 9675 or 9677).
Alternative or Verification Steps
- Run
SELECT * FROM sys.service_contracts;and compare the row count against the%dvalue reported in the original error log entry to confirm the discrepancy is resolved. - If the error persists after cache rebuilding, drop and recreate the specific Service Broker Queue, Service, and Contract in a maintenance window, as this forces a full re-registration in the system catalog.