Solved

Query to return list of databases selected in a SQL 2005 maintenance plan?

Posted on 2008-06-12
5
569 Views
Last Modified: 2008-09-14
Is there a SQL 2005 equivalent of the attached code to return the list of DBs in a maintenance plan?

I have heard this info may be embedded in the SSIS package and is not queryable.

Can anyone confirm?

We use LiteSpeed for our backups and have a stored proc on our SQL 2000 servers which queries a given maintenance plan name to return the list of databases that should be backed up.
This means when we change the list of databases in a maintenance plan, our proc automatically picks up the change and LiteSpeed backs up the correct databases.
Works fine, until we try it on SQL 2005 :(

Cheers, Arron
select database_name from msdb..sysdbmaintplan_databases where plan_id = @planid

Open in new window

0
Comment
Question by:arronchester
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 21770459
Here is what MS says about that system table:

This table is included in Microsoft SQL Server 2005 to preserve existing information for instances upgraded from a previous version of Microsoft SQL Server. SQL Server 2005 does not change the contents of this table. This table is stored in the msdb database.

This feature will be removed in the next version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature.

I am pretty sure that since maintenance plans in 2005 are SSIS packages (and ssis packages are XML), it is not stored in the system tables anymore....

0
 

Author Comment

by:arronchester
ID: 21770565
Thanks for your comment chapmandew.

So is there a way to open the SSIS package in TSQL and get the list of databases selected in the plan?

I've written TSQL before to open DTS packages and get details of connections using the following procs:

sp_OACreate 'DTS.Package'...
sp_OAMethod @object, 'LoadFromSQLServer'...
sp_OAGetProperty...

Can anything like this be done to get info from an SSIS package?

Thanks
0
 

Author Comment

by:arronchester
ID: 22136491
Can anybody help? :D
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question