Re: Unix script to check database status

  • From: Jared.Still@xxxxxxxxxxx
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 9 Mar 2004 22:06:36 -0800

There are at least two drawbacks to this method.

1) You must run the script from the server, so that your scripts must run
on every database server.  It is much more efficient to do this from a 
single server.

2) related to 1.  This does not test sqlnet.

Just food for thought.

Jared






"Ryan" <ryan.gaffuri@xxxxxxx>
Sent by: oracle-l-bounce@xxxxxxxxxxxxx
 03/09/2004 02:23 PM
 Please respond to oracle-l

 
        To:     <oracle-l@xxxxxxxxxxxxx>
        cc: 
        Subject:        Re: Unix script to check database status


ls -l | grep pmon

then cut out the database name. You will also want to attempt to log in as
follows

sqlplus -s / << EOF > $TEMPFILE
   select 1
   from dual;
EOF
if [ ! $? -eq 0]; them
   send $TEMPFILE to yourself in an email.
fi
delete $TEMPFILE
You are probably going to want to start creating an architecture for this,
since as time goes on you will want to add more and more stuff(such as
checking the alert log, testing queries and query plans, segments and
tablespace stuff as well... )

So I recommend the following

1. scripts to create a tempfile, delete a tempfile, and concatenate stuff
into your tempfile(these are like 5 lines each).
2. A wrapped email script with a flag for success, failure, and warning
3. An email list with emails of who gets what. For example

DATABASE CHECK [1] michael@xxxxxxxxxxx ryan@xxxxxxxxxxx

Then your scripts can grep for that with the status(1 is for failure) and
send the appropriate email.

From here you can plug into your architecture. This will make your life
easier.
----- Original Message ----- 
From: "Michael Milligan" <Michael.Milligan@xxxxxxxxxxx>
To: <oracle-l@xxxxxxxxxxxxx>
Sent: Tuesday, March 09, 2004 3:29 PM
Subject: Unix script to check database status


> Hi,
>
> I have to write an HP-UX Korn shell script to check the status of 20
> databases - up or down - and send an email if any are down. I'm a 
relative
> newbie at Unix. I'm not asking anyone to "do it for me", but does anyone
> know of any scripts to check database status by greping or otherwise
looking
> at the oratab or other file and checking the status?
>
> Thanks,
>
> Mike
>
>
> This e-mail, including attachments, may include confidential and/or
> proprietary information, and may be used only by the person or entity to
> which it is addressed. If the reader of this e-mail is not the intended
> recipient or his or her authorized agent, the reader is hereby notified
that
> any dissemination, distribution or copying of this e-mail is prohibited.
If
> you have received this e-mail in error, please notify the sender by
replying
> to this message and delete this e-mail immediately.
> ----------------------------------------------------------------
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> ----------------------------------------------------------------
> To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
> put 'unsubscribe' in the subject line.
> --
> Archives are at //www.freelists.org/archives/oracle-l/
> FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
> -----------------------------------------------------------------

----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to:  oracle-l-request@xxxxxxxxxxxxx
put 'unsubscribe' in the subject line.
--
Archives are at //www.freelists.org/archives/oracle-l/
FAQ is at //www.freelists.org/help/fom-serve/cache/1.html
-----------------------------------------------------------------


Other related posts: