2009年2月17日星期二

SQLServer 2005 Agent无法启动的问题

SQLServer 2005服务的登录身份默认是Local System(本地系统帐户)。

如果修改成自己的一个Windows帐户后,Agent就启动不起来了,在Management studio的Agent服务处显示
“禁用代理XP” 在事件里面出现错误:

SQLServerAgent could not be started (reason: SQLServerAgent must be able to connect to SQLServer as SysAdmin, but '(Unknown)' is not a member of the SysAdmin role).

开始以为是这个windows账户必须加到SQL的sa组里,但是添加进去还是不行。

msdn里给的解决方案是“代理 XP”选项

sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Agent XPs', 1;
GO
RECONFIGURE
GO

执行脚本时提示:
Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.
Msg 5845, Level 16, State 1, Line 1
Address Windowing Extensions (AWE) requires the 'lock pages in memory' privilege which is not currently present in the access token of the process.
Msg 15123, Level 16, State 1, Procedure sp_configure, Line 51
The configuration option 'Agent XPs' does not exist, or it may be an advanced option.
Msg 5845, Level 16, State 1, Line 1
Address Windowing Extensions (AWE) requires the 'lock pages in memory' privilege which is not currently present in the access token of the process.

恰好最近刚刚更换过Cluster服务账户,知道这个'lock pages in memory' 是组策略里的一个设置,修改之后重起SQL服务,然后Agent服务即可启动,修改方法如下:
To enable the lock pages in memory option

On the Start menu, click Run; in the Open box, type gpedit.msc.

The Group Policy dialog box opens.

On the Group Policy console, expand Computer Configuration, and then expand Windows Settings.

Expand Security Settings, and then expand Local Policies.

Select the User Rights Assignment folder.

The policies will be displayed in the details pane.