I'm configuring the boot sequence on a Linux box, and one of the startup applications is dependent upon an Oracle instance being available on a different box. I would like a bash scriptable tool to check the availability of the Oracle instance. Likely, the power button on both boxes will have been hit within seconds of each other, and I need the longer Oracle process to finish before my application attempts to connect.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
The only way to be sure that the remote database is up and that the listener is up and that the database is registered with the listener properly would be to actually make a connection. You could use the SQL*Plus utility (assuming the Oracle client is installed on the linux box your application runs on) to attempt to make a connection. Something like
Create a file check_db_up.sql
Then invoke this script in your bash shell script and look at the return code
If that returns 1, there was an error and the database isn't up. If it returns a 0, the database is up and accepting connections.