Friday, October 30, 2020

Removing orphans from MSX

From time to time, I try to script a job in MSX. Very often, it fails. 

When it does, I use this query to take a look at the orphans, and then I use the "delete" section to remove the orphan rows from MSX, which allows me to script the job.

This is based on code I found online, but I have lost the source.


select j.[name], *--count(*) 

--delete from js 

FROM msdb.dbo.sysjobservers js

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

LEFT JOIN msdb.dbo.systargetservers ts ON ts.server_id = js.server_id

WHERE ts.server_id IS NULL

No comments:

Post a Comment