SQL Server 尝试启动代理时崩溃

本文介绍在 SQL Server 实例中创建多个作业时 SQL Server 代理服务遇到的问题。

原始产品版本: SQL Server
原始 KB 数: 2795690

现象

尝试启动 SQL Server 代理或启动时间超过预期时,SQL Server 代理会崩溃。 此外,可能会遇到以下一个或多个方案:

  • 方案 1:系统事件日志中记录了以下错误消息:

    该服务没有及时响应启动或控制请求。

  • 方案 2:代理的状态在控制面板显示为“正在启动”,SQLAgent.log文件中记录了以下错误消息:

    尚未定义空闲 CPU 条件 - OnIdle 作业计划将不起作用。

    此外,可以在SQLAgent.log文件中记录以下条目:

    <Time Stamp> - ? [431] Populating subsystems cache... \
    <Time Stamp> - ? [432] There are 7 subsystems in the subsystems cache \
    <Time Stamp> - ? [124] Subsystem 'ActiveScripting' successfully loaded (maximum concurrency: 40)\
    <Time Stamp> - ? [124] Subsystem 'ANALYSISCOMMAND' successfully loaded (maximum concurrency: 400)\
    <Time Stamp> - ? [124] Subsystem 'ANALYSISQUERY' successfully loaded (maximum concurrency: 400)\
    <Time Stamp> - ? [124] Subsystem 'CmdExec' successfully loaded (maximum concurrency: 40)\
    <Time Stamp> - ? [124] Subsystem 'PowerShell' successfully loaded (maximum concurrency: 2)\
    <Time Stamp> - ? [124] Subsystem 'SSIS' successfully loaded (maximum concurrency: 400)\
    <Time Stamp> - ? [124] Subsystem 'TSQL' successfully loaded (maximum concurrency: 80)\
    <Time Stamp> - ! [364] The Messenger service has not been started - NetSend notifications will not be sent\
    <Time Stamp> - ? [129] SQLSERVERAGENT starting under Windows NT service control\
    <Time Stamp> - + [396] An idle CPU condition has not been defined - OnIdle job schedules will have no effect\
    <Time Stamp> - ? [110] Starting SQLServerAgent Monitor using '' as the notification recipient...\
    <Time Stamp> - ? [146] Request servicer engine started\
    <Time Stamp> - ? [133] Support engine started\
    <Time Stamp> - ? [167] Populating job cache...\
    <Time Stamp> - ? [131] SQLSERVERAGENT service stopping due to a stop request from a user, process, or the OS...\
    <Time Stamp> - ? [134] Support engine stopped\
    <Time Stamp> - ? [197] Alert engine stopped\
    <Time Stamp> - ? [168] There are 4731 job(s) [0 disabled] in the job cache\
    <Time Stamp> - ? [170] Populating alert cache...\
    <Time Stamp> - ? [171] There are 0 alert(s) in the alert cache\
    <Time Stamp> - ? [149] Request servicer engine stopped\
    <Time Stamp> - ? [248] Saving NextRunDate/Times for all updated job schedules...\
    <Time Stamp> - ? [249] 0 job schedule(s) saved\
    <Time Stamp> - ? [127] Waiting for subsystems to finish...\
    <Time Stamp> - ? [128] Subsystem 'ActiveScripting' stopped (exit code 1)\
    <Time Stamp> - ? [128] Subsystem 'ANALYSISCOMMAND' stopped (exit code 1)\
    <Time Stamp> - ? [128] Subsystem 'ANALYSISQUERY' stopped (exit code 1)\
    <Time Stamp> - ? [128] Subsystem 'CmdExec' stopped (exit code 1)\
    <Time Stamp> - ? [128] Subsystem 'PowerShell' stopped (exit code 1)\
    <Time Stamp> - ? [128] Subsystem 'SSIS' stopped (exit code 1)\
    <Time Stamp> - ? [175] Job scheduler engine stopped\
    
  • 方案 3:数据库引擎服务器显示“SQLAgent - 泛型刷新器”服务中的 SQL Server 进程 ID(SPID)。 此外,以下作业显示为在 SPID 的输入缓冲区中运行:

EXECUTE msdb.dbo.sp_sqlagent_refresh_job

注意

SPID 处于 RUNNABLE 状态,并定期等待 PREEMPTIVE_OS_LOOKUPACCOUNTSID 等待类型,或者 SPID 处于等待类型的等待状态 ASYNC_NETWORK_IO

原因

出现此问题的原因是 SQL Server 中存在多个作业条目。

注意

如果在 Reporting Services Configuration Manager 中无意中为报表设置了多个订阅,则也会出现问题。

解决方法

若要解决此问题,请删除不需要的作业。

注意

如果由于无意中设置了许多订阅而存在许多作业条目,请使用 Reporting Services Configuration Manager 删除不必要的订阅。

详细信息