Enabling broker after Restoring Sql Server DataBase Enabling broker after Restoring Sql Server DataBase sql-server sql-server

Enabling broker after Restoring Sql Server DataBase


keep a note of these options

ALTER DATABASE mydb SET ENABLE_BROKERALTER DATABASE mydb SET DISABLE_BROKERALTER DATABASE mydb SET NEW_BROKER

if youre getting something like this is already an enabled Service Broker with the same ID, go for the NEW_BROKER


ALTER DATABASE [Database_name] SET NEW_BROKER WITH ROLLBACK IMMEDIATE; 

This will create the new service broker


Every database has a unique ID used by Service Broker. This ID must be unique across all databases in a Sql Server instance (well, it should be unique globally, but Sql Server doesn't have a way to enforce that). When you restore a database, you have an option of disabling Service Broker in the restored database, enabling it with the GUID of the backed up database (so that it can take over message processing from the backed up database) or assign it a new GUID. You're trying to do the second option while you still have the old database around and you run into GUID conflict.

See here for more info.