How can I enable and disable Service Broker for Amazon RDS SQL Server?

Last updated: 2020-07-03

How can I enable and disable Service Broker for Amazon Relational Database Service (Amazon RDS) SQL Server?

Short description

Service Broker is supported for Amazon RDS, but Service Broker endpoints aren't supported on Amazon RDS. For more information about Service Broker, see the Microsoft documentation for Service Broker.

Resolution

When you enable Service Broker, Amazon RDS requests a database lock. Before enabling Service Broker, close all open connections to the database.

1.    Check to see whether Service Broker is enabled:

select name,is_broker_enabled from sys.databases
		where name= [YourDB]

2.    If Service Broker isn't enabled, generate a new Service Broker:

ALTER DATABASE [YourDB] SET NEW_BROKER;
GO
3.    Enable Service Broker on an existing database:
ALTER DATABASE [YourDB] SET ENABLE_BROKER;
GO
If you run a Multi-AZ deployment, run this command:
ALTER DATABASE [YourDB] SET PARTNER OFF;
GO
Then, re-enable Service Broker in a Multi-AZ deployment:
ALTER DATABASE [YourDB] SET ENABLE_BROKER WITH ROLLBACK IMMEDIATE
To disable Service Broker on an existing database, run this command:
ALTER DATABASE [YourDB] SET DISABLE_BROKER;
GO

Did this article help you?

Anything we could improve?


Need more help?