Troubleshooting Guide: SQL Server Error 9618
Why This Error Happens
This error occurs when a Service Broker message attempts to route to a target service queue that has been explicitly disabled via ALTER QUEUE ... STATUS = OFF, while retention is simultaneously enabled on that same queue. SQL Server blocks delivery because a disabled queue cannot accept new messages, but since retention is ON, the engine refuses to silently drop or reroute the message, instead throwing error 9618 to preserve conversation integrity. This typically happens after a maintenance script, deployment rollback, or administrator action disables a queue without accounting for in-flight dialog traffic still targeting it.
Step-by-Step Resolution Guide
Step 1: Identify the Affected Queue and Database
- Open SQL Server Management Studio (SSMS) and connect to the instance reporting Error 9618.
- Run the following query to locate disabled queues with retention enabled:
SELECT name, is_receive_enabled, is_enqueue_enabled, is_retention_enabled
FROM sys.service_queues
WHERE is_receive_enabled = 0 OR is_enqueue_enabled = 0;
- Note the exact queue name and schema referenced in the error message (
%.*lsplaceholder).
Step 2: Re-enable the Service Queue
- Execute an
ALTER QUEUEstatement to restore the queue’s active status:
ALTER QUEUE [SchemaName].[QueueName]
WITH STATUS = ON;
- If the queue was disabled intentionally during a deployment window, confirm with the application team before re-enabling.
- Ensure both
ENQUEUEandRETENTIONsettings align with intended business logic:
ALTER QUEUE [SchemaName].[QueueName]
WITH STATUS = ON, RETENTION = ON;
Step 3: Drain or Process Pending Messages
- Check the queue depth to see how many messages are backlogged:
SELECT COUNT(*) FROM [SchemaName].[QueueName];
- If messages have accumulated due to the outage, manually process them using
RECEIVEstatements or trigger the associated activation stored procedure. - Restart the SQL Server Service Broker task via
ALTER DATABASE [YourDB] SET ENABLE_BROKER;if activation appears stalled (verify this doesn’t disrupt active transactions first).
Step 4: Audit Automated Scripts and Maintenance Jobs
- Review SQL Agent Jobs or deployment pipelines (e.g., Azure DevOps YAML, DACPAC deployments) for scripts that disable queues during schema updates.
- Check
msdb.dbo.sysjobhistoryand Windows Event Viewer (Applications and Services Logs > MSSQLSERVER) for correlating timestamps when the queue was disabled. - Add safeguards (e.g.,
IF EXISTSchecks) to prevent queues from being left disabled after maintenance windows.
Alternative or Verification Steps
- Verify the fix by re-sending a test message through the dialog and confirming it lands in the target queue without triggering Error 9618 in the SQL Server Error Log.
- If the queue continues to reject messages, check for orphaned conversation endpoints using
sys.conversation_endpointsand consider ending stale dialogs withEND CONVERSATIONbefore retrying.