Article ID: 306655 - View products that this article applies to.
This article was previously published under Q306655
Sometimes, after you restart a computer, the SQLServerAgent service may appear to stop responding (hang). If you run this command from a command prompt
you can see that the SQL Agent has not started, although it is set to automatic. If you open the Services applet in Control Panel and press the Startup button for the SQLServerAgent, this error message appears:
The error message also appears with other services if you click their Startup buttons.
The service database is locked.
The error message shown in the "Symptoms" may occur for several reasons one of which is if the SQLServerAgent service does not start after you restart the computer even though the service is set to automatic. If the error message occurs because the SQLServerAgent service is having difficulty starting, it is because the SQLServerAgent service is holding the service control manager's database open until a failure or success occurs. Under normal circumstances, if the SQLServerAgent service starts, the database closes and the error message does not appear.
If you manually press the SQLServerAgent Start button, the service starts properly. However, this action does not satisfy the necessity for an automatic startup of the SQLServerAgent service. After the SQLServerAgent service starts, you can press the Start button on any other service with no additional problems.
To work around the problem, configure the SQLServerAgent service to startup automatically. To configure the SQLServerAgent service to startup automatically:
NOTE: Do not use this approach with a clustered SQL Server installation.
This approach does not deal with the underlying problem, it only provides a workaround.
To investigate this problem, examine the SQLAgent.out file for clues as to what process is encountering a problem. Typically, this behavior may occur because of a problem with the initialization of an extended stored procedure (xproc). For example purposes only, here is a demonstration of the problem as it relates to a specific mail profile with which SQL Mail and SQLAgent Mail is configured to use.
In this particular case, SQLAgent does not stop responding at startup if it is set to start under the LOCAL SYSTEM account. The SQLAgent also starts automatically with the use of a domain account, as long as SQL MAIL is not using the specific mail profile.
If you examine the SQLAgent.out file, it indicates that a clean startup is not occurring, and that the last event attempted was the authentication of the mail profile.
You must investigate this particular problem from the standpoint of whether SQL Mail is properly configured as described in the following Microsoft Knowledge Base article:
2/25/99 7:00:51 AM - ?  SQLServerAgent starting under Windows NT service control 2/25/99 7:00:56 AM - ?  Microsoft SQLServerAgent version 7.00.623 (x86 unicode retail build) : Process ID 195 2/25/99 7:00:56 AM - ?  SQL Server SQL version 7.00.623 (0 connection limit) 2/25/99 7:00:56 AM - ?  SQL Server ODBC driver version 3.70.623 2/25/99 7:00:56 AM - ?  NetLib being used by driver is DBNMPNTW.DLL; Local host server is (local) 2/25/99 7:00:56 AM - ?  1 processor(s) and 256 MB RAM detected 2/25/99 7:00:56 AM - ?  Local computer is SQL running Windows NT 4.0 (1381) Service Pack 4 2/25/99 7:00:56 AM - ?  Subsystem 'TSQL' successfully loaded (maximum concurrency: 20) 2/25/99 7:00:56 AM - ?  Subsystem 'CmdExec' successfully loaded (maximum concurrency: 10) 2/25/99 7:00:57 AM - ?  Subsystem 'Snapshot' successfully loaded (maximum concurrency: 100) 2/25/99 7:00:57 AM - ?  Subsystem 'LogReader' successfully loaded (maximum concurrency: 25) 2/25/99 7:00:57 AM - ?  Subsystem 'Distribution' successfully loaded (maximum concurrency: 100) 2/25/99 7:00:57 AM - ?  Subsystem 'Merge' successfully loaded (maximum concurrency: 100) 2/25/99 7:00:57 AM - ?  Subsystem 'ActiveScripting' successfully loaded (maximum concurrency: 10) 2/25/99 7:00:57 AM - ?  Using MAPI32.DLL from C:\WINNT\SYSTEM32 (version 4.0.993.3) 2/25/99 7:00:57 AM - ?  Attempting to start mail session using profile 'TestMailProfile'...
263556However, if you verify that SQL Mail is configured properly, and the problem still occurs, then Microsoft recommends that you open a support case with Microsoft Product Support Services for further troubleshooting and analysis.
(http://support.microsoft.com/kb/263556/EN-US/ )INF: How to Configure SQL Mail