MS SQL Server 2012 Error – OpenSQLServerInstanceRegKey:GetRegKeyAccessMask failed (reason: 2).

I’ve encountered this annoying error which causes the SQL Agent Service to immediately stop after it is started.

SQL Agent was displaying ‘Agent XPs disabled‘:

Like Microsoft tells you, run this query to enable the ‘Agent XPs’-option in SQL Server:

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Agent XPs', 1;
GO
RECONFIGURE
GO
sp_configure 'show advanced options', 0;
GO

…SQL Agent Service still refused to start….so back to Google! :)

After some Googling, I’ve found this golden tip:

This error can be due to an invalid ErrorLogFile path. Check the ErrorLogFile value under the instance registry key. The default instance key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.MSSQLSERVER\SQLServerAgent

It appeared that because I installed another instance earlier and uninstalled that one, somehow the SQLAGENT.OUT-file was locked. I manually deleted the file in the logging directory:

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

After the deletion, I simply started the SQL Agent Service and it ran fine again! :)

Google also says:

This issue has been identified as a bug
It will be fixed with their next (service pack) update.


About these ads

9 thoughts on “MS SQL Server 2012 Error – OpenSQLServerInstanceRegKey:GetRegKeyAccessMask failed (reason: 2).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s