Viewing Maintenance Plan Logs

Published On: 2014-04-09By:

For many of my customers I’ve got them setup to use maintenance plans because they are small shops without a DBA and the maintenance plans give them something visual which they can easily tweak later on if needed without having to have me come in to make a small change to their reindexing or backups, etc.

One of the big failings of the maintenance plans is the reporting in Management Studio. If you right click on a maintenance plan you get an option to view reports and it gives you a whole bunch of really nice info … sometimes. After the plan has been running for a while it just sits there not giving you any useful information. And that’s because the code behind the maintenance plan report page … SUCKS!

The process does a bunch of row by row querying instead of just dumping a single large recordset like any normal application. So how do you get that useful information from SQL Server. The query below will give you the exact same information that the GUI gives you, but without waiting forever for the GUI to open up. Just change the plan and subplan names to the ones that you are looking for and run the query.

ld.line1 AS [Line1],
ld.line2 AS [Line2],
ld.line3 AS [Line3],
ld.line4 AS [Line4],
ld.line5 AS [Line5],
ld.server_name AS [ServerName],
ld.start_time AS [StartTime],
ld.end_time AS [EndTime],
ld.error_number AS [ErrorNo],
ld.error_message AS [ErrorMessage],
ld.command AS [Command],
ld.succeeded AS [Succeeded]
msdb.dbo.sysmaintplan_plans AS s
INNER JOIN msdb.dbo.sysmaintplan_subplans AS sp ON
INNER JOIN msdb.dbo.sysmaintplan_log AS spl ON spl.subplan_id=sp.subplan_id
INNER JOIN msdb.dbo.sysmaintplan_logdetail AS ld ON ld.task_detail_id=spl.task_detail_id
((sp.subplan_name= ‘Full’)and((’Backups’)))
[StartTime] DESC


Contact the Author | Contact DCAC


Globally Recognized Expertise

As Microsoft MVP’s and Partners as well as VMware experts, we are summoned by companies all over the world to fine-tune and problem-solve the most difficult architecture, infrastructure and network challenges.

And sometimes we’re asked to share what we did, at events like Microsoft’s PASS Summit 2015.

Awards & Certifications

Microsoft Partner   Denny Cherry & Associates Consulting LLC BBB Business Review    Microsoft MVP    Microsoft Certified Master VMWare vExpert
INC 5000 Award for 2020    American Business Awards People's Choice    American Business Awards Gold Award    American Business Awards Silver Award    FT Americas’ Fastest Growing Companies 2020   
Best Full-Service Cloud Technology Consulting Company       Insights Sccess Award    Technology Headlines Award    Golden Bridge Gold Award    CIO Review Top 20 Azure Solutions Providers
Share via
Copy link