Service Status

  • Hi Guys,

    Do any of u perhaps know of a script that I can run to check whether the service status is running. When I right click on sql server agent, it opens the sql server agent properties. The service status shows nothing, it does not say running or anything.

    Can anyone pls help.

    Regards

  • to check if agent service is running. check for the spid 51 in sysprocesses table and if that shows SQL Generic refresher that really menas ur agent service is running. other way to find the same is using OS command net start and look for something like SQLSERVERAGENT.

    Cheers,
    Sugeshkumar Rajendran
    SQL Server MVP
    http://sugeshkr.blogspot.com

  • What do u mean by SQL Generic refresher. I checked out what spid 51 and there is a column called Status and it says runnable. Does this mean that the service status is running?

  • The NET START command (OS) will list started services

  • net start only works locally, the sc command in 'dos' will query any of the services or all of them, stop or start services. We used to use sc scripts to stop and start sql agent when our exchange server went down years ago.

    AW

  • whenever agent is started u will find a entry in the sysprocesses table with program_name like SQLAgent - Generic Refresher and not necessarily that your spid should be 51 it can be anything above 50 but if u have set ur agent to start automatically then it will be the first to make connection to ur sql server and have a spid of 51. just run this query to see if ur agent is running.

     

    select * from sysprocesses where program_name like '%ref%'

    if it results some row then ur agent is running else its stopped.

    Cheers,
    Sugeshkumar Rajendran
    SQL Server MVP
    http://sugeshkr.blogspot.com

  • thanks alot for ur help

  • Or...

    NETSVC "SQLServerAgent" \\servername /QUERY

    Can also use /STOP & /START with NETSVC

    (The service name in this query obviously relates to a SQL2000 service, just change the name appropriately)

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply