Pages

Sunday, August 12, 2012

Enable and disable service broker in SQL Server

How to Enable and disable service broker in SQL Server



Microsoft SQL Server 2005 Service Broker helps developers build scalable, secure database applications. This new technology, a part of the Database Engine, provides a message-based communication platform that enables independent application components to perform as a functioning whole. Service Broker includes infrastructure for asynchronous programming that can be used for applications within a single database or a single instance as well as for distributed applications.

Service Broker reduces application development time by providing much of the infrastructure that is necessary to build a distributed application. Service Broker also makes it easy to scale your application up or down to accommodate the amount of traffic the application receives.



/*simple query */

Alter database databasename
set enable_broker

/*when more users are logged in..if we have privilege..use forced logged in  */

alter database databasename
set enable_broker
with rollback immediate;

/* or other method is */

alter database databasename
set single_user with rollback immediate;
go
alter database databasename
set enable_broker
go
alter database database
set multi_user
go

/*Disabling a broker */

alter database databasename
set single_user with rollback immediate;
GO
alter database databasename
set disable_broker
go
alter database database
set multi_user
go