Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: starting the database

Re: starting the database

From: stephen booth <stephenbooth.uk_at_gmail.com>
Date: Mon, 1 May 2006 16:39:17 +0100
Message-ID: <687bf9c40605010839x5cd015a3kbcecfa6b06c36754@mail.gmail.com>


On 01/05/06, Fred Smith <fred_fred_1_at_hotmail.com> 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/
--
http://www.freelists.org/webpage/oracle-l
Received on Mon May 01 2006 - 10:39:17 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US