When installing SQL Server 2008/2008 R2, you might come across a situation where the setup fails towards the end, when trying to start the SQL Server services.
You find this message in the summary.txt:-
Configuration error code: 0x4BDAF9BA@1306@24
Configuration error description: Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
Configuration log: C:Program FilesMicrosoft SQL Server100Setup BootstrapLog20110831_132727Detail.txt
In the detail.txt, you find these messages:-
2011-08-31 13:49:57 Slp: at Microsoft.SqlServer.Configuration.SqlConfigBase.SlpConfigAction.Execute(String actionId, TextWriter errorStream)
2011-08-31 13:49:57 Slp: Exception: Microsoft.SqlServer.Configuration.SqlEngine.SqlEngineConfigException.
2011-08-31 13:49:57 Slp: Source: Microsoft.SqlServer.Configuration.SqlServer_ConfigExtension.
2011-08-31 13:49:57 Slp: Message: Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes..
2011-08-31 13:49:57 Slp: Watson Bucket 1
Also, since the services are created, the errorlog is also updated. You will find these messages in the errorlog:-
2011-08-31 13:49:57.25 spid7s Starting up database 'mssqlsystemresource'.
2011-08-31 13:49:57.35 spid7s The resource database build version is 10.50.1600. This is an informational message only. No user action is required.
2011-08-31 13:49:57.49 spid7s Error: 15209, Severity: 16, State: 1.
2011-08-31 13:49:57.49 spid7s An error occurred during encryption.
The service will not come online if you try to start it from configuration manager or services console.
The root cause of this issue, in most cases, is that the profile of the user being used for the service account (in my case it was local system) is corrupted.
To resolve it, follow these steps:-
When the installation throws this error, click on OK and allow it to proceed. It will fail for Database Engine, but the SQL Server service should have been created. Check the Services console.
If the service is present, perform the following steps:-
1. Go to SQL Server Configuration manager, right click on the SQL Server service, and change the service account (if it is local system, give it a windows level account, and vice-versa). It might throw a WMI error but you will see the account getting updated anyway. If not, then use the Services console. Change the account for SQL Agent as well.
2. Next, try to start the service. It should come online.
3. However, you will not be able to log in to the SQL Server
4. Now stop the service and start it from the command prompt using -m -c -T3608 parameters.
5. Now try logging in to the server using admin connection from sqlcmd (sqlcmd admin:<server name><instance name> ...)
6. Once logged in, use the sp_addsrvrolemember '<domainusername>','sysadmin'.
Also add the builtin/administrators to the sysadmin role
7. Now stop the service from the command prompt and start it from SQL Server configuration manager
You should be able to log in to the server now.
Hope this helps someone.