Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server
Azure SQL Managed Instance
By default, Service Broker is enabled and message delivery is active in a database when the database is created. When message delivery isn't active, messages remain in the transmission queue. To determine whether Service Broker is active for a database, check the is_broker_enabled column of the sys.databases catalog view.
Note
Activating Service Broker allows messages to be delivered to the database. You must create a Service Broker endpoint to send and receive messages from outside of the instance.
Disable Service Broker
Service Broker is enabled by default when a database is created. You can use the ALTER DATABASE statement to disable Service Broker message delivery in a database. When you disable Service Broker, messages remain in the transmission queue and aren't delivered to the database.
To disable Service Broker, run the following Transact-SQL script:
USE master;
GO
ALTER DATABASE [<database name>]
SET DISABLE_BROKER;
Note
If Service Broker is disabled on a database migrated to Azure SQL Managed Instance, enabling Service Broker on the target SQL managed instance isn't available. To use Service Broker on the target SQL managed instance, enable it on the source SQL Server database before you migrate to SQL managed instance.
Enable Service Broker in a database
If Service Broker has been disabled, you can enable it by using the ALTER DATABASE statement to set the ENABLE_BROKER option.
To enable Service Broker, run the following Transact-SQL script:
USE master;
GO
ALTER DATABASE [<database name>]
SET ENABLE_BROKER;
GO
Check service broker status
To check the status of Service Broker for a database, run the following Transact-SQL script:
SELECT name AS [Database Name], is_broker_enabled AS [Service Broker Enabled]
FROM sys.databases
WHERE name = '[<database name>]';
Service Broker in Azure SQL Managed Instance
In Azure SQL Managed Instance, Service Broker is enabled by default and can't be disabled. The following ALTER DATABASE options aren't supported:
ENABLE_BROKERDISABLE_BROKER