Re: starting the database

  • From: "stephen booth" <stephenbooth.uk@xxxxxxxxx>
  • To: fred_fred_1@xxxxxxxxxxx
  • Date: Mon, 1 May 2006 16:39:17 +0100

On 01/05/06, Fred Smith <fred_fred_1@xxxxxxxxxxx> wrote:

I'm looking to make a cronjob that will every 5 minutes check if the
database is up, and if not, start it. Does anyone have a script that does
this available?

Thanks.


I normally check for pmon using pf -ef with the output piped through grep, check the exit state of grep, using an if statement, to check if the process was found.

You'll need to read the man page for grep on your OS as the meaning of
exit status varies from version to version.  For some an exit state
of 0 means "One or more matches found" (non-zero meaning "No matches
found or an error occured"), for others the exit state is the number
of matches found (so zero would be no matches).

I have a script that does this but don't have access to it today (I'm
not in the office, today is a national holiday).  The script I have
sends an email notifying us that the database is down rather than
trying to restart it.  If the database is down then I want to know
why, it might be down for legitmate reasons (cold backup, maintence
work &c) or there might be a problem and trying to restart the
database might cause things to get worse.  I'd rather spend 5 minutes
checking there's no underlying problem than 3 days fixing what was a
small problem but became a lot worse.

Stephen

--
It's better to ask a silly question than to make a silly assumption.

http://stephensorablog.blogspot.com/
--
//www.freelists.org/webpage/oracle-l


Other related posts: