Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 5123

Query in the maintenance plan tables does not reflect reality

$
0
0

Hi all,

I am using SQL Server 2005 Enterprise Edition.

I want to get information about my maintenance plan using T-SQL but the results I get does not show the real maintenance plans state.

Here is my query :

select distinct msdb.dbo.sysmaintplan_plans.name AS PlanName , 
msdb.dbo.sysmaintplan_subplans.subplan_name AS SubplanName,
msdb.dbo.sysmaintplan_logdetail.line1 AS DetailLevel1,
msdb.dbo.sysmaintplan_logdetail.line2 AS DetailLevel2,
msdb.dbo.sysmaintplan_logdetail.line3 AS DetailLevel3,
msdb.dbo.sysmaintplan_logdetail.line4 AS DetailLevel4
from msdb.dbo.sysmaintplan_plans
left join msdb.dbo.sysmaintplan_subplans on msdb.dbo.sysmaintplan_subplans.plan_id = msdb.dbo.sysmaintplan_plans.id
left join msdb.dbo.sysmaintplan_log on msdb.dbo.sysmaintplan_log.plan_id = msdb.dbo.sysmaintplan_plans.id
left join msdb.dbo.sysmaintplan_logdetail on msdb.dbo.sysmaintplan_logdetail.task_detail_id = msdb.dbo.sysmaintplan_log.task_detail_id

And here is my result :

PlanNameSubplanNameDetailLevel1 DetailLevel2DetailLevel3DetailLevel14
Maintenance Cleanup Subplan_1 Maintenance Cleanup Task
MaintenancePlan_CH maintenance_hebdo Check Database Integrity Task Check Database integrity on Local server connection Databases: All databases Include indexes
MaintenancePlan_CH maintenance_hebdo Check Database Integrity Task 1 Check Database integrity on Local server connection Databases: All databases Include indexes
MaintenancePlan_CH maintenance_hebdo History Cleanup Task Cleanup history on Local server connection History type: Backup,Job,Maintenance Plan Age: Older than 2 Weeks
MaintenancePlan_CH maintenance_hebdo Rebuild Index Task Rebuild index on Local server connection Databases: XXXX Object: Tables and views
MaintenancePlan_CH maintenance_hebdo Shrink Database Task Shrink Database on Local server connection Databases: All user databases Limit: 50 MB
MaintenancePlan_CH maintenance_hebdo Update Statistics Task Update Statistics on Local server connection Databases: XXX Object: Tables and views
sauvegarde Subplan_1 Back Up Database Task
sauvegarde Subplan_1 Back Up Database Task Backup Database on Local server connection Databases: All databases Type: Full
sauvegarde Subplan_1 Back Up Database Task Backup Database on Local server connection Databases: XXX Type: Full
sauvegarde Subplan_1 Back Up Database Task 1
sauvegarde Subplan_1 Maintenance Cleanup Task

The problem is that some of the lines I get in this results are not true. Take the maintenance plan named 'MaintenancePlan_CH', for example, the results above show that there 6 different tasks, whereas in reality, there are only three : Check Database Integrity Task 1, Update Statistics Task and History Cleanup Task.

Do you guys have any ideas where the others lines are from? The Rebuild Index Task, Shrink Database Task and the Check Database Integrity Task (without the '1' at the end).

Thank you for your time.

Antoine.


Antoine...



Viewing all articles
Browse latest Browse all 5123

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>