Dear colleagues,
We are using the broker technology to perform some asynchronous stored procedure calls. We build and sell an ERP product. We ship a StartDB for new customers to quickly setup an environment with common settings. Also, customers often make backups of their production database and load this database in a test database.
If a customer needs more than one production environment, loading the same StartDB twice will result in two databases with the same service_broker_guid. The same problem occurs when the test database is loaded from the production database backup. I now you can solve this by executing the statement below.
ALTER DATABASE <DBname> SET NEW_BROKER WITH ROLLBACK IMMEDIATE;
Is there a way I can automatically run the statement above after a restore operation? Some of our customers do not have a DBA who nows what to do. What is worse, the broker will be disabled after the restore and everything seems to work fine. If you do not know where to look, nobody even notices that the async procs are never executed.
Thank you for your help.