日期:2014-05-18  浏览次数:20658 次

邹建大哥请进,SQL SERVER AGENT配置问题
我先把问题描述一下
企业管理器中其他用户都删除了!!!只有sa,密码为111,采用混合登录模式。
sqlserveragent的属性-> 连接sql   server的参数设置为:使用sqlserver身份验证,用户名sa,密码111
后来,sa的密码改成了222
我想用代码实现把sqlserveragent的连接参数也改成222
请邹建大哥再次赐教,小弟在此感谢

参考:
前几天发过一个帖子,也是这个问题
http://community.csdn.net/Expert/topic/5331/5331472.xml?temp=.6302759

我测试过用
exec   xp_cmdshell   'net   start   SQLSERVERAGENT '  

run( "scm   -Action   7   -Service   SQLSERVERAGENT   Pwd   "+sqlca.LogPass+ "   -ExePath   ~ "C:\Program   Files\Microsoft   SQL   Server\MSSQL\binn\sqlagent.exe~ "   -SvcStartType   2 ")
都只能在agent的连接密码已经改成222的情况下启动agent服务,不能修改连接参数。

不知道启动agent服务是不是还有别的参数可以用来修改设置的?



------解决方案--------------------
服务里选择SQLSERVERAGENT 启动账号
------解决方案--------------------
呵呵,不知这个对楼主有没有帮助。。。
http://support.microsoft.com/kb/230236/zh-cn

SQL 7.0 联机丛书中不记录 BUG: Scm.exe 命令行参数

症状
服务控制管理器 (SCM) 可用于, 启动、 停止和暂停 MicrosoftWindowsNT, 使用命令行语法中任何服务。 Win9x, 下实用工具可用于控制 SQLServer 相关的 MSSQLServer、 SQLServerAgent, 和 Microsoft 分布式事务处理协调器 (MSDTC)。 SCM.exe 可以执行从命令行具有以下参数:

Service Control Manager Utility Command Line Arguments
=======================================================
-Action
1 = Start, 2 = Restart,
3 = IsRunning (returns exit code of 1056 if an instance of the service is already running.,1062 if the service has not been started.)
4 = Delete Service, 5 = Install Service,
6 = Stop, 7 = Modify

-Server <Optional name of the SQL server (default is this computer)>
-Pwd <Optional SQL server 'sa ' password (default is " ")>
-StartupOptions <Optional space-delimited list of server startup options>
-Service <Name of the service (default is MSSQLServer)>
-ExePath <Path to the service exe on this computer>
-SvcStartType <1 for SERVICE_DEMAND_START or 2 for SERVICE_AUTO_START>
-SvcAccount <service account name>
-SvcPwd <service account name password>
-Dependencies <List of service name dependencies separated by semi-colons>
-Silent <1 to suppress most messages or 0 for interactive mode>

要启动 SQLServer 服务, 使用: scm -Action 1 -Server jtknt0 -Service MSSQLServer

要停止 MicrosoftSearch 服务, 使用: scm -Action 6 -Server jtknt0 -Service mssearch

使用 " 症状 " 部分用于从命令提示符或批处理程序执行 Scm.exe 中列出选项。

状态
Microsoft 已确认这是 " 适用于 " 一节中列出 Microsoft 产品中存在问题。
------解决方案--------------------
启动这个服务需要双重认证,一是os,二是sql,不知道怎么办了

------解决方案--------------------
似乎只能在企业管理器中设置


------解决方案--------------------
i try scm in command window
> scm -Action 7 -Service sqlserveragent -Pwd 222
it do nothing

------解决方案--------------------
LZ很明显~~不给面子...