none
How to check if Server is up and running

    Question

  • Hi,

    I am skilled Oracle DBA and recently started to support MS SQL Server 2000

    .

    For all my Oracle DBs I run "Watch Dog" script that test if database ( server for MS SQL Server) is up and running and send me message on pager or by E-mail if it is down.

    MY QUESTION IS:

    How to do similar actions for MS SQL SERVER 2000?

     

    Thanks in advance,

     

    Michael Fradkov

     

    Tuesday, August 29, 2006 2:35 PM

Answers

  • I would use a SQL Server monitoring tool.  I like and use SQL Diagnostic Manager from Idera, but there are many others on the market(Some are free!!).  It allows you to monitor the up/down status as well as numerous other performance/problem condition and has a variety of notification selections.  You could also write a simple VBScript that runs and connects to the database on a scheduled basis and notify you if it is down.  Do some Google searching for 'SQL Server monitoring' and Good Luck...

    Brad
    Thursday, September 14, 2006 8:09 PM

All replies

  • I would use a SQL Server monitoring tool.  I like and use SQL Diagnostic Manager from Idera, but there are many others on the market(Some are free!!).  It allows you to monitor the up/down status as well as numerous other performance/problem condition and has a variety of notification selections.  You could also write a simple VBScript that runs and connects to the database on a scheduled basis and notify you if it is down.  Do some Google searching for 'SQL Server monitoring' and Good Luck...

    Brad
    Thursday, September 14, 2006 8:09 PM
  • Thanks,

    I have found and evaluate the following free product:

    Product : Applications Manager
    Build Number : 7001
    Service Pack : None
    License Type : Free Edition
    Number of Monitor(s) : 7
    Named User(s) : 1
    Expires on : Never

    Wednesday, September 20, 2006 8:56 PM
  • Please find the below code to check whether SQL Server is running or not.

    Add System.ServiceProcess references.

    public bool CheckSQLServerRunning()

    {

    bool mSqlServerRunning;

    System.ServiceProcess.ServiceController serviceController1;

    serviceController1 = new System.ServiceProcess.ServiceController("ServiceName", "ComputerName");

    mSqlServerRunning = (serviceController1.Status == System.ServiceProcess.ServiceControllerStatus.Running);

    if (!mSqlServerRunning)

    {

    MessageBox.Show("SQL Server is installed but the service is not running");

    return  "false"

    }

    else

    {

    MessageBox.Show("SQL Server is installed and the service is running");

    return  "true"

    }

    }

    Thanks

    Satish

    Tuesday, October 10, 2006 7:06 AM
  • That's true when the service is up and running.
    The problem with this aproach appears when the server is down. Then you will get time out exception. Now you can wait for the exception and catch it, but this will take a while.
    Monday, September 29, 2008 3:58 PM