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: Is the database up? script request

RE: Is the database up? script request

From: James Bullard <jbullard_at_onvia.com>
Date: Fri, 1 Sep 2000 14:34:00 -0700
Message-Id: <10606.116104@fatcity.com>


Here is something that I use. There is a database that is "cloned" every night, and this checks after the whole refresh/rename process to make sure that things went smoothly. Obviously there is a lot of cutting and pasting to do, but I think you'll get the idea. I am sure that there are plenty of others that are a lot better, but this works for me.

HTH,
James
#!/bin/ksh
############################################################################
###
# Script Name : CheckDbstatus
#
# Author : James Bullard
#
############################################################################
###
# REMOVE THE STATUS FILE IF IT EXISTS
if [[ -s "$ORACLE_HOME/dr/log/dbsatus.bad" ]]; then  rm $ORACLE_HOME/dr/log/dbsatus.bad
fi

if [[ -s "$ORACLE_HOME/dr/log/clonedbopen.log" ]]; then rm $ORACLE_HOME/dr/log/clonedbopen.log
fi

rm open_mode.lst

ONVIA_HOME= your_file_system
ONVIA_ACCOUNT=sys
ONVIA_PASSWORD=$(grep PASSWORD $ONVIA_HOME/secure_file.dat | grep -i
$ORACLE_SID |grep -i $ONVIA_ACCOUNT |awk -F: '{print $4}' )

sqlplus -s $ONVIA_ACCOUNT/$ONVIA_PASSWORD@$ORACLE_SID<<SQLEOF set heading off
set feedback off
set pagesize 0
spool open_mode.lst
select open_mode, name
from v\$database;
SQLEOF OPENMODE=$(awk '{print $1, $2}' open_mode.lst) DBNAME=$(awk '{print $3}' open_mode.lst) time_refreshed=`date '+DATE: %m/%d/%y%nTIME:%H:%M:%S'`

 if [[ "$OPENMODE" = "READ WRITE" && "$DBNAME" = "YOURDBNAME" ]]; then  echo "YOURDBNAME has been refreshed at $time_refreshed" > $ORACLE_HOME/dr/log/clonedbopen.log
  mailx -s "YOURDBNAME has been Refreshed" youremailid_at_domain <$ORACLE_HOME/dr/log/clonedbopen.log
 else
  echo "YOURDBNAME did not refresh!!" > $ORACLE_HOME/dr/log/dbstatus.bad   date >> $ORACLE_HOME/dr/log/dbstatus.bad  fi

 if [[ -s "$ORACLE_HOME/dr/log/dbstatus.bad" ]];  then
 mailx -s "ORACLE_SID trouble" pagernumber <$ORACLE_HOME/dr/log/dbstatus.bad  fi

-----Original Message-----
From: Steven Monaghan [mailto:MonaghaS_at_mscdirect.com] Sent: Friday, September 01, 2000 2:53 PM To: Multiple recipients of list ORACLE-L Subject: Is the database up? script request

My boss is looking for me to implement a process that will verify that the database and listener are up, and that users can connect to the database. I am a novice shell scripter (Just finished reading Teach Yourself UNIX Shell Programming in 14 Days two weeks ago :) I am developing ksh scripts to perform a bunch of other monitoring tasks as well (check alert log, check # users, next extent fail, etc). Basically, I need to make sure that the connection from the local machine uses the listener (otherwise not a valid test), that I select against a table and that my shell script traps and errors and mails them out.

I'm sure someone has done this already, and any ideas / on-line references / samples would be greatly appreciated,

TIA,
Steve Monaghan



Steven Monaghan
Oracle DBA
MSC Industrial Direct Co., Inc.
Melville, NY
MonaghaS_at_mscdirect.com
-- 
Author: Steven Monaghan
  INET: MonaghaS_at_mscdirect.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
Received on Fri Sep 01 2000 - 16:34:00 CDT

Original text of this message

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