Search This Blog

Saturday, March 19, 2011

Oracle RAC 10g Manage Server-Side Callouts

In Oracle 10g RAC, every time a node , database , instance , service and etc. goes up or down, that event can be catched and used to make user defined callouts. So every time a state change occurs, a FAN event is posted to ONS immediately. When a node receives an event through ONS, it will asynchronously execute all executables in the server side callouts directory.

Callouts directory is under $CRS_HOME/racg/usrco

The example below creates a file in /home/oracle directory when the ocfs database is down. You can modify it with further functionality i.e. send mail to administrator people etc.

create the file parseCallout.sh under the $CRS_HOME/racg/usrco
chmod +x parseCallout.sh

#!/bin/sh
NOTIFY_EVENTTYPE=$1
echo $NOTIFY_EVENTTYPE
for ARCS in $*; do
PROPERTY=`echo $ARCS | awk -F"=" '{print $1}'`
echo $PROPERTY
VALUE=`echo $ARCS | awk -F"=" '{print $2}'`
echo $VALUE
case $PROPERTY in
VERSION|version)
NOTIFY_VERSION=$VALUE ;;
SERVICE|service)
NOTIFY_SERVICE=$VALUE ;;
DATABASE|database)
NOTIFY_DATABASE=$VALUE ;;
INSTANCE|instance)
NOTIFY_INSTANCE=$VALUE ;;
HOST|host)
NOTIFY_HOST=$VALUE ;;
STATUS|status)
NOTIFY_STATUS=$VALUE ;;
REASON|reason)
NOTIFY_REASON=$VALUE ;;
CARD|card)
NOTIFY_CARDINALITY=$VALUE ;;
TIMESTAMP|timestamp)
NOTIFY_LOGDATE=$VALUE ;;
??:??:??)
NOTIFY_LOGTIME=$PROPERTY ;;
esac
done
if ([ "$NOTIFY_STATUS" == "down" ] && [ "$NOTIFY_DATABASE" == "ocfs" ]) then
echo "$NOTIFY_DATABASE is down, please investigate ... " > /home/oracle/"$NOTIFY_LOGDATE".callout
fi