How to identify a SQL Agent job by Schedule number

  • I've had a couple of errors happen recently, and right around the same time there were warnings stating the following:

    [191] Warning [1]: Possible date calculation spin for Schedule 1619.

    I'm trying to see if it's possible to identify which task it was by the number following after the schedule.

  • What version and so of SQL Server are you running. I have seen this error happen on sql 2000 and 2005 and it was related to the start date that was associated with the sql job schedule (the one job in particular had a very old start date). Try updating the start date for the job. You can find the job associated to this schedule id by looking at the msdb db, sysjobsteps table (if on sql 2005 or 2008), sysjobschedules on sql 2000. The job_id from those tables maps back to the sysjobs table. That will give you the job name, try updating the start date for that job to today's date.

    [font="Courier New"]Michael Connolly
    [/font]

  • I'm working with SQL 2008 (SP3). I've tried all the tables you've listed above, but neither one of them contain the schedule id that was reported by error log.

  • How many sql jobs/schedules on your instance? If not many, check the start dates on the schedules for all of them.

    [font="Courier New"]Michael Connolly
    [/font]

  • Schedules are attached to jobs so the best you can do is figure which job or jobs are using that schedule:

    USE msdb;

    SELECT j.name

    FROM dbo.sysschedules s

    JOIN dbo.sysjobschedules js ON s.schedule_id = js.schedule_id

    JOIN dbo.sysjobs j ON js.job_id = j.job_id

    WHERE s.schedule_id = 1619

    ORDER BY j.name;

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • I've looked through the table, and it doesn't seem that any of the tasks have a schedule_id that's listed above. Perhaps this is why there was a warning in the first place.

  • Michael's probably right and opc's query is the best way to get at it. Unfortunately, the query won't work if it's an orphaned schedule with no job. IIRC SQL deletes those when the schedule is removed from the last job but maybe that didn't happen for some reason.

    Anyway, in SSMS, expand SQL Server Agent node, right-click on jobs and select Manage Schedules. You can sort by ID there. Any chance you see it now?

  • Just checked in Manage Schedule console, no record of schedule with that ID.

  • Is it possible it was cleaned up by someone else? Are you still seeing the errors being logged? When was the last time you saw this event in your logs?

  • It's possible for sure. The error has not been seen since it happened on saturday. I've checked logs periodically since then, and nothing like has appeared.

Viewing 10 posts - 1 through 9 (of 9 total)

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