Maintenance plan and SQL Agent jobs

  • Say I have a SQL agent job thats kicking off a maintenance plan thats doing a full backup against Database "AdventureWorks".

    Is there a way to query the sysjobs (or another table) to tie a spcific SQL job to the database its performing the full backup against. So in this case "AdventureWorks"

    My goal is to report that "job blah" is running a full database backup against database "AdventureWorks".

  • If your maintenance plan only backs up a single database, and is appropriately named with the name of the database, it should be fairly easy. Sysjobhistory will tell you what job step is running, and from that you can get the name of the maintenance plan. Actually, it's a while since I used maintenance plans, and I'm not sure whether you get some ugly identifier in the job command instead of the maintenance plan name. If that's the case, there should be a table somewhere in msdb that maps identifiers to names.

    John

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply