SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Execution of Code on Multiple Servers Remotely

By Rudy Panigas, 2006/12/28

Total article views: 554 | Views in the last 30 days: 8

Do you have more than 10 sql servers you must manage?
Most DBA s do, I have over 120 sql instances to manage. Before I used to use ISQL/OSQL in a batch to execute a command on all these instances. It works but not very nice. Below is the code I use to collect information of all my servers from T-SQL. No more batch files for me!

Basically, this code will create a table that houses your instance names and 'sa' passwords, create linked connection, execute your code, drop the link connection and finally delete the temp table. To add more instances, just  add another line to the "insert into" section of the code. My first usage of this code is to connect to all my production servers and report back the job  status on a daily basis. I only see the failed jobs and start my day from there.

You must execute this from a SQL 2005 connection as the linked server code is slightly different on SQL 2000 than SQL 2005. But that's ok as I connect to SQL 7.0, SQL 2000 and SQL 2005 servers.

Read the comments at the beginning of the code which shows you how to modify it for your enironment.

I hope that this code will make you life easier as it has done for me.

By Rudy Panigas, 2006/12/28

Total article views: 554 | Views in the last 30 days: 8
Your response
 
 
Related Articles
FORUM

Connecting to different instance of SQL Server

Connecting to different instance of SQL Server

FORUM

Can't connect to SQL Server 2005 instance

Can't connect to SQL Server 2005 instance

FORUM

named instance connection problem

named instance connection problem

FORUM

connecting to a sql server 2000 named instance

connecting to a sql server 2000 named instance

ARTICLE

DAC - What to Execute when Connected?

SQL Server Issues? Connect with Dedicated Administrator Connection (DAC), then what? Execute this st...

 
Contribute

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com