案例环境:

操作系统   : Microsoft Windows Server 2003 Standard Edtion SP2

数据库版本 : SQL Server 2005 Standard Edition SP4

 

案例描述:

服务器重启过后,MSSQLSERVER服务自动重启了,但是SQLSERVERAGENT服务启动失败(当然SQL Agent服务的启动类型为自动启动(Automatic)),在这台服务器第二次遇到这种情况,第一次遇到时没太注意,以为只是特殊案例,直到在这台服务器第二次遇到这种情况,才感觉有点奇怪。

检查 SQL Server Agent's log日志发现如下错误信息:[241] Startup error: Unable to initialize error reporting system (reason: The EventLog service has not been started)

检查发现Event Log服务也正常启动了。在这篇文章SQL Server Agent failing to start because "The EventLog service has not been started"(环境为SQL Server 2000)解释这个是SQL SERVER Agent代码里面的一个bug来的:作为SQL Server代理的启动任务的一部分,它初始化一个记录组件,将错误、 警告或信息性消息报告给代理的日志文件(SQLAGENT.OUT),如果它在任何非Win9x的平台上运行,事件日志(通过事件日志服务的Windows API)作为初始化过程的一部分,它必须确保该事件日志服务已启动,因为如果不是这样,那么该代理无法正常运作,报上述错误后退出。..........

博客具体内容如下所示

It happened to be a bug in SQL Server Agent's code, and here's a brief explanation of what it is:

As part of SQL Server Agent's startup tasks, it initializes a Logging component, which will report errors, warnings, or informational messages to agent's log file (SQLAGENT.OUT) and, if it's running on any non Win9x platforms, to the Event Log (by using the EventLog service Windows APIs). So, as part of that initialization process, it has to make sure that the EventLog service is started, because if it isn't, then the agent cannot function properly and so it exits with the error described above.

The function which checks whether the EventLog service is running or not, calls EnumServicesStatus twice with SERVICE_ACTIVE as the value for its dwServiceState parameter (so it will only enumerate services that are in the following states: SERVICE_START_PENDING, SERVICE_STOP_PENDING, SERVICE_RUNNING, SERVICE_CONTINUE_PENDING, SERVICE_PAUSE_PENDING, or SERVICE_PAUSED).

The first call to that API passes NULL to the lpServices parameter and zero for cbBufSize, that to only determine the size of the buffer required to hold the list of services in such states at the moment of the call. Later, it allocates as many bytes as the pcbBytesNeeded parameter reflected that were needed, and finally it calls EnumServicesStatus again. If at the time of the second call to EnumServicesStatus there are more services in any of the states mentioned earlier, than during the first call to EnumServicesStatus, then it returns FALSE and GetLastError returns ERROR_MORE_DATA.

The function implemented in SQL Server Agent to check whether EventLog is running or not, doesn't take into account such "exceptional" condition and simply returns a failure as if the EventLog service wouldn't be running.

不过由于作者描述的情况发生在SQL SERVER 2000环境下,而我对比了手头其他一样环境的SQL SERVER 2005的服务器,都没有这个问题,只有这台服务器出现这个问题,所以弄不清到底是SQL Server Agent的bug还是操作系统环境问题所致。不过猜测跟上面博客里面所叙说的那样跟EventLog服务有一定关系。

解决方法

没有尝试使用SQL Server Agent failing to start because "The EventLog service has not been started" 博客里面介绍的方法,我在SQL Server Agent服务的恢复(Recovery)选项里面,设置当服务启动失败时,采取“重新启动服务”的措施,如下所示,经过两次测试,发现这个方案也可以完满解决这个问题。

 

参考资料:

http://blogs.msdn.com/b/ialonso/archive/2007/12/13/sql-server-agent-failing-to-start-because-the-eventlog-service-has-not-been-started.aspx

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/575904b4-72c5-4fbf-88fb-5c943f75a6e5/sql-server-agent-fails-to-start

服务器重启后SQL Server Agent由于"The EventLog service has not been started" 启动失败的更多相关文章

  1. SQL Server ->> 更改服务器时区对SQL Server Agent服务器的影响

    昨天在把服务器的时区从PST改成UTC后,发现Job都不跑了.因为SQL Server Agent记录Job的历史运行时间是不区分时区的,也就是意味着我改后出现了最后一条运行记录比倒数第二条时间还要早 ...

  2. 无法删除服务器 'old_server_name',因为该服务器用作复制过程中的发布服务器。 (Microsoft SQL Server,错误: 20582)

    无法删除服务器 'old_server_name',因为该服务器用作复制过程中的发布服务器. (Microsoft SQL Server,错误: 20582) 2013-01-05 15:02 478 ...

  3. SQL Server下实现利用SQL Server Agent Job对索引重建实现Balance Load

    昨天工作中遇到这样一个场景,有个项目需要把某台服务器下所有的表和索引都启用数据压缩(data_compression=page),已经启用了的表和索引就不需要再压缩一次了.统计一下后发现要运行的REB ...

  4. Security7:管理SQL Server Agent的权限

    SQL Server Agent对象包括警报(Alert),操作员(Operator),Job,调度(Schedule)和代理(Proxy),SQL Server使用msdb系统数据库管理Agent ...

  5. SQL Server ->> 关于SQL Server Agent Job执行步骤时的用户上下文(User Context)问题

    这是最近项目相关和自己感兴趣的一个问题:SQL Server Agent Job有几种方法可以以特定用户上下文去执行任务步骤的? 这个事情需要分几种情况来说,因为对于不同类型的任务步骤,SQL Ser ...

  6. 如何在linux服务器部署Rstudio server,配置ODBC远程访问win 服务器上的SQL server

    如何在linux服务器部署Rstudio server,配置ODBC后通过RODBC包远程访问SQL server 背景介绍:之前写过一篇文章,提到近期要部署Rstudio server(搭建数据分析 ...

  7. sql server 2012 链接服务器不能链接sql server 2000的解决方案 ,

    本数据源来自 https://www.kafan.cn/edu/922556.html  目的为了备忘 把原来的sql server 2005直接装成了2012,然后在建立链接服务器链接一台sql s ...

  8. Azure 意外重启, 丢失sql server master表和 filezilla

    突然发现今晚网站打不开了,提示连不上数据库. ftp也连不上了. 远程连上Azure 发现机器意外重启, 丢失sql server master表和 filezilla 要重新安装. 又耗费我几个小时 ...

  9. 在oracle中通过链接服务器(dblink)访问sql server

    在oracle中通过链接服务器(dblink)访问sql server 2013-10-16 一.   工作环境: <1> Oracle数据库版本:Oracle 11g  运行环境 :IB ...

随机推荐

  1. MySQL学习(二)SQL语句的总结

    1.连接查询和关联查询连接查询:把两个表中相同的元素的连接就可以查询,使用:where里,select table1.*,table2.* from table1,table2 where table ...

  2. 将richTextBox中的内容写入txt文件发现不换行(解决方法),在richTextBox指定位置插入文字

    string pathname = dt.ToString().Replace(":", ""); string str = richTextBoxResult ...

  3. 你真的会玩SQL吗?删除重复数据且只保留一条

    在网上看过一些解决方法 我在此给出的方法适用于无唯一ID的情形 表:TB_MACVideoAndPicture 字段只有2个:mac,content mac作为ID,正常情况下mac数据是唯一的,由于 ...

  4. 1.Java网络编程之概述

    黑马程序员_毕向东_Java基础视频教程第23天-01-网络编程(概述)学习笔记 网络通讯三要素: 1.IP地址 I.网络中设备的标识  II.不易记忆,可用主机名 www 万维网组织,baidu主机 ...

  5. Java中的访问控制权限

    简介 Java中为什么要设计访问权限控制机制呢?主要作用有两点: (1)为了使用户不要触碰那些他们不该触碰的部分,这些部分对于类内部的操作时必要的,但是它并不属于客户端程序员所需接口的一部分. (2) ...

  6. 开源网站.NETMVC+ Layui+SqlSugar+RestSharp

    SugarSite一个前端支持移动端的企业网站,目前只支持了简单功能,后续还会加上论坛等. 源码GIT地址: https://github.com/sunkaixuan/SugarSite 技术介绍 ...

  7. java.lang.OutOfMemoryError:GC overhead limit exceeded填坑心得

    我遇到这样的问题,本地部署时抛出异常java.lang.OutOfMemoryError:GC overhead limit exceeded导致服务起不来,查看日志发现加载了太多资源到内存,本地的性 ...

  8. MVC学习系列11---验证系列之客户端验证

    前面学习了,服务端验证,这篇文章中,我们接着学习客户端验证,客户端的验证,使用Jquery和Jquery插件来实现[jquery.validate.min.js and jquery.validate ...

  9. Scalaz(59)- scalaz-stream: fs2-程序并行运算,fs2 running effects in parallel

    scalaz-stream-fs2是一种函数式的数据流编程工具.fs2的类型款式是:Stream[F[_],O],F[_]代表一种运算模式,O代表Stream数据元素的类型.实际上F就是一种延迟运算机 ...

  10. JVM垃圾回收(GC)原理

    一.基本垃圾回收算法 1.引用计数(Reference Counting) 比较古老的回收算法.原理是此对象有一个引用则增加一个引用计数,删除一个引用则较少一个引用计数.垃圾回收时,只回收引用计数为0 ...