SQL server job name and Job owner

SQL Server recommends ‘sa’ as job owner for sql server jobs. Where as when you create sql job it takes your login as job owner by default.
Its DBA’s responsibility to regularly audit sql jobs and make sure there owner is sa.

Below is quick scripts to find job owner fo SQL Server Job

/**************List of Jobs and their owner*************************/
Select s.name as jobname , l.name as jobowner
from msdb..sysjobs s
inner join master.sys.syslogins l
on s.owner_sid = l.sid where l.name = 'sa' order by s.name
/***************************************/


/*************List of Jobs whose owner is sa**************************/
Select s.name as jobname , l.name as jobowner
from msdb..sysjobs s
inner join master.sys.syslogins l
on s.owner_sid = l.sid where l.name = 'sa' order by s.name
/***************************************/





No comments:

Post a Comment