Solved

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

Posted on 2008-06-12
5
563 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
  • 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how the fundamental information of how to create a table.

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now