April 8, 2010 at 10:54 am
We support a bunch of different servers w/ seval sql server instances and version. We have a monitoring sql instance that basically keeps stats on all the boxes supported. It does this through open query because it allows u to loop through all the boxes as long as there set up w/ aliases and query all sorts of info on them.
My problem is open query is limited in what you can do. There is a limitation on the length of the sql script as well as u can't declare var's. u basically can only pass in a select. i want the ability to run any chunck of sql on an external box. Does sql server have anything that allows this or am i stuck w/ openquery.
April 8, 2010 at 12:03 pm
April 8, 2010 at 1:38 pm
yes. the problem is there are multiple different monitors which are just dynamic sql to check things like drive space, replication latency, data inconsistencies, ddl changes....etc. These sql strings are run accross n number of servers dynamically by looping through a table that says which monitors should run on which box/instances using open query. So if i use link server i would lose the dynamic nature. Actually there are some instanceswere i've had to use link server but i'd like to have all of htese processes using the same thing instead of some using link server and some using open query.
Essentially all i'm looking for is to be able to run a chunk of sql code on a differenct box/instance w/o using open query because open query is limited as far as what can run in the chunk.
Did i explain that well? hope so cause i think i confused myself.
April 8, 2010 at 3:31 pm
Do you have a small segment of one of the scripts that you have to run through openquery (Or one of the whole scripts if they're relatively short)?
Something that's generic enough to post here that you don't think would work via linked servers?
April 8, 2010 at 3:35 pm
I would re-write the process using SSIS, looping through a list of servers is easy. You could even likely re-use most of the queries..
CEWII
April 8, 2010 at 8:54 pm
BaldingLoopMan (4/8/2010)
So if i use link server i would lose the dynamic nature. Actually there are some instanceswere i've had to use link server but i'd like to have all of htese processes using the same thing instead of some using link server and some using open query.Essentially all i'm looking for is to be able to run a chunk of sql code on a differenct box/instance w/o using open query because open query is limited as far as what can run in the chunk.
Did i explain that well? hope so cause i think i confused myself.
I don't see why the use of linked servers would cause any problems so long as the linked servers were named the same as the servers themselves and you use 4 part naming conventions.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 8, 2010 at 10:02 pm
I did something similar using Powershell and SMO - you only need to install Powershell on your CMS server and use that instance to query all of the servers.
Or, you can use Powershell and SQLCMD to execute the scripts on each server.
Jeffrey Williams
“We are all faced with a series of great opportunities brilliantly disguised as impossible situations.”
― Charles R. Swindoll
How to post questions to get better answers faster
Managing Transaction Logs
April 9, 2010 at 1:32 am
Have you tried to combine Synonyms and views, maybe with these technique make the query more efficient.
Regards,
Eko Indriyawan
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply