Hi All,
Could some one please let me know, if there is any way to check whether
all databases option is selected under the maintenance plan other than using GUI. Below is the print screen for reference.
Maintenance plan includes rebuild Index, checkdb and update statistics steps, I have to check whether the All databases option is selected for each individual task.
I have a requirement wherein, I have to check this thing on around 5000 servers.
It would be great if someone lets me know the script to check this setting, so that it will save my time.
I have used below queries and tables to get the data, but they don't have the information which i'm looking for
sysdbmaintplan_databases
Contains one row for each database that has an associated upgraded database maintenance plan.
sysdbmaintplan_history
Contains one row for each upgraded database maintenance plan action performed.
sysdbmaintplan_jobs
Contains one row for each upgraded database maintenance plan job.
sysdbmaintplans
Contains one row for each upgraded database maintenance plan
select * from sysdbmaintplan_jobs
SELECT name,subplan_name,subplan_description
FROM msdb.dbo.sysmaintplan_plans AS s
INNER JOIN msdb.dbo.sysmaintplan_subplans AS sp ON sp.plan_id=s.id
Order by name,subplan_name
SELECT s.name AS MaintenancePlanName,
sp.subplan_name AS SubplanName,
subplan_description AS SubplanDescription,
sj.name AS JobName,
sj.enabled AS JobStatus,
ss.name AS ScheduleName
FROM msdb.dbo.sysmaintplan_plans AS s
LEFT JOIN msdb.dbo.sysmaintplan_subplans AS sp ON sp.plan_id = s.id
LEFT JOIN msdb.dbo.sysjobs AS sj ON sj.job_id = sp.job_id
LEFT JOIN msdb.dbo.sysschedules AS ss ON sp.schedule_id = ss.schedule_id
ORDER BY s.name,
sp.subplan_name
Thanks in Advance.
Regards, Kranthi