Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Multi-Script, Multi-DB Deployments


Multi-Script, Multi-DB Deployments

Author
Message
S. Kusen
S. Kusen
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1224 Visits: 1111
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.
curious_sqldba
curious_sqldba
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1989 Visits: 3585
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
S. Kusen
S. Kusen
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1224 Visits: 1111
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!
curious_sqldba
curious_sqldba
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1989 Visits: 3585
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
curious_sqldba
curious_sqldba
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1989 Visits: 3585
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
SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)

Group: General Forum Members
Points: 23497 Visits: 18271
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, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

S. Kusen
S. Kusen
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1224 Visits: 1111
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?
Varghese Pathisseril
Varghese Pathisseril
Forum Newbie
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: General Forum Members
Points: 9 Visits: 73
Good article with some value added deatils and examples.
SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)SSC-Insane (23K reputation)

Group: General Forum Members
Points: 23497 Visits: 18271
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, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw

Abi Chapagai
Abi Chapagai
SSCommitted
SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)SSCommitted (1.8K reputation)

Group: General Forum Members
Points: 1816 Visits: 1127
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search