我先把问题描述一下
企业管理器中其他用户都删除了!!!只有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服务是不是还有别的参数可以用来修改设置的?

解决方案 »

  1.   

    服务里选择SQLSERVERAGENT 启动账号
      

  2.   

    操作系统下的服务里选择的也只是启动服务的账户吧
    agent服务连接sqlserver服务的id和password还是设不了吧
      

  3.   

    呵呵,不知这个对楼主有没有帮助
    http://support.microsoft.com/kb/230236/zh-cnSQL 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 产品中存在问题。
      

  4.   

    谢谢gc_ding
    我按你说的做了,还是不行
    可能是我的参数不对
    我在帖子上面已经把语句写出来了,其中的sqlca.LogPass是sa的密码
    帮我检查一下
      

  5.   

    启动这个服务需要双重认证,一是os,二是sql,不知道怎么办了
      

  6.   

    zheninchangjiang(徐若涵) 
    启动这个服务需要双重认证,一是os,二是sql,不知道怎么办了主要难在后者
    我觉得SQLDMO有方法解决
    但查了很久也找不到
    网上也只有SQLDMO备份还原DB的例子
      

  7.   

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