dcsimg

How to Find and Delete Duplicate Scheduled Jobs

Products

Analytics On Premises
9.x
8.5+

Cause

Users will encounter errors when managing scheduled jobs if there are duplicates.
Recently (since 9.2d), there is a greater chance of creating duplicate scheduled jobs if the user is using Internet Explorer 9 and up without enabling compatibility mode for the user interface site.
This document will contain the queries to identify and delete the duplicate scheduled jobs.

Resolution

The following query will display a list of all jobs with duplicates. This will list the original and the duplicate job.

SELECT * FROM [wt_sched].[dbo].[WT_Event]
WHERE [Description] IN (SELECT [Description]
FROM [wt_sched].[dbo].[WT_Event]
GROUP BY [Description] HAVING COUNT([Description])>1) AND EventTypeID =64

This next query will list only the jobs that will be deleted by the deletion query. These should all be duplicates that have never run before.

SELECT * FROM wt_sched.dbo.wt_event
WHERE wtobject_id in
(select wtobject_id from (select count(*) c, wtobject_id
from wt_sched.dbo.wt_event group by wtobject_id) as t where c > 1)
AND LastEventStatusID IS NULL

This last query will delete all of the jobs listed in the previous query.

DELETE FROM wt_sched.dbo.wt_event
WHERE wtobject_id in
(select wtobject_id from (select count(*) c, wtobject_id
from wt_sched.dbo.wt_event group by wtobject_id) as t where c > 1)
AND LastEventStatusID IS NULL