服务器重启后SQL Server Agent由于"The EventLog service has not been started" 启动失败
案例环境:
操作系统 : 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)选项里面,设置当服务启动失败时,采取“重新启动服务”的措施,如下所示,经过两次测试,发现这个方案也可以完满解决这个问题。
参考资料:
服务器重启后SQL Server Agent由于"The EventLog service has not been started" 启动失败的更多相关文章
- SQL Server ->> 更改服务器时区对SQL Server Agent服务器的影响
昨天在把服务器的时区从PST改成UTC后,发现Job都不跑了.因为SQL Server Agent记录Job的历史运行时间是不区分时区的,也就是意味着我改后出现了最后一条运行记录比倒数第二条时间还要早 ...
- 无法删除服务器 'old_server_name',因为该服务器用作复制过程中的发布服务器。 (Microsoft SQL Server,错误: 20582)
无法删除服务器 'old_server_name',因为该服务器用作复制过程中的发布服务器. (Microsoft SQL Server,错误: 20582) 2013-01-05 15:02 478 ...
- SQL Server下实现利用SQL Server Agent Job对索引重建实现Balance Load
昨天工作中遇到这样一个场景,有个项目需要把某台服务器下所有的表和索引都启用数据压缩(data_compression=page),已经启用了的表和索引就不需要再压缩一次了.统计一下后发现要运行的REB ...
- Security7:管理SQL Server Agent的权限
SQL Server Agent对象包括警报(Alert),操作员(Operator),Job,调度(Schedule)和代理(Proxy),SQL Server使用msdb系统数据库管理Agent ...
- SQL Server ->> 关于SQL Server Agent Job执行步骤时的用户上下文(User Context)问题
这是最近项目相关和自己感兴趣的一个问题:SQL Server Agent Job有几种方法可以以特定用户上下文去执行任务步骤的? 这个事情需要分几种情况来说,因为对于不同类型的任务步骤,SQL Ser ...
- 如何在linux服务器部署Rstudio server,配置ODBC远程访问win 服务器上的SQL server
如何在linux服务器部署Rstudio server,配置ODBC后通过RODBC包远程访问SQL server 背景介绍:之前写过一篇文章,提到近期要部署Rstudio server(搭建数据分析 ...
- sql server 2012 链接服务器不能链接sql server 2000的解决方案 ,
本数据源来自 https://www.kafan.cn/edu/922556.html 目的为了备忘 把原来的sql server 2005直接装成了2012,然后在建立链接服务器链接一台sql s ...
- Azure 意外重启, 丢失sql server master表和 filezilla
突然发现今晚网站打不开了,提示连不上数据库. ftp也连不上了. 远程连上Azure 发现机器意外重启, 丢失sql server master表和 filezilla 要重新安装. 又耗费我几个小时 ...
- 在oracle中通过链接服务器(dblink)访问sql server
在oracle中通过链接服务器(dblink)访问sql server 2013-10-16 一. 工作环境: <1> Oracle数据库版本:Oracle 11g 运行环境 :IB ...
随机推荐
- 重温JSP学习笔记--JSTL标签库
以前写jsp的时候对jstl标签库是有些抵触的,因为我觉得嵌入java代码的方式几乎无往不利,没有必要使用标签库,不过这次复习还是好好地学习了一下,发现这个还是很有用处的,用得好能省不少事,JSTL是 ...
- C#创建安全的字典(Dictionary)存储结构
在上面介绍过栈(Stack)的存储结构,接下来介绍另一种存储结构字典(Dictionary). 字典(Dictionary)里面的每一个元素都是一个键值对(由二个元素组成:键和值) 键必须是唯一的,而 ...
- c++之字符型中的特殊字符回车符
1.字符型的应用之强制类型转换: #include<iostream> using namespace std; int main() { ;i<;i++) { cout<&l ...
- mybatis入门基础(八)-----查询缓存
一.什么是查询缓存 mybatis提供查询缓存,用于减轻数据压力,提高数据库性能. mybaits提供一级缓存,和二级缓存. 1.1. 一级缓存是sqlSession级别的缓存.在操作数据库时需要构造 ...
- 内存中OLTP与内存不足
我已经写了好几次内存中OLTP的文章和”为什么我还不推荐内存中OLTP给用户”.今天我想进一步谈下内存中OLTP背后的内存需求,还有如果你内存不够的话会发生什么. 一切都与内存有关! 我们都知道很久之 ...
- 关于JavaScript变量提升的理解
废话不说,直接上代码(这是在JavaScript面对对象编程指南上面看到的一个例子) var a=123; function f(){ alert(a); var a=1; alert(a); } f ...
- 谈谈asp.net MVC中的AppendTrailingSlash以及LowercaseUrls ,你还记得吗?
asp.net MVC是一个具有极大扩展性的框架,可以在从Url请求开始直到最终的html的渲染之间进行扩展,所以要学好还是需要了解框架的运行原理,推荐Artech. 今天我们回忆的不是MVC中的fi ...
- C#开发微信门户及应用(42)--使用Autofac实现微信接口处理的控制反转处理
在很多情况下,我们利用IOC控制反转可以很方便实现一些接口的适配处理,可以在需要的时候切换不同的接口实现,使用这种方式在调用的时候,只需要知道相应的接口接口,具体调用哪个实现类,可以在配置文件中动态指 ...
- Web内置对象 跨页面传值
内置对象: 1.QueryString - 地址栏数据拼接 get传值方式 格式:?key=value优点:简单好用,速度快,不消耗服务器内存. 缺点:只能传字符串,保密性不好,长度有限 Reques ...
- autocad2008+C#2008开发中设置自动加载dll
一.复制编译后的dlll路径,比如我的是D:\zjy\cad开发\学习\宗地图\bin\Debug\zd.dll 二.随便找个地方新建一个记事本,在记事本中写入以下内容: (command " ...