Sunday, September 28, 2014

0 How to fix “Msg 22003, Level 16, State 1, Line 33 StartService() returned error 5, 'Access is denied.'”

While try to stop the SQL agent through xp_servicecontrol, I get the Access is denied error “

Msg 22003, Level 16, State 1, Line 33
StartService() returned error 5, 'Access is denied
.'”

I am able to run “xp_servicecontrol 'querystate','SQLAgent$SGC4SQL2014'”

image

image

This is same error as if I login as same account as SQL Server account and try to stop the sql agent using sc command

image

However,SQLAgent is also running under this account. I can start/stop the sqlagent using the same account via SQL Server configuration manager but can not do it through command line.

Here are some of the testing I did

1. User belong to Administrator group: same error

2. Normal user: same error

3. Domain Admin: works

4. Local admin: works

Only granting the local admin to the user that is running under SQL server or Add that account to the domain admin.

Apparently, Domain admin is overkill and should be avoided. If this is the function you really need, try to grant the account local admin on the host.

0 comments:

Post a Comment

 

SQL Panda Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates