Database monitoring

  • Hi all,

    I was wondering how to monitor a database to ensure it's up. I have scripts that perform stored procedure executions and they already check to make sure the database connection is made prior to executing anything. But if it fails, I'll simply quit the program. What software would you guys recommend to monitor and restore connections when it's down? Basically to always keep it up?

    Or loop in the script while the connection is still down, keep trying to restore?

    Thanks in advance.

  • ram302 (6/16/2016)


    Hi all,

    I was wondering how to monitor a database to ensure it's up. I have scripts that perform stored procedure executions and they already check to make sure the database connection is made prior to executing anything. But if it fails, I'll simply quit the program. What software would you guys recommend to monitor and restore connections when it's down? Basically to always keep it up?

    Or loop in the script while the connection is still down, keep trying to restore?

    Thanks in advance.

    What kind of scripts? If the server is down, what would a loop that keeps trying to connect solve?

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • The connection failures seem like hiccups. So the idea for looping was to loop for some time, and finally exit and notify if it fails to make the connection. And these are VBScripts.

  • Not sure that I ever had a database server get a case of the hiccups!

    My opinion would be to find the root cause, and fix that. Putting in a loop is a work around. Monitoring software may not catch the issue. They typically poll a server on a regular basis. If the hiccups occur just after the software polls, you have not solved anything.

    Is this a failure to connect to the server, or is it in the execution of the query?

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • Michael L John (6/16/2016)


    Not sure that I ever had a database server get a case of the hiccups!

    My opinion would be to find the root cause, and fix that. Putting in a loop is a work around. Monitoring software may not catch the issue. They typically poll a server on a regular basis. If the hiccups occur just after the software polls, you have not solved anything.

    Is this a failure to connect to the server, or is it in the execution of the query?

    It's a failure to open the connection to the database.

  • Just create a powershell script to connect to your DB and schedule it to run every X seconds and email you if it fails.

  • Do you know the root cause of the failure? Knowing when it fails is one thing. Like Michael said the real goal should be finding the root cause and fixing it.

  • Ed Wagner (6/17/2016)


    Do you know the root cause of the failure? Knowing when it fails is one thing. Like Michael said the real goal should be finding the root cause and fixing it.

    I don't know what the root cause may be. The DBA suggests flaky network that happens on occasion, and finds it acceptable enough. Lately, however, it's been more frequent.

  • Seems strange, it is probably something the DBA and/or Network engineer should be investigating instead of coding around it because it will only get worse when you scale out.

    I don't know anything about the environment and it could be any number of things, but have you checked for port exhaution?

    https://community.spiceworks.com/topic/337059-if-you-have-to-reboot-your-servers-often-its-probably-port-exhaustion

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

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