The SQL Server Service Broker for the current database is not enabled

After doing some search i saw a post that said you just have to run the below from query analyzer:

ALTER DATABASE DatabaseName SET ENABLE_BROKER;

But the query kept running for minutes and never stopped.So i taught there must be some conflicts.
So i started looking for a way to force the close off conflicting sessions.

So i ran
ALTER DATABASE DatabaseName SET NEW_BROKER WITH ROLLBACK IMMEDIATE;
and then
ALTER DATABASE Databasename SET ENABLE_BROKER;

and then the query ran successfully

make sure you run:

SELECT is_broker_enabled FROM sys.databases WHERE name = 'DatabaseName'

to get the correct value : is_broker_enabled = 1

原文地址:https://www.cnblogs.com/citygs/p/2766723.html