Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling broker after Restoring Sql Server DataBase

I have DataBase with enabled Service Broker. Then I want to restore my database in program from backup of other database, but after restoring(I restore on existing database name), my method, whitch enables Service Broker, puts this error:

    Msg 9772, Level 16, State 1, Line 1 The Service Broker in database "ServeDB2" cannot be enabled because there is already an enabled Service Broker with the same ID. Msg 5069, Level 16, State 1, Line 1 ALTER DATABASE statement failed. 

This is my method:

public void TurnOnBroker() {     if (!this.database.BrokerEnabled)     {         this.server.KillAllProcesses(this.database.Name);         this.database.BrokerEnabled = true;         this.database.Alter();         RefreshConnection();     } } 

What should i fix here?Any suggestions?

like image 879
vts123 Avatar asked Aug 16 '10 06:08

vts123


People also ask

How do I restart a SQL Service Broker?

Restart System Center Data Access Service In SQL Server Management Studio, go to Databases > OperationsManager > Service Broker. Expand Queues and Services. Verify that there's a queue and service whose name contains the following values: The IP address of the management server that created the queue and service.

How do I start a new broker?

Create a broker by using the command line on the computer on which you have installed the Integration Bus component. On Windows and Linux on x86, you can alternatively use the IBM Integration Toolkit or IBM Integration Explorer to complete this task. You must give the broker a name that is unique on the local computer.


1 Answers

keep a note of these options

ALTER DATABASE mydb SET ENABLE_BROKER  ALTER DATABASE mydb SET DISABLE_BROKER  ALTER 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

like image 85
DAEMYO Avatar answered Nov 11 '22 19:11

DAEMYO