While trying to start SQL Service for a named instance, I got an error message related to event id 26 – Your SQL Server Installation is Either Corrupt or has Been Tampered With (Error Getting Instance Name).
Here is the text of the error which is related to event id 26.
Windows could not start the SQL Server (SOFTWARE) service on Local Computer. Error 1067: The process terminated unexpectedly.
When I checked event log I found following error messages:
Error Messages 1: The SQL Server (SOFTWARE) service terminated unexpectedly. It has done this 4 time(s).
Error Message 2: Application popup: SQL Server: Your SQL Server installation is either corrupt or has been tampered with (Error getting instance name.). Please uninstall then re-run setup to correct this problem.
The error gives hints about the issue, but I was not very sure what I should do. I search on the internet and found that we get Error getting the instance name when mapping between instance ID and name is incorrect. So, I looked into registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL
As we can see above, the SOFTWARE is mapped to MSSQL13.SOFTWARE. so I looked for this key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL13.SOFTWARE
Interestingly, I found that someone renamed MSSQL13.SOFTWARE to MSSQL13.SOFTWARE1 which was causing the issue.
As soon I renamed the key back, the issue was resolved.
Another way to find a cause of such errors would be to start SQLServr.exe via command prompt and you might get a more meaningful error.
I don’t know who renamed the key and that is still a mystery.
Reference: Pinal Dave (https://blog.sqlauthority.com)