The sql server agent started and then stopped

Issue Unable to start SQL Server Agent. Produces the following error when trying to start it from the services control panel. "The SQL Server Agent [MSSQLSERVER] service on Local Computer started and then stopped.  Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service."

Product Line

Struxureware Power Monitoring Power Monitoring Expert ION Enterprise

Environment

SQL Server 2005, SQL Server 2008 R2, SQL Server 2012, SQL Server 2014

Cause

There was no such directory present on the machine and also the SQLAgent.out log file did not exist.

Resolution


*Warning: This article contains information about editing the registry. Improper changes to the registry can permanently damage the operating system. Always backup the registry before making any changes.* Manually try to start SQL Server Agent from a command prompt using the following command: SQLAGENT90 -C -V>C:\SQLAGENT.OUT Check the contents of the SQLAgent.out file produced by this command.  Should contain an message as per below: Unable to rename C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLAGENT.OUT to C:\ProgramFiles\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\SQLAGENT.1 [reason: The system cannot find the path specified] 2014-08-24 10:10:31 - ! [241] Startup error: Unable to initialize error reporting system [reason: The system cannot find the path specified] 2014-08-24 10:10:31 - ? [098] SQLServerAgent terminated [normally] Check the value of key ErrorLogFile in the following registry key. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\SQLServerAgent Change the value in the ErrorLogFile key to reflect the correct location of the SQL log folder.

After making the change and saving, restart the SQL Server Agent from the services control panel.

I'm unable to start the SQL Server agent in services. I'm getting the following error while starting.

SQL Server Agent service in local computer started and then stopped. Some services automatically stop if they have no work to do, for example, the performance logs and alert service.

If you give the SQL Agent service account Windows local administrator rights, you can bypass most security restrictions that might stop Agent from working. However, you are then running Agent with moer rights than it needs.

In SQL Server 2005, neither the Agent account or the SQL Server account need to have Windows local admin rights.

1] Look in BOL 'Setting up Windows Service Accounts' and ensure SQL and Agent have the rights specified. Also look at the rights listed in 'Enabling memory support for over 4GB physical memory' and 'Database File initialization'.

2] Ensure the service accounts have Read authority on the Windows 'Event Log' and 'Remote Procedure Call [RPC]' services. Agent will not run if it cannot determine the status of Event Log.

3] Ensure the service account used for Agent is defined as a login to SQL Server.

This should get you past most problems, and avoid the need to run the services with local admin authority.

Original author: //github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.

When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara

I'm using SQL Server 2014 and having a problem.

In Task Manager, on Services tab, I found SQLAgent$VILLBE_SQLSERVER [VILLBE is my computer name], right click and Start.

It started and... stopped after 1 second.

Then, I open services.msc, and Start the SQL Server Agent [VILLBE_SQLSERVER]. It's working.

After 30 seconds, it stopped automatically. When I click Start again, it said that:

The SQL Server Agent [VILLBE_SQLSERVER] service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.

Last, I right click SQL Server Agent, choose Properties, set Start up type is Automatic and reboot my PC.

When reboot is done, SQL Server Agent still is stopped

Some other services:

SQL Server Browser - Running - Automatic [start up] SQL Server [SQLEXPRESS] - Cannot start within warning: **Windows could not start the SQL Server [SQLEXPRESS] on Local Computer....error code 17058.**

Can you give me anyway to fix the problem?

Thank you!

Hi,

    I am using SQL Server 2008 in my local machine. I have noticed that SQL server agent service does not start automatically even though its startup type is 'automatic'. Note - other sql related services such as SQL Server [MSSQLSERVER] runs fine. When I  try to start the agent service manually, it stops by giving error message - 'the sql server agent [mssqlserver] service on started and then stopped'. 


    After bit of searching I found that it could be due to permission issues. I have give full control to 'NETWORK SERVICE'and my local instance in registry [HKEY_LOCAL_MACHINE] for SQL server registry keys. Also I have granted permissions in Local security policy for the current instance. But, still I am facing the issue. 

   The agent service starts for ~3 seconds when I stop 'SQL Server [MSSQLSERVER]' [which is running] and start 'SQL Server Agent [MSSQLSERVER]'. 


   I tried to start agent service from SSMS. It throws 'Object reference not set to an instance of an object' errorIn SQL Server agent log I could see an error 'sqlServer Error: 22022, CryptUnprotectData[] returned error 13, 'The data is invalid.' [SQLSTATE 42000]'

  Could you please assist me on this?

Cheers,

Shree

SantoshUmarani-1390 asked Jul 20, '21 | SeeyaXi-msft commented Jul 23, '21

Hi,

SQL server [SQLXPRESS2014] is getting stopped automatically. In the event viewer I am getting the following error message.

SQL Server is terminating because of fatal exception c0000005. This error may be caused by an unhandled Win32 or C++ exception, or by an access violation encountered during exception handling. Check the SQL error log for any related stack dumps or messages. This exception forces SQL Server to shutdown. To recover from this error, restart the server [unless SQLAgent is configured to auto restart].

Can you please let me know what could be the reason of this issue ?
Kindly waiting for your resposne.

Thanks,Santosh

sql-server-general

Comment

Video liên quan

Chủ Đề