Guenadi N Jilevski's Oracle BLOG

Oracle RAC, DG, EBS, DR and HA DBA BLOG

Using Oracle 11g R1 CRS clusterware with third party non-Oracle applications

Using Oracle 11g R1 CRS clusterware with third party non-Oracle applications (xclock)

We create a script x.sh in /usr/bin on each node of the cluster with content as specified below.  The script is an action program – an executable to start/stop/check the application.

Content of x.sh

#!/bin/bash

# start/stop/check script for xclock example

# To test this change BIN_DIR to the directory where xclock is based

# and set the DISPLAY variable to a server within your network.

BIN_DIR=/usr/bin

LOG_DIR=/tmp

BIN_NAME=xclock

#DISPLAY=yourhost.domain.com:0.0

#export DISPLAY

if [ ! -d $BIN_DIR ]

then

echo “start failed”

exit 2

fi

PID1=`ps -ef | grep $BIN_NAME | grep -v grep | grep -v xclock_app | awk ‘{ print $2 }’`

case $1 in

‘start’)

if [ “$PID1” != “” ]

then

status_p1=”running”

else

if [ -x $BIN_DIR/$BIN_NAME  ]

then

umask 002

${BIN_DIR}/${BIN_NAME} & 2>${LOG_DIR}/${BIN_NAME}.log

status_p1=”started”

else

echo `basename $0`”: $BIN_NAME: Executable not found”

fi

fi

echo “$BIN_NAME: $status_p1”

;;

‘stop’)

if [ “${PID1}” != “” ]

then

kill -9 ${PID1} && echo “$BIN_NAME daemon killed”

else

echo “$BIN_NAME: no running Process!”

fi

;;

‘check’)

if [ “$PID1” != “” ]

then

echo “running”

exit 0

else

echo “not running”

exit 1

fi

;;

*)

echo “Usage: “`basename $0`” {start|stop|check}”

;;

Esac

An application profile should be added to the OCR. The main attributes are

Action Program – an executable to start/stop/check the application

Privileges – which user can start/stop the application

Resource – a resource name for your application

  1. Creating the profile

[root@raclinux1 bin]# ./crs_profile -create xclock_crs -t application -dir ./ -a /usr/bin/x.sh -r ora.raclinux1.vip

[root@raclinux1 bin]#ll

-rw-r–r– 1 root   root          758 Dec 26 10:54 xclock_crs.cap

[root@raclinux1 bin]#

[root@raclinux1 bin]# chown oracle:oinstall xclock_crs.ca

[root@raclinux1 bin]#ll

-rw-r–r– 1 oracle oinstall      758 Dec 26 10:54 xclock_crs.cap

  1. Registering the profile

[root@raclinux1 bin]# ./crs_register xclock_crs -dir ./

  1. Checking the status of the resource

[root@raclinux1 bin]# ./crs_stat | grep -A5 xclock

NAME=xclock_crs

TYPE=application

TARGET=OFFLINE

STATE=OFFLINE

  1. Setting the permissions and setting the owner

[root@raclinux1 bin]# ./crs_setperm xclock_crs -o root

[root@raclinux1 bin]# ./crs_setperm xclock_crs -u user:oracle:r-x

  1. Checking the state

[root@raclinux1 bin]# ./crs_stat.sh

HA Resourrce                                  Target     Stage

————                                  ——     —–

ora.VIS.VIS1.inst                             ONLINE     ONLINE on raclinux1

ora.VIS.VIS2.inst                             ONLINE     ONLINE on raclinux2

ora.VIS.db                                    ONLINE     ONLINE on raclinux2

ora.raclinux1.ASM1.asm                        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER1_RACLINUX1.lsnr        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_RACLINUX1.lsnr         ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_VIS_RACLINUX1.lsnr     ONLINE     ONLINE on raclinux1

ora.raclinux1.gsd                             ONLINE     ONLINE on raclinux1

ora.raclinux1.ons                             ONLINE     ONLINE on raclinux1

ora.raclinux1.vip                             ONLINE     ONLINE on raclinux1

ora.raclinux2.ASM2.asm                        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER1_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER2_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_RACLINUX2.lsnr         ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_VIS_RACLINUX2.lsnr     ONLINE     ONLINE on raclinux2

ora.raclinux2.gsd                             ONLINE     ONLINE on raclinux2

ora.raclinux2.ons                             ONLINE     ONLINE on raclinux2

ora.raclinux2.vip                             ONLINE     ONLINE on raclinux2

xclock_crs                                    OFFLINE    OFFLINE

  1. Starting the resource

[root@raclinux1 bin]# ./crs_start xclock_crs

Attempting to start `xclock_crs` on member `raclinux1`

Start of `xclock_crs` on member `raclinux1` succeeded.

[root@raclinux1 bin]# ./crs_stat.sh

HA Resourrce                                  Target     Stage

————                                  ——     —–

ora.VIS.VIS1.inst                             ONLINE     ONLINE on raclinux1

ora.VIS.VIS2.inst                             ONLINE     ONLINE on raclinux2

ora.VIS.db                                    ONLINE     ONLINE on raclinux1

ora.raclinux1.ASM1.asm                        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER1_RACLINUX1.lsnr        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_RACLINUX1.lsnr         ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_VIS_RACLINUX1.lsnr     ONLINE     ONLINE on raclinux1

ora.raclinux1.gsd                             ONLINE     ONLINE on raclinux1

ora.raclinux1.ons                             ONLINE     ONLINE on raclinux1

ora.raclinux1.vip                             ONLINE     ONLINE on raclinux1

ora.raclinux2.ASM2.asm                        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER1_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER2_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_RACLINUX2.lsnr         ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_VIS_RACLINUX2.lsnr     ONLINE     ONLINE on raclinux2

ora.raclinux2.gsd                             ONLINE     ONLINE on raclinux2

ora.raclinux2.ons                             ONLINE     ONLINE on raclinux2

ora.raclinux2.vip                             ONLINE     ONLINE on raclinux1

xclock_crs                                    ONLINE     ONLINE on raclinux1

  1. Stopping the resource

[root@raclinux1 bin]# ./crs_stop xclock_crs

Attempting to stop `xclock_crs` on member `raclinux1`

Killed

[root@raclinux1 bin]# ./crs_stat.sh

HA Resourrce                                  Target     Stage

————                                  ——     —–

ora.VIS.VIS1.inst                             ONLINE     ONLINE on raclinux1

ora.VIS.VIS2.inst                             ONLINE     ONLINE on raclinux2

ora.VIS.db                                    ONLINE     ONLINE on raclinux1

ora.raclinux1.ASM1.asm                        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER1_RACLINUX1.lsnr        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_RACLINUX1.lsnr         ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_VIS_RACLINUX1.lsnr     ONLINE     ONLINE on raclinux1

ora.raclinux1.gsd                             ONLINE     ONLINE on raclinux1

ora.raclinux1.ons                             ONLINE     ONLINE on raclinux1

ora.raclinux1.vip                             ONLINE     ONLINE on raclinux1

ora.raclinux2.ASM2.asm                        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER1_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER2_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_RACLINUX2.lsnr         ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_VIS_RACLINUX2.lsnr     ONLINE     ONLINE on raclinux2

ora.raclinux2.gsd                             ONLINE     ONLINE on raclinux2

ora.raclinux2.ons                             ONLINE     ONLINE on raclinux2

ora.raclinux2.vip                             ONLINE     ONLINE on raclinux2

xclock_crs                                    OFFLINE    OFFLINE

[root@raclinux1 bin]#

  1. Failover

8.1          xclock and the VIP running on raclinux1

[root@raclinux1 bin]# ./crs_stat.sh

HA Resourrce                                  Target     Stage

————                                  ——     —–

ora.VIS.VIS1.inst                             ONLINE     ONLINE on raclinux1

ora.VIS.VIS2.inst                             ONLINE     ONLINE on raclinux2

ora.VIS.db                                    ONLINE     ONLINE on raclinux1

ora.raclinux1.ASM1.asm                        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER1_RACLINUX1.lsnr        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_RACLINUX1.lsnr         ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_VIS_RACLINUX1.lsnr     ONLINE     ONLINE on raclinux1

ora.raclinux1.gsd                             ONLINE     ONLINE on raclinux1

ora.raclinux1.ons                             ONLINE     ONLINE on raclinux1

ora.raclinux1.vip                             ONLINE     ONLINE on raclinux1

ora.raclinux2.ASM2.asm                        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER1_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER2_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_RACLINUX2.lsnr         ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_VIS_RACLINUX2.lsnr     ONLINE     ONLINE on raclinux2

ora.raclinux2.gsd                             ONLINE     ONLINE on raclinux2

ora.raclinux2.ons                             ONLINE     ONLINE on raclinux2

ora.raclinux2.vip                             ONLINE     ONLINE on raclinux2

xclock_crs                                    ONLINE     ONLINE on raclinux1

[root@raclinux1 bin]#

8.2          Now we will pull the network cable from raclinux1. The xclock application and the VIP go offline.

[root@raclinux1 bin]# ./crs_stat.sh

HA Resourrce                                  Target     Stage

————                                  ——     —–

ora.VIS.VIS1.inst                             ONLINE     ONLINE on raclinux1

ora.VIS.VIS2.inst                             ONLINE     ONLINE on raclinux2

ora.VIS.db                                    ONLINE     ONLINE on raclinux1

ora.raclinux1.ASM1.asm                        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER1_RACLINUX1.lsnr        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_RACLINUX1.lsnr         ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_VIS_RACLINUX1.lsnr     ONLINE     ONLINE on raclinux1

ora.raclinux1.gsd                             ONLINE     ONLINE on raclinux1

ora.raclinux1.ons                             ONLINE     ONLINE on raclinux1

ora.raclinux1.vip                             ONLINE     OFFLINE

ora.raclinux2.ASM2.asm                        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER1_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER2_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_RACLINUX2.lsnr         ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_VIS_RACLINUX2.lsnr     ONLINE     ONLINE on raclinux2

ora.raclinux2.gsd                             ONLINE     ONLINE on raclinux2

ora.raclinux2.ons                             ONLINE     ONLINE on raclinux2

ora.raclinux2.vip                             ONLINE     ONLINE on raclinux2

xclock_crs                                    ONLINE     OFFLINE

8.3          The  xclock  application and VIP go online on node 2

[root@raclinux1 bin]# ./crs_stat.sh

HA Resourrce                                  Target     Stage

————                                  ——     —–

ora.VIS.VIS1.inst                             ONLINE     OFFLINE

ora.VIS.VIS2.inst                             ONLINE     OFFLINE

ora.VIS.db                                    ONLINE     OFFLINE

ora.raclinux1.ASM1.asm                        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER1_RACLINUX1.lsnr        ONLINE     OFFLINE

ora.raclinux1.LISTENER_RACLINUX1.lsnr         ONLINE     OFFLINE

ora.raclinux1.LISTENER_VIS_RACLINUX1.lsnr     ONLINE     OFFLINE

ora.raclinux1.gsd                             ONLINE     ONLINE on raclinux1

ora.raclinux1.ons                             ONLINE     ONLINE on raclinux1

ora.raclinux1.vip                             ONLINE     ONLINE on raclinux2

ora.raclinux2.ASM2.asm                        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER1_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER2_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_RACLINUX2.lsnr         ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_VIS_RACLINUX2.lsnr     ONLINE     ONLINE on raclinux2

ora.raclinux2.gsd                             ONLINE     ONLINE on raclinux2

ora.raclinux2.ons                             ONLINE     ONLINE on raclinux2

ora.raclinux2.vip                             ONLINE     ONLINE on raclinux2

xclock_crs                                    ONLINE     ONLINE on raclinux2

[root@raclinux1 bin]#

Oracle does not recommend using the same VIP for more applications. In our case we used the database VIP to operate with the Apache as well. To be in compliance with Oracle recommendations we ought to create a new VIP dedicated to the Apache server and use it instead of the database IP. It should operate exactly the same as the database VIP but will have a different IP.

8.4          Node raclinux1 comes back. VIP goes back to raclinux1. The xclock   application is still present at node raclinux2.

[root@raclinux1 bin]# ./crs_stat.sh

HA Resourrce                                  Target     Stage

————                                  ——     —–

ora.VIS.VIS1.inst                             ONLINE     OFFLINE

ora.VIS.VIS2.inst                             ONLINE     OFFLINE

ora.VIS.db                                    ONLINE     OFFLINE

ora.raclinux1.ASM1.asm                        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER1_RACLINUX1.lsnr        ONLINE     OFFLINE

ora.raclinux1.LISTENER_RACLINUX1.lsnr         ONLINE     OFFLINE

ora.raclinux1.LISTENER_VIS_RACLINUX1.lsnr     ONLINE     OFFLINE

ora.raclinux1.gsd                             ONLINE     ONLINE on raclinux1

ora.raclinux1.ons                             ONLINE     ONLINE on raclinux1

ora.raclinux1.vip                             ONLINE     ONLINE on raclinux1

ora.raclinux2.ASM2.asm                        ONLINE     OFFLINE

ora.raclinux2.LISTENER1_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER2_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_RACLINUX2.lsnr         ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_VIS_RACLINUX2.lsnr     ONLINE     ONLINE on raclinux2

ora.raclinux2.gsd                             ONLINE     OFFLINE

ora.raclinux2.ons                             ONLINE     OFFLINE

ora.raclinux2.vip                             ONLINE     ONLINE on raclinux2

xclock_crs                                    ONLINE     ONLINE on raclinux2

8.5               The  xclock application also goes back to Node raclinux1 since it is declared to be dependent on node raclinux1 VIP.

[root@raclinux1 bin]# ./crs_stat.sh

HA Resourrce                                  Target     Stage

————                                  ——     —–

ora.VIS.VIS1.inst                             ONLINE     ONLINE   on raclinux1

ora.VIS.VIS2.inst                             ONLINE     ONLINE    on raclinux2

ora.VIS.db                                    ONLINE     ONLINE   on raclinux1

ora.raclinux1.ASM1.asm                        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER1_RACLINUX1.lsnr        ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_RACLINUX1.lsnr         ONLINE     ONLINE on raclinux1

ora.raclinux1.LISTENER_VIS_RACLINUX1.lsnr     ONLINE     ONLINE on raclinux1

ora.raclinux1.gsd                             ONLINE     ONLINE on raclinux1

ora.raclinux1.ons                             ONLINE     ONLINE on raclinux1

ora.raclinux1.vip                             ONLINE     ONLINE on raclinux1

ora.raclinux2.ASM2.asm                        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER1_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER2_RACLINUX2.lsnr        ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_RACLINUX2.lsnr         ONLINE     ONLINE on raclinux2

ora.raclinux2.LISTENER_VIS_RACLINUX2.lsnr     ONLINE     ONLINE on raclinux2

ora.raclinux2.gsd                             ONLINE     ONLINE on raclinux2

ora.raclinux2.ons                             ONLINE     ONLINE on raclinux2

ora.raclinux2.vip                             ONLINE     ONLINE on raclinux2

xclock_crs                                    ONLINE     ONLINE on raclinux1

December 30, 2009 - Posted by | oracle

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: