|
|
|
SSCoach
         
Group: General Forum Members
Last Login: 2 days ago @ 1:46 PM
Points: 18,732,
Visits: 12,329
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, May 01, 2013 4:52 PM
Points: 1,379,
Visits: 2,626
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, January 31, 2013 8:01 AM
Points: 1,232,
Visits: 1,046
|
|
Mayank (10/26/2010)
Normally to enable the Broker Service, you need to simply use : "ENABLE_BROKER" But when you restore the back up of database db1 to database db2, and after that if you want to enable broker service on database db2, then what to do? - That was my question.
The wording of the question and the code was misleading and confusing.
The code created one backup file db1.bak, and then restored from a differant file called main.bak. This means that it did not restore the backup created for db1 in the first script to to db2 in the second script. Your code restored a backup called main.bak. You quoted comment above does not apply since it assumes we all corrected a mistake in your questions code that was not apparent until after you had made responses here.
Did the database in the main.bak backup file have the Broker Service enabled when it was created? Did you question make that fact clear?
It was completely unclear if any database had Broker Service enabled, disabled, or if it had ever been set-up when the backup file was created.
This could have been a really decent high level question had anyone taken time moment to read it and execute the code with it prior to posting.
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: Monday, May 13, 2013 2:42 PM
Points: 877,
Visits: 1,158
|
|
SanDroid (10/27/2010)
Mayank (10/26/2010)
Normally to enable the Broker Service, you need to simply use : "ENABLE_BROKER" But when you restore the back up of database db1 to database db2, and after that if you want to enable broker service on database db2, then what to do? - That was my question.
The wording of the question and the code was misleading and confusing. The code created one backup file db1.bak, and then restored from a different file called main.bak. This means that it did not restore the backup created for db1 in the first script to to db2 in the second script. Your code restored a backup called main.bak. You quoted comment above does not apply since it assumes we all corrected a mistake in your questions code that was not apparent until after you had made responses here. Did the database in the main.bak backup file have the Broker Service enabled when it was created? Did you question make that fact clear? It was completely unclear if any database had Broker Service enabled, disabled, or if it had ever been set-up when the backup file was created. This could have been a really decent high level question had anyone taken time moment to read it and execute the code with it prior to posting.
that's really good observation - I think most of us didn't check the backup file which author has used for restoration.
Thanks
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Yesterday @ 6:54 AM
Points: 9,364,
Visits: 6,462
|
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, January 31, 2013 8:01 AM
Points: 1,232,
Visits: 1,046
|
|
da-zero (10/28/2010)
[quote] Well I did  I just ignored because it was an obvious typo (and the answers didn't have any error messages)
As did I, but it explains why some people that don't have "Question ESP", but do know SQL, would have made the wrong answer.
Had the answer been SET ENABLE instead of SET NEW, it also would have been correct given the code in the example.
Just another instance for the QOTD needs a frakin' Moderator pile.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 8:49 AM
Points: 60,
Visits: 222
|
|
Mayank P - Clarion, India (10/26/2010) Yes Phil,
... you restore the back up of database db1 to database db2, and after that if you want to enable broker service on database db2...
there is nothing in this question that indicates if db1 was previously enabled for service broker, which makes the question invalid. I'm with Phil on that one.
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Wednesday, July 25, 2012 9:04 PM
Points: 542,
Visits: 187
|
|
| Good Question Didn't know anything about NEW Broker until now.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 11:59 AM
Points: 7,076,
Visits: 7,115
|
|
Hugo Kornelis (10/26/2010)
Thanks for the question. I missed a point, but learned something new. The reason I missed a point is because, when doing some research, I found this text: "If you attach a database with the same service broker identifier as an existing database, SQL Server deactivates Service Broker message delivery in the database being attached." (This is from http://msdn.microsoft.com/en-us/library/ms166057%28SQL.90%29.aspx). The quote specifically mentions attaching, but since the entire page is about attach and restore, I assumed that the restore behaviour would be identical. Obviously not. But surely it is identical? The broker is deactivated, in both cases, because there is an identifier clash. It can't be reactivated using ENABLE, whether the deactivation happened as part of attach or as part of restore, because of that identity clash, so a new identity has to be substituted using NEW.
Tom Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Yesterday @ 1:06 PM
Points: 469,
Visits: 192
|
|
Great pick on the question. I did have not dealt much with the Service Broker but have now learnt about it.
Thank you.
|
|
|
|