Error OpenSQLServerInstanceRegKey: GetRegKeyAccessMask (reason: 2)

Using Ms Sql server 2012, I received the following error on my Windows 2012 r2 server

Error: OpenSQLServerInstanceRegKey: GetRegKeyAccessMask failed (reason: 2).

+7
sql-server
source share
4 answers

I found my answer - SQLServer Express version does not support SQL Server Agent.

+4
source share

I found the same error in the application log on my local workstation while trying to start the SQL agent.

The SQLAGENT.OUT file did not exist in the log path mentioned in the earlier answer. I wondered if the service account for the agent had access to this log folder ...

I tried adding the "NT Service ..." service account to the list of approved users for this folder. No joy - could not see the account in the list of users on the workstation.

So, I changed the SQL Agent service account to match the SQL Server service. Bingo! The agent is started and the SQLAGENT.OUT file appears in the log folder.

Do not worry too much about any security issues related to the service accounts being the same for both engines and agents, as this is my local workstation ...

+1
source share

You need to remove the SQLAGENT.OUT log file from the logging directory (yours may be slightly different):

C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log\SQLAGENT.OUT

This is a known issue fixed in SQL Server 2012 Service Pack 1 (SP1), but I didn’t have time to bother with updating the database, so I applied the above solution and was able to start SQL Agent successfully.

Click here for more information.

0
source share

I restart the computer three times,

and find that although the server agent cannot be started, strangely I can connect to my database in SQL management studio ...

The database can be connected and used, which is all the same to me, so I did not try to start the SQL Server agent.

0
source share

All Articles