2

I have a job in SQL server Agent. Now I see that this job is disabled. Multiple people can log in to server and can modify jobs (department policy).

I want to find out which user disabled this job.

Dale K
  • 25,246
  • 15
  • 42
  • 71
user2352554
  • 521
  • 4
  • 17
  • If you cannot ask around and discover who made the change, nor have some kind of ticketing system for changes made to servers, it may suggest you need some *process* changes - limiting the number of people who have such high levels of access would be a good start. – Damien_The_Unbeliever Jan 29 '19 at 08:27

1 Answers1

7

Time of the change is the only information you can query by default

SELECT date_modified FROM dbo.sysjobs
WHERE job_id = 'job_id'

In order to capture more information following measures can be setup ahead on sysjobs:

  • Update trigger
  • Change Data Capture
  • SQL Audit
  • XE Session

Nice example: SQL Server Agent logging actions and changes done to jobs

Another one:

create trigger trigg on msdb.dbo.sysjobs 
after insert , update 
as 
EXEC msdb.dbo.sp_send_dbmail
    @profile_name = 'name_of_mail_profile',
    @recipients = 'aaaa@ad.com',
    @body = 'New job creation or job modification alert',
    @subject = 'Automated Message' ;
Alexander Volok
  • 5,630
  • 3
  • 17
  • 33