MSSQL 2019 - SQL Server Agent - Jobs account

%3CLINGO-SUB%20id%3D%22lingo-sub-1994633%22%20slang%3D%22en-US%22%3EMSSQL%202019%20-%20SQL%20Server%20Agent%20-%20Jobs%20account%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1994633%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everyone%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20question%20regarding%20the%20execution%20of%20jobs%20in%20MSSQL%202019.%3C%2FP%3E%3CP%3EI%E2%80%99m%20managing%20several%20MSSQL%20servers%20but%20I%E2%80%99m%20not%20a%20DBA%20so%20maybe%20my%20question%20will%20sound%20vapid.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOn%20a%20SQL%20mono-instance%20server%2C%20I%20have%20a%20user%20who%20is%20member%20of%20%E2%80%9C%20SQLAgentUserRole%E2%80%9D%20on%20the%20database%20%E2%80%9Cmsdb%E2%80%9D.%3C%2FP%3E%3CP%3EHe%20created%20jobs%20and%20is%20owner%20of%20these%20jobs.%3C%2FP%3E%3CP%3EFor%20what%20I%20read%20(and%20understood)%2C%20jobs%20are%20executed%20with%20the%20service%20account%20running%20the%20service%20%E2%80%9CSQL%20Server%20Agent%E2%80%9D%20if%20and%20only%20if%2C%20the%20owner%20of%20this%20job%20is%20sysadmin%20(which%20is%20not%20the%20case%20for%20me).%3C%2FP%3E%3CP%3EUnfortunately%2C%20I%20cannot%20find%20MS%20documentation%20confirming%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECould%20someone%20please%20explain%20me%20that%20(MS%20documentation%20would%20be%20ideal).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENow%2C%20let%E2%80%99s%20assume%20I%20understood%20well%2C%20and%20jobs%20are%20running%20with%20the%20account%20specified%20as%20the%20job%20owner.%20What%20would%20be%20the%20best%20practice%20to%20manage%20these%20jobs%3F%20Should%20the%20user%20change%20the%20owner%20when%20he%20creates%20a%20job%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20answers.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1995935%22%20slang%3D%22en-US%22%3ERE%3A%20MSSQL%202019%20-%20SQL%20Server%20Agent%20-%20Jobs%20account%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1995935%22%20slang%3D%22en-US%22%3EAccording%20to%20this%20link%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fssms%2Fagent%2Fmanage-job-steps%3Fview%3Dsql-server-ver15%23transact-sql-job-steps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Fssms%2Fagent%2Fmanage-job-steps%3Fview%3Dsql-server-ver15%23transact-sql-job-steps%3C%2FA%3E%2C%20for%20my%20understanding%2C%20it%20confirms%20how%20I%20was%20understanding%20that.%20So%20in%20my%20case%2C%20the%20user%20%22Bob%22%20who%20creates%20job%20is%20not%20sysadmin%2C%20so%20jobs%20are%20running%20with%20the%20account%20specified%20as%20being%20the%20owner.%20By%20default%20the%20owner%20is%20the%20user%20%22Bob%22%20who%20created%20the%20job.%20Now%20my%20goal%20is%20to%20avoid%20any%20service%20interruption%20the%20day%20we%20disable%20the%20account%20of%20the%20user%20%22Bob%22%20who%20created%20jobs.%20I%20could%20create%20another%20account%20%22jobexec_acc%22%2C%20granting%20it%20just%20necessary%20permissions%20in%20order%20to%20execute%20jobs.%20In%20my%20case%2C%20the%20user%20%22Bob%22%20cannot%20change%20the%20owner%20of%20jobs%20he%20creates%2Fcreated.%20Does%20it%20mean%20a%20DBA%20needs%20to%20do%20that%3F%20Once%20more%2C%20I'm%20not%20DBA%20so%20I%20don't%20know%20if%20it%20is%20the%20good%20way%20to%20go%20for%20managing%20SQL%20servers.%20Basically%2C%20my%20question%20is%2C%20do%20you%20have%20recommendation%20for%20best%20practices%20for%20managing%20jobs%3F%20Thank%20you%3C%2FLINGO-BODY%3E
New Contributor

Hi everyone,

 

I have a question regarding the execution of jobs in MSSQL 2019.

I’m managing several MSSQL servers but I’m not a DBA so maybe my question will sound vapid.

 

On a SQL mono-instance server, I have a user who is member of “ SQLAgentUserRole” on the database “msdb”.

He created jobs and is owner of these jobs.

For what I read (and understood), jobs are executed with the service account running the service “SQL Server Agent” if and only if, the owner of this job is sysadmin (which is not the case for me).

Unfortunately, I cannot find MS documentation confirming that.

 

Could someone please explain me that (MS documentation would be ideal).

 

Now, let’s assume I understood well, and jobs are running with the account specified as the job owner. What would be the best practice to manage these jobs? Should the user change the owner when he creates a job?

 

Thank you for your answers.

2 Replies
According to this link https://docs.microsoft.com/en-us/sql/ssms/agent/manage-job-steps?view=sql-server-ver15#transact-sql-..., for my understanding, it confirms how I was understanding that. So in my case, the user "Bob" who creates job is not sysadmin, so jobs are running with the account specified as being the owner. By default the owner is the user "Bob" who created the job. Now my goal is to avoid any service interruption the day we disable the account of the user "Bob" who created jobs. I could create another account "jobexec_acc", granting it just necessary permissions in order to execute jobs. In my case, the user "Bob" cannot change the owner of jobs he creates/created. Does it mean a DBA needs to do that? Once more, I'm not DBA so I don't know if it is the good way to go for managing SQL servers. Basically, my question is, do you have recommendation for best practices for managing jobs? Thank you

@Julien4 

 

Hi,

here is a link to an explanation on how to change the owner of an SQL job.

 

Hope it will help.

 

Frank