Hi there

We have a utility that returns certain criteria after checking that a DB is running. The trouble with this is that if the DB is not running it takes forever to return the error 'Database server not found'

SELECT COUNT(*) as Status FROM sa_db_list() WHERE db_name(Number) = 'MyDBName'

If there a faster method, preferably a Boolean, to determine if the DB is running without throwing an error?

asked 03 Mar '20, 11:47

gchq's gravatar image

gchq
321262936
accept rate: 28%

1

Have you checked the dbping and dblocate utilities?

(03 Mar '20, 12:18) Volker Barth

DBLocate appears to just return a list of local servers/databases

DBPing looks promising though :-)

Thank you

(03 Mar '20, 12:27) gchq
Replies hidden

DBLocate appears to just return a list of local servers/databases

No, it also lists databases in the immediate network, and I guess via the dbns utility, it could also do so within different subnets.

Also dblocate can list databases on a specified host, too, so this should also help to check whether a database is running or not. But it does not check whether you can connect to it, say, it may have set up to temporarily disallow new connections.

(03 Mar '20, 14:56) Volker Barth
1

FWIW Foxhound's custom C "ping" process works like this: It adds AutoStop=NO; AutoStart=NO; CPOOL=NO; to the connection string, then runs EXEC SQL CONNECT USING :connection_string;

The purpose is to determine if the target database is accepting connections or not, and it seems to fail right away if the answer is "no"... but that's not exactly the same as your question "is the DB running?"

(04 Mar '20, 14:07) Breck Carter
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×231

question asked: 03 Mar '20, 11:47

question was seen: 725 times

last updated: 04 Mar '20, 14:07