May 11, 2012 at 7:44 am
Hi everyone,
I have configured CMS on my 2008 R2 server.
I have a CMS node containing several SQL 2005 server names.
I want to query info from those servers and insert the results into a database that resides on the local instance.
But when I run this within the "2005" node:
Insert into DatabasesInventory.dbo.DatabaseInfo
(DatabaseName, FileName, DateCreated, CompatibilityLevel, AsOfDate)
select name,filename, crdate, cmptlevel, GETDATE() from sysdatabases;
it fails with "Invalid object name 'DatabasesInventory.dbo.DatabaseInfo'."
My question is: Is there a way to write the info to a non-CMS database?
Hope my question is clear.
Thanks, John
May 11, 2012 at 8:50 am
John Bates-251278 (5/11/2012)
Hi everyone,I have configured CMS on my 2008 R2 server.
I have a CMS node containing several SQL 2005 server names.
I want to query info from those servers and insert the results into a database that resides on the local instance.
But when I run this within the "2005" node:
Insert into DatabasesInventory.dbo.DatabaseInfo
(DatabaseName, FileName, DateCreated, CompatibilityLevel, AsOfDate)
select name,filename, crdate, cmptlevel, GETDATE() from sysdatabases;
it fails with "Invalid object name 'DatabasesInventory.dbo.DatabaseInfo'."
My question is: Is there a way to write the info to a non-CMS database?
Hope my question is clear.
Thanks, John
if i understand correctly then you need to create a linked server from your sql2008 instance to each of your 2005 instances
then you can query using 4 part naming
Insert into DatabasesInventory.dbo.DatabaseInfo
(DatabaseName, FileName, DateCreated, CompatibilityLevel, AsOfDate)
select name,filename, crdate, cmptlevel, GETDATE() from mylinkedserver.master.dbo.sysdatabases
MVDBA
May 11, 2012 at 3:32 pm
Thanks, Michael.
No, I'm trying to avoid using Linked Servers.
With CMS you can query many servers via a single query. Info for all your central management servers is returned.
But I want to insert the resultset into a db that resides on the local server (where the CMS servers are configured)
John
May 11, 2012 at 4:20 pm
I would use the data in an SSIS package using a ForEach Loop to perform the actions. I won't use Linked servers for this..
CEWII
May 14, 2012 at 3:11 am
John Bates-251278 (5/11/2012)
Thanks, Michael.No, I'm trying to avoid using Linked Servers.
With CMS you can query many servers via a single query. Info for all your central management servers is returned.
But I want to insert the resultset into a db that resides on the local server (where the CMS servers are configured)
John
ah - i understand what you mean - i was thinking of a different CMS (configuration management system)
i don't think you can do what you are asking in this way - you can't pump the results to a single location (as far as i know)
it's either linked servers or SSIS
MVDBA
May 15, 2012 at 1:48 pm
Thanks Mike and Elliot.
Hmmm, can anyone give me a clue for how to do this via an SSIS package?
I'm familiar with Foreach loops but not sure how to be able to reference both "sides" of my environment - insert into the Local db but select from my Central Mgmt server node.
Thanks, John
May 15, 2012 at 2:31 pm
Did you try the server name instead f just the 3 part naming for the INSERT INTO? Not sure that it will work, and if it doesn't then I don't think it can be done.
Jared
CE - Microsoft
May 15, 2012 at 2:36 pm
Hmm... Can't be done. http://www.brentozar.com/archive/2008/10/sql-server-2008-management-studio-group-execute/ toward the bottom. It is because the SSMS "feature" sends this query to each server individually. Sorry!
Jared
CE - Microsoft
May 16, 2012 at 10:50 am
Thanks SQLKnowItAll and everyone who contributed some ideas.
I'll start developing an SSIS package. I'm hoping it's possible to have a connection manager for my "2005" node of managed servers. This will be a fun experience.
John
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply