Enable or Fix Service Broker on msdb
A short script that enables or repairs Service Broker on the msdb database.
Service Broker on msdb can get stuck after a restore or upgrade. This short script enables it - and notes the fix for when ENABLE_BROKER fails because an old broker identity already exists: stop the SQL Agent (the script needs exclusive access to msdb), run SET NEW_BROKER to reset the broker, then run SET ENABLE_BROKER.
--You will need to stop the SQL agent before running this script - it requires exclusive access to msdb.
--ALTER DATABASE [msdb] SET NEW_BROKER --Only run if enable fails
--GO
ALTER DATABASE [msdb] SET ENABLE_BROKER
GO