Wednesday, May 02, 2007
Quick Tip: What to do if this statement hangs: ALTER DATABASE msdb SET ENABLE_BROKER
Ran across this 2x in the past week as I was working with new installations of SQL Server 2005 and I thought I'd post about it in case it helps someone else.
If you want to use Database Mail, Service Broker has to be enabled in the msdb database. The script to enable Service Broker is ALTER DATABASE msdb SET ENABLE_BROKER but, unless you have exclusive access to msdb, it will wait until you do before it runs. Here's how to see this in action:
If you want to use Database Mail, Service Broker has to be enabled in the msdb database. The script to enable Service Broker is ALTER DATABASE msdb SET ENABLE_BROKER but, unless you have exclusive access to msdb, it will wait until you do before it runs. Here's how to see this in action:
- Start the SQL Server Agent
- In a query window, run ALTER DATABASE msdb SET ENABLE_BROKER
- Notice that you are waiting, waiting, waiting...
- Stop SQL Server Agent
- Now notice that your ALTER DATABASE statement has finished
Comments:
Links to this post:
<< Home
As an alternate to shutting down SQL Server Agent, one can push everyone off MSDB, enable broker on MSDB, and re-enable access to MSDB.
alter DATABASE MSDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER database msdb set ENABLE_BROKER
go
alter DATABASE MSDB SET MULTI_USER WITH ROLLBACK IMMEDIATE
GO
=================================
Thanks for the tips, would have been stuck for weeks without your tip.
Daniel Adeniji
MS SQL Server DBA
Post a Comment
alter DATABASE MSDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER database msdb set ENABLE_BROKER
go
alter DATABASE MSDB SET MULTI_USER WITH ROLLBACK IMMEDIATE
GO
=================================
Thanks for the tips, would have been stuck for weeks without your tip.
Daniel Adeniji
MS SQL Server DBA
Links to this post:
<< Home
