• subscribe
December 23, 2008 12:00 AM

Create a Job-Scheduling Advisor

Build a Gantt-type report that helps you choose optimum timeframes to run SQL Server Agent jobs
SQL Server Pro
InstantDoc ID #100664
Downloads
100664.zip

What I had originally wanted was to see not only the job start times but also the duration and any jobs that overlap in time. Since the data field for the Range chart is simply the start and end time difference, the graphical representation of the overlapping jobs is handled automatically by the report. Figure 2 shows the data series properties, top and bottom values, which are the start and end times of the jobs from the Jobs data set. The Category field is simply the job name, referenced by [name]. The Server field will be placed in the Series section of the chart. I also added 3D elements to the chart, by right-clicking the range bars in Design view and selecting 3D Effects.

You might also notice in Figure 2 that the Tooltip is an expression, indicated by the value <Expr>. Since I wanted this overlay report to be interactive and also to conserve report real estate, I placed some of the details in the Tooltip item, which will be displayed when you hover the mouse over it. Listing 4 shows the Tooltip expression used to display report information. To view the tooltip Visual Basic code in the report, simply click the Expression button (the ƒx button) at the right. I use the Chr function to insert a carriage return—the equivalent of Chr(13)—in the tooltip.

The final view, Figure 3 shows the report after it was executed with two server values and the run date 9/21/2008. You can see that two jobs overlap between the two servers. Hovering the mouse over a job shows the job name, run date, and the actual duration. I also determine from the tooltip that both jobs have UNC in their title, indicating that a network resource is being used and possible resource contention that I might want to investigate further.

Adding Value to DBA Repository
If you’ve already downloaded and implemented my DBA Repository solution (see the Learning Path box online for a complete list of DBA Repository articles), all you need to do to implement the overlay report is to download, load, and deploy the Overlay.rdl file. The overlay report has already helped me immensely in my daily tasks, and I hope it adds value to your own reporting capability. I’ll keep expanding this solution and plan to post updates to it if readers are interested. As always, I welcome your feedback and enhancements.



ARTICLE TOOLS

Comments
  • aa
    8 months ago
    Sep 22, 2011

    I don't remember if you mentioned it in your article but a sigificant issue with this approach is that even if a job executes multiple times in the specified time window only a single excution of it is displayed.

  • Cheung
    2 years ago
    May 06, 2010

    I can't seem to download the zip file. My browswer says it cannot find the file. Anyone else experiencing this issue?

    Thanks,
    Jason

  • SUE
    2 years ago
    Jan 22, 2010

    I'm still hoping to get a version of the DBA_Repository SSIS package which is able to accomodate SQL 2008 servers. When do you expect this updated solution to be featured in one of your articles?

  • Karen
    3 years ago
    Mar 30, 2009

    I contacted Rodney Landrum about the error. He noted that this error can be overcome by eliminating records with a last_run_date value of 0. The following WHERE clause includes criteria to exclude rows of this nature:

    WHERE (enabled = 1) and server in (@Server) and (Cast(Cast(LEFT(last_run_date, 4) as char(4)) + '/'
    + Cast(SUBSTRING(cast(last_run_date as char(8)), 5, 2) as char(2))
    + '/' + cast(right(last_run_date, 2) as char(2))as datetime) in (@Last_Run_Date) and last_run_date <> 0 and last_run_date is not NULL)
    ORDER BY Server

    Rodney noted that was a slight oversight and that he did run into the situation after the article was posted.

    In regard to a 2008 version of the DBA_Repository SSIS package, Rodney has a version of the SSIS package that accomodates 2008 servers. This repository solution includes such enhancements as Error Log Reader using MERGE. The article presenting the updated repository solution will be featured in an upcoming issue of SQL Server Magazine.

    Karen Bemowski, senior editor
    SQL Server Magazine, Windows IT Pro

  • SUE
    3 years ago
    Mar 06, 2009

    Do you have a 2008 version of the DBA_Repository SSIS Package. I thought it was great.

You must log on before posting a comment.

Are you a new visitor? Register Here