I keep on breaking my lab environment and have learned many things from it. Here is one of the recent errors which I fixed. In this blog, we would learn how to fix error “The job failed. Unable to determine if the owner <Domain\User> of job <Job_Name> has server access.” While executing a SQL Agent job.
Here is the complete error message which I saw in the logs.
The job failed. Unable to determine if the owner (SQLAuth\SQLSvc) of job MntPlan.RebuildIndex_UpdStats has server access (reason: Could not obtain information about Windows NT group/user ‘SQLAuth\SQLSvc’, error code 0x5. SQLSTATE 42000 (Error 15404))
As the error message stated, the Job Owner doesn’t have access on the instance. Actually, I deleted the user from the AD to reproduce the error. This means the user had access when the Maintenance Plan was created but not anymore.
Since this was a maintenance plan, we can update job owner but I have seen an issue with this. It overwrites the setting when the maintenance plan is edited and saved. So, the right way to modify the owner of the maintenance plan by using T-SQL. (We are making it “sa”)
USE MSDB GO UPDATE sysssispackages SET ownersid = SUSER_SID('sa') WHERE NAME = 'Name Of Maint Plan'
After making the owner as ‘sa’ and saving it again, the job executed successfully. The matter of fact, I have seen quite a lot in the real world when I execute something as username SA, it usually take care of all the security issues.
Do you know any other solution to fix the error? Please share via the comment section.
Reference: Pinal Dave (https://blog.SQLAuthority.com)