NOTE: This content has been updated and expanded in a whitepaper:
7 Reasons Your SQL Server Service Won't Start, by Pinal Dave
If you are a professional SQL Server DBA, you must have faced this issue at least one time in your career. Your junior admin calls you during vacation to inform you that the production instance is not starting and something seems to be wrong. This piece addresses the top three reasons that your SQL Server Service may not be working and offers some simple solutions to resolve potential roadblocks.
Here is the error which you would receive when we try to start SQL Services from various places.
Windows could not start the SQL Server (MSSQLSERVER) on Local Computer. For more information, review the System Event Log.
“The service failed to respond in a timely fashion”.
“The service failed to start”.
We will try to investigate each of these reasons messages and possible resolution for the same.
Reason # 1: Service account password changed but not updated on the server where SQL Server instance is installed
This is one of the most common cause where service account password has been changed by domain admin or SQL Admin but this information is not updated in SQL Server Services.
Here is the error which we would see if we try to start using Services.
Windows could not start the SQL Server (MSSQLSERVER) service on Local Computer.Error 1069: The service did not start due to a logon failure.—————————
System Event logs should show below
Log Name: System
Source: Service Control Manager
Date: <Date Time>
Event ID: 7000
Task Category: None
Description: The SQL Server (MSSQLSERVER) service failed to start due to the following error:
The service did not start due to a logon failure.
Solution: We need to update the password in services. The right way to do it is to use SQL Server Configuration Manager and type in new password (under Log On tab) as shown below
That was easy to say the least. Now let us move to the next message.
Reason # 2: Startup parameters have incorrect file path locations.
This is another common cause of SQL Server Service startup failure. Let’s assume that master database is located on a drive and files of the database (master.mdf and/or mastlog.ldf) are not available. Since master database is a system database, SQL Service would fail to start. If we try to start SQL via services, we will get below error.
Windows could not start the SQL Server (MSSQLSERVER) on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 17113.
If we attempt the same via configuration manager, we get standard error which doesn’t explain much.
SQL Server Configuration Manager
The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details.
Whenever we get such errors, we should start looking at SQL Server ERRORLOGs are defined under start-up parameters or application event log. We can look at SQL Server Configuration Manager and look for Startup parameter having name -e as shown below (for SQL 2014):
We can open ERRORLOG using notepad or any other text editor. Here is the snippet which shows the problem.
<Date Time> Server Error: 17113, Severity: 16, State: 1.
<Date Time> Server Error 2(The system cannot find the file specified.) occurred while opening file 'C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\master.mdf' to obtain configuration information at startup. An invalid startup option might have caused the error. Verify your startup options, and correct or remove them if necessary.
As highlighted above, we can see that SQL is not able to find the file master.mdf.
Below is another example of error for model database.
<Date Time> spid9s Error: 17207, Severity: 16, State: 1.
<Date Time> spid9s FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\modellog.ldf'. Diagnose and correct the operating system error, and retry the operation.
<Date Time> spid9s File activation failure. The physical file name "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\modellog.ldf" may be incorrect.
<Date Time> spid9s Error: 945, Severity: 14, State: 2.
<Date Time> spid9s Database 'model' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details.
<Date Time> spid9s Could not create tempdb. You may not have enough disk space available. Free additional disk space by deleting other files on the tempdb drive and then restart SQL Server. Check for additional errors in the event log that may indicate why the tempdb files could not be initialized.
Solution: First we need to find out the correct location of the files. Once files are identified, either put them into the location where SQL Server wants or ALTER the database to point to correct location. If there is an issue with model or tempdb database then we need to start SQL Server using trace flag 3608 as explained in http://msdn.microsoft.com/en-us/library/ms345408.aspx
Reason # 3: System database files not available – accidental deletion or corruption due to disk failures.
If files are missing or corrupted for system databases (master and/or model) SQL Server service would not start. ERRORLOG (mentioned earlier) would contain the exact database name and file name which has the problem. Here are few snippets of error pointing to corruption of system databases.
<Date Time> spid5s Starting up database 'master'.
<Date Time> spid5s Error: 9003, Severity: 20, State: 1.
<Date Time> spid5s The log scan number (216:72:1) passed to log scan in database 'master' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf). If this error occurred during replication, re-create the publication. Otherwise, restore from backup if the problem results in a failure during startup.
<Date Time> spid5s Cannot recover the master database. SQL Server is unable to run. Restore master from a full backup, repair it, or rebuild it. For more information about how to rebuild the master database, see SQL Server Books Online.
Depending on which database file is corrupted, we need to take appropriate action. If master database files are corrupted (error above) then we need to rebuild the master database and restore it from the backup. If issue exists with other system databases then SQL can be started via trace flag and they can be restored. Books online has topic for each database. Refer http://msdn.microsoft.com/en-us/library/ms190190.aspx
There can be many other reasons to service not starting which we will cover in a separate blog in the future. Read the white paper "Blocking and Locking Troubleshooting in SQL Server for more information."