Groups | Blog | Home
all groups > sql server (alternate) > september 2004 >

sql server (alternate) : server heartbeat function


emebohw NO[at]SPAM netscape.net
9/27/2004 1:06:24 PM
Hi all. I have a simple vbs script I use to connect to sql server, try
and read from a table, and if it fails notify me that the sql server
might be down. Works fine in its very simple way, but what I am
wondering is if I should try and connect to one table from every
specific database on the server? Is it possible for one database on
this server to be up, say for instance the master db and one of my
user db's to not be up? Just wondering about false positives and if I
should test deeper.

Not trying to make it to complicated, it really is the equivanlent of
Andrey
9/28/2004 2:00:54 AM
[quoted text, click to view]

Well, from my understanding, database can't be up/down - that's the server's "feature".
So i guess that you just need to try to connect to the sql server, not accessing any tables.
What i see as a hole in your approach is that if the table you check in a database is locked
by any other process(e.g. sometimes happens with tables linked to ms access), you will not get
access to the table and you get a false alarm.

Or, if you still want to check some tables, you better call a stored procedure from you vb script,
and the stored proc should make the checks and return the status - should be more secure and
reliable, i think.

But anyway, if you want to make it simple, just connect to the database without accessing any
tables, and disconnect - should be more or less reliable for this purpose.

WIGL,
L. Bertolini
9/28/2004 12:51:15 PM
As an alternative to doing a query from every database,
you could examine master.dbo.sysdatabases; specifically,
check the status column. (Books online describes this
table.) You could determine if the database is offline,
in single-user mode, dbo-only mode, etc.

[quoted text, click to view]
AddThis Social Bookmark Button