Link to home
Start Free TrialLog in
Avatar of 66chawger
66chawgerFlag for United States of America

asked on

How to query SQL 2005 Maintenance Job Information

I am trying to figure out how to query the Maintenance Plan Jobs and their associated detail (sub plans, schedule detail, etc.).  I read a previous article called "SQL query to show all databases in a Maint Plan" however the entire script is for SQL 2000.  
I know I can get the list of the plan names from:
SELECT * FROM sysmaintplan_plans  (this is a view)

I can get schedule info from:
SELECT * FROM [MSDB].[dbo].[sysschedules]

And there are other tables such as "msdb.dbo.sysmaintplan_subplans"

So what I want is to be able to query or script so I can obtain a list of all the maintenance jobs on a SQL server with the schedule details for each.  
Avatar of St3veMax
St3veMax
Flag of United Kingdom of Great Britain and Northern Ireland image

I think you may struggle; as if you have created a Maintenance Plan; then you would have used SSIS to create a package; the guts of it would be stored in the package. I'm not aware of a way to see what's what without using SSIS to open the package.

If you had dont this with T-SQL; then you could have looked at the system tables in MSDB.

I belive you're looking at in this instance are:

SysJobs
SysJobHistory
SysJobSchedules

HTH
Avatar of 66chawger

ASKER

Yes, it is a mixture of SQL, Quest LiteSpeed, etc.  Definitely not easy to get at.  I might be able to get at what I need in one of the tables.  I don't need to granular, but do need at least the name of the job/plan and the schedule info...
ASKER CERTIFIED SOLUTION
Avatar of Sharath S
Sharath S
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hey thanks Sharath!  That is the closest I have seen to what I need.  I can script it out more to interpret the values (freq type, freq_subdat_type..etc)...
The solutions was as complete as you can get.  This will give me what I need  and I can parse out the jobs that are not what I need.  Thanks!!!!