Alternate options to check if the SQL server is running

  • Hi all..

    What are the diff options to check the SQL server instance is running?

    Other then registering the server in management studio..

    The only access I have is to register the instance and work on it..

    Any other options which I can use from my system to check if the instance is running on other system?

    Thanks in advance

    Shree

  • There are many options, but here are a few.

    You can use the Computer Management utility to check if the service is running.

    You can use the SC command line utility from the windows resource kit:

    SC \\MyServerName query MSSQLSERVER

    SERVICE_NAME: MSSQLSERVER

    TYPE : 10 WIN32_OWN_PROCESS

    STATE : 4 RUNNING

    (STOPPABLE,PAUSABLE,ACCEPTS_SHUTDOWN)

    WIN32_EXIT_CODE : 0 (0x0)

    SERVICE_EXIT_CODE : 0 (0x0)

    CHECKPOINT : 0x0

    WAIT_HINT : 0x0

    You can use the OSQL or SQLCMD command line utility to attempt to run a query.

    osql -S MyServerName -E -Q "set nocount on;select SQLAgent_count = count(*) from master.dbo.sysprocesses where program_name like 'SQLAgent%'"

    SQLAgent_count

    --------------

    4

    You could use a WMI script to check the status of the service.

  • Keep in mind the service names can be different depending on the instance name.

    What are you trying to accomplish? A generic to check? The services manage themselves and you can have them alert you if they go down (or restart themselves).

  • Hi steve..

    I am trying to check if the SQL server is running on Comp B from A...

    Both the servers are one same domain....

    What are my options from Server A??

    Shree

  • just write a batch to check on the services, you will have to hard code but should be fine after that.

    Cant remember the sytax but the util comes from sysinternals.

    HTH

    Adam Zacks-------------------------------------------Be Nice, Or Leave

Viewing 5 posts - 1 through 4 (of 4 total)

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