[Linux-cluster] agent scripts

Allyson - Listas orcl.listas at gmail.com
Sat Mar 18 04:55:00 UTC 2006


Hi Guys,

I'd like your help in one question on rhcs 4 up 3.

I'm working on my scripts to start/stop/monitoring a failover oracle 
9.2.0.6 database.
I created a new service and added a filesystem, ip and script resources.

There is a cookbook or something that shows requirements of development 
of the cluster scripts?
 
I'm having problems to start my service ...
When I try to enable...

[root at cs02 ora9i]# clustat
Member Status: Quorate

  Member Name                              Status
  ------ ----                              ------
  cs02.example.com                         Online, Local, rgmanager
  cs01.example.com                         Online, rgmanager

  Service Name         Owner (Last)                   State
  ------- ----         ----- ------                   -----
  vip50                cs02.example.com               started
  oracle-ha-fs         cs02.example.com               started
  ora9i-ha             (cs02.example.com)             failed
  clu9i                (none)                         stopped
[root at cs02 ora9i]# clusvcadm -e clu9i
Member cs02.example.com trying to enable clu9i...failed

I receive these messages...

Mar 18 01:59:12 cs02 clurgmgrd[2315]: <notice> Starting stopped service 
clu9i
Mar 18 01:59:12 cs02 clurgmgrd[2315]: <notice> start on script "clu9i" 
returned 5 (program not installed)
Mar 18 01:59:12 cs02 clurgmgrd[2315]: <warning> #68: Failed to start 
clu9i; return value: 1
Mar 18 01:59:12 cs02 clurgmgrd[2315]: <notice> Stopping service clu9i
Mar 18 01:59:12 cs02 clurgmgrd[2315]: <notice> stop on script "clu9i" 
returned 5 (program not installed)
Mar 18 01:59:12 cs02 clurgmgrd[2315]: <notice> Service clu9i is recovering
Mar 18 01:59:12 cs02 clurgmgrd[2315]: <warning> #71: Relocating failed 
service clu9i
Mar 18 01:59:13 cs02 clurgmgrd[2315]: <notice> Stopping service clu9i
Mar 18 01:59:13 cs02 clurgmgrd[2315]: <notice> stop on script "clu9i" 
returned 5 (program not installed)
Mar 18 01:59:13 cs02 clurgmgrd[2315]: <notice> Service clu9i is stopped

I think strange the return code 5 logged on /var/log/messages, because 
my script works well manually...

[root at cs02 ora9i]# ps -ef |grep pmon | grep -v grep
[root at cs02 ora9i]#
[root at cs02 ora9i]#
[root at cs02 ora9i]# ./ora_clu9i start
starting ora_clu9i...
[root at cs02 ora9i]# ps -ef |grep pmon | grep -v grep
ora9i     7934     1  0 02:06 ?        00:00:00 ora_pmon_clu9i
[root at cs02 ora9i]# ./ora_clu9i status
clu9i is running
[root at cs02 ora9i]# ./ora_clu9i stop
stopping ora_clu9i...
[root at cs02 ora9i]# ps -ef |grep pmon | grep -v grep
[root at cs02 ora9i]# ./ora_clu9i status
clu9i is stopped



Here's my script...

#### Oracle Environment ####
export LD_ASSUME_KERNEL=2.4.19
export ORACLE_BASE=/u01/ora9i
export ORACLE_HOME=$ORACLE_BASE/product/9.2.0
export ORACLE_SID=clu9i
export ORACLE_TERM=xterm
export NLS_LANG=AMERICAN;
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH
export PATH=$PATH:$ORACLE_HOME/bin
####

prog="ora_clu9i"

start () {
echo "starting $prog..."

su - ora9i -c "$ORACLE_HOME/bin/sqlplus '/ as sysdba' > /dev/null  <<eof
startup
quit
eof
"
su - ora9i -c "lsnrctl start > /dev/null"

return 0

}

stop () {
echo "stopping $prog..."

su - ora9i -c "$ORACLE_HOME/bin/sqlplus '/ as sysdba' > /dev/null  <<eof
shutdown immediate
quit
eof
"
su - ora9i -c "lsnrctl stop > /dev/null"

return 0
}

status() {
 if [ -r /tmp/orastat ]; then
      rm /tmp/orastat ;
 fi

sqlplus /nolog <<eof > /tmp/orastat
conn hr/hr
quit
eof

DOWN=`grep -i error /tmp/orastat | grep -v grep | wc -l`

if [ $DOWN -gt 0 ]; then
    echo $ORACLE_SID is stopped;
    return 0
else
    echo $ORACLE_SID is running;
    return 1
fi
}

case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
status)
        status
        ;;
*)
        echo $"Usage: $0 {start|stop|status}"
        exit 1
esac





More information about the Linux-cluster mailing list