Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

Multi-Script, Multi-DB Deployments Expand / Collapse
Author
Message
Posted Monday, August 23, 2010 9:06 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, April 14, 2014 2:28 PM
Points: 962, Visits: 940
clementhuge (8/23/2010)
Thanks for your feedback on my two remarks.
I think we are on the same page as you enable then disable xp_cmdshell.

When I meant within the line, I was referring to the fact that you can have Dos instead of T-Sql as a job step.

Clement


Thanks! I'll take a look at that. I haven't tested with that, but it would certainly eliminate the xp_cmdshell call as you recommended.
Post #973519
Posted Monday, August 23, 2010 2:20 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, April 01, 2014 3:44 PM
Points: 1,266, Visits: 2,912

I have something similar to do but my scenario is little different, any suggestion would be highly appreciated. Lets say i need to deploy a stored proc, it has to be done across multiple servers with in different db( names are also different). For ex i need to deploy usp_test it has to be done on server 1(db1,db2,db3....) ,server 2(db4,db5,db6....)........ I know third party tools can do this but looking for an in-built way. Btw we do have a control server which has linked servers to all our prod servers. Thanks
Post #973732
Posted Monday, August 23, 2010 2:39 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, April 14, 2014 2:28 PM
Points: 962, Visits: 940
Thanks for taking a look at the article!

iqtedar (8/23/2010)

I have something similar to do but my scenario is little different, any suggestion would be highly appreciated. Lets say i need to deploy a stored proc, it has to be done across multiple servers with in different db( names are also different). For ex i need to deploy usp_test it has to be done on server 1(db1,db2,db3....) ,server 2(db4,db5,db6....)........ I know third party tools can do this but looking for an in-built way. Btw we do have a control server which has linked servers to all our prod servers. Thanks


If you look at the example SQL Server Agent Job in the attachment, you'd be able to accomplish that by making multiple calls to sqlcmd and by changing the -S parameter in each subsequent call.

for example:
--run against instance 1
EXEC xp_cmdshell 'SQLCMD -S"Instance1" -E -dmaster -i"\\path\01a_update_Instance1.sql" -o"\\path\script_output_Instance1.txt"'

--run against instance 2
EXEC xp_cmdshell 'SQLCMD -S"Instance2" -E -dmaster -i"\\path\02a_update_Instance2.sql" -o"\\path\script_output_Instance2.txt"'
GO


Your 01a_update_Instance1.sql would reference the update scripts containing "USE [DB1]" atop of them on Instance1 and 02a_update_Instance2.sql would then reference the update scripts containing "USE [DB2]" atop of them, each set of scripts being geared toward the specific instance you are running it against.


To use the same exact script, you could likely change the -d parameter from master to your DB's on each instance and remove the USE statements at the top of each script.

for example:
--run against instance 1
EXEC xp_cmdshell 'SQLCMD -S"Instance1" -E -d"DB1" -i"\\path\update_stored_proc.sql" -o"\\path\script_output_Instance1.txt"'

--run against instance 2
EXEC xp_cmdshell 'SQLCMD -S"Instance2" -E -d"DB2" -i"\\path\update_stored_proc.sql" -o"\\path\script_output_Instance2.txt"'
GO



Hope that helps!
Post #973737
Posted Monday, August 23, 2010 3:03 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, April 01, 2014 3:44 PM
Points: 1,266, Visits: 2,912
Thanks S.K for the follow up, i haven't looked at the scripts yet but i want the Use[dbname] to be dynamic something like it should get the dbname by itself and use in "Use[dbname]".thanks
Post #973745
Posted Monday, August 23, 2010 3:09 PM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, April 01, 2014 3:44 PM
Points: 1,266, Visits: 2,912
I am trying to test this tool, what is Product Code Name? I would like to run DDL's and DML's across different servers on different dbs. Please advice. Thanks
Post #973748
Posted Tuesday, August 24, 2010 8:53 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 8:49 PM
Points: 20,462, Visits: 14,092
Here are some important points for me (some already mentioned):

1. Source control.
2. Ensuring that QA or beta is exactly like production (some automated process would be good here).
3. Manual entry of the scripts into the cmd scriptlet. Too much chance for a typo.

That said, I have used the same(similar) methodology in a few places for script deployment.




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #974194
Posted Tuesday, August 24, 2010 9:02 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Monday, April 14, 2014 2:28 PM
Points: 962, Visits: 940
CirquedeSQLeil (8/24/2010)
Here are some important points for me (some already mentioned):

1. Source control.
2. Ensuring that QA or beta is exactly like production (some automated process would be good here).
3. Manual entry of the scripts into the cmd scriptlet. Too much chance for a typo.

That said, I have used the same(similar) methodology in a few places for script deployment.


Thanks for the feedback, Jason. Points one and two have been a theme here and I'll keep that in mind for future articles that are submitted. For point number 3, how would you approach that?

All in all, as a first time submitter- would you have any pointers to improve on?
Post #974204
Posted Tuesday, August 24, 2010 9:21 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, March 16, 2013 7:40 PM
Points: 7, Visits: 73
Good article with some value added deatils and examples.
Post #974218
Posted Tuesday, August 24, 2010 9:58 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 8:49 PM
Points: 20,462, Visits: 14,092
S.K. (8/24/2010)
CirquedeSQLeil (8/24/2010)
Here are some important points for me (some already mentioned):

1. Source control.
2. Ensuring that QA or beta is exactly like production (some automated process would be good here).
3. Manual entry of the scripts into the cmd scriptlet. Too much chance for a typo.

That said, I have used the same(similar) methodology in a few places for script deployment.


Thanks for the feedback, Jason. Points one and two have been a theme here and I'll keep that in mind for future articles that are submitted. For point number 3, how would you approach that?

All in all, as a first time submitter- would you have any pointers to improve on?


I should have also noted that I thought the article was good.

One thing we use to get past that currently is to use CM to deploy scripts from specific locations in TFS. That seems to work pretty well. I am still looking for a real good method to bypass the need for typing of each of the scripts.




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #974247
Posted Tuesday, August 24, 2010 8:39 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, April 08, 2014 9:42 PM
Points: 1,786, Visits: 1,100
Steve,
We used to have almost same methodology but xp_cmdshell was not used since it was not recommend to use at my company. It is definitely a helpful article but roll back script should be kept in mind along with this script.

Thanks for sharing.

Abi
Post #974583
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse