Let’s create a script to mount/umount ACFS Filesystem Using Oracle user (oracle)

cd /u01/app/grid/product/11.2.0/grid/crs/script

vi acfs_ORAHOME11GR2.sh

#!/bin/sh

case $1 in

‘start’)

#  Check if Volume is Enabled if not enable volume

if [ ! -f /dev/asm/db112_dbh1-220 ]; then

ORACLE_HOME=/u01/app/grid/product/11.2.0/grid

ORACLE_SID=+ASM

$ORACLE_HOME/bin/asmcmd <

volenable -G DG_ORAHOME11GR2_1 db112_dbh1

EOF

fi

#  Mount filesystem

/usr/bin/sudo /bin/mount -t acfs /dev/asm/db112_dbh1-220 /u01/app/oracle/product/11.2.0/dbhome_1

# Change permission of Filesystem

if [ $? = “0” ]; then

/usr/bin/sudo  /bin/chown oracle:oinstall /u01/app/oracle/product/11.2.0/dbhome_1

/usr/bin/sudo  /bin/chmod 775 /u01/app/oracle/product/11.2.0/dbhome_1

exit 0

fi

RET=$?

;;

‘stop’)

#  Stop Filesystem

/usr/bin/sudo /bin/umount -t acfs /dev/asm/db112_dbh1-220

RET=$?

;;

‘clean’)

/usr/bin/sudo  /bin/umount -t acfs /dev/asm/db112_dbh1-220

RET=$?

;;

‘check’)

#  Check if Filesystem is Mounted

OUTCMD=`/bin/mount |grep ‘/dev/asm/db112_dbh1-220’ |wc -l`

if [ $OUTCMD = 1 ]; then

RET=0

else

RET=1

fi

;;

esac

# 0: success; 1 : error

if [ $RET -eq 0 ]; then

exit 0

else

exit 1

fi

 

I used the “sudo” to perform root-tasks. So you must allow user oracle perform root actions without password.

Using root privileges (or root user)  type “vi /etc/sudoers” to edit sudoers file.

 

# vi /etc/sudoers

Comment the line “Defaults    requiretty”

# Defaults    requiretty

Add user Oracle above this:

# %wheel        ALL=(ALL)       NOPASSWD: ALL

oracle          ALL=(ALL)       NOPASSWD: /bin/chown, /bin/chmod, /bin/mount, /bin/umount

Registering Resource in OHAS

Register Resource “acfs.orahome11gR2_1.fs” on OHAS creating dependency of DISKGROUP “DG_ORAHOME11GR2_1″

START_DEPENDENCIES: Specifies a set of relationships that OHAS considers when starting a resource.

 

You can specify a space-separated list of dependencies on several resources and resource types on which a particular resource can depend.

hard: Specify a hard start dependency for a resource when you want the resource to start only when a particular resource or resource of a particular type starts.

Oracle recommends that resources with hard start dependencies also have pullup start dependencies.

pullup: When you specify the pullup start dependency for a resource, then this resource starts as a result of named resources starting.

 

So, We must specify the START_DEPENDENCIES referencing to DISKGROUP DG_ORAHOME11GR2_1 where are ORACLE_HOME filesystem, that’s means when you try start the resource “acfs.orahome11gR2_1.fs” the DISKGROUP DG_ORAHOME11GR2_1 must be started, if DISKGROUP DG_ORAHOME11GR2_1 is not started “pullup” will try start DISKGROUP DG_ORAHOME11GR2_1 before try start resource “acfs.orahome11gR2_1.fs”.

STOP_DEPENDENCIES: Specifies a set of relationships that OHAS considers when stopping a resource.

hard: Specify a hard stop dependency for a resource that you want to stop when named resources or resources of a particular resource type stop.

 

So, if we try to stop (using OHAS) DISKGROUP DG_ORAHOME11GR2_1 when ACFS (ORACLE_HOME) remain mounted (ONLINE) OHAS must raise CRS-2529

 

CRS-2529: Unable to act on  because that would require stopping or relocating, but the force option was not specified

$ crsctl add resource acfs.orahome11gR2_1.fs

-type local_resource

-attr “

ACTION_SCRIPT=/u01/app/grid/product/11.2.0/grid/crs/script/acfs_ORAHOME11GR2.sh,

AUTO_START=always,

START_TIMEOUT=100,

STOP_TIMEOUT=100,

CHECK_INTERVAL=10,

START_DEPENDENCIES=hard(ora.DG_ORAHOME11GR2_1.dg)pullup(ora.DG_ORAHOME11GR2_1.dg),

STOP_DEPENDENCIES=’hard(ora.DG_ORAHOME11GR2_1.dg)'”

 

More info about attributes used here you can found here:

http://download.oracle.com/docs/cd/E11882_01/rac.112/e16794/resatt.htm

 

$ crsctl status resource acfs.orahome11gR2_1.fs

NAME=acfs.orahome11gR2_1.fs

TYPE=local_resource

TARGET=OFFLINE

STATE=OFFLINE

 

$ df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

54G  9.0G   42G  18% /

/dev/sda1              99M   31M   64M  33% /boot

tmpfs                 2.5G  176M  2.3G   8% /dev/shm

 

# Mounting Filesystem with OHAS:

$ crsctl start resource acfs.orahome11gR2_1.fs

CRS-2672: Attempting to start ‘acfs.orahome11gR2_1.fs’ on ‘macedonia’

CRS-2676: Start of ‘acfs.orahome11gR2_1.fs’ on ‘macedonia’ succeeded

 

$ df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/mapper/VolGroup00-LogVol00

54G  9.0G   42G  18% /

/dev/sda1              99M   31M   64M  33% /boot

tmpfs                 2.5G  176M  2.3G   8% /dev/shm

/dev/asm/db112_dbh1-220

15G  10M   15G  1% /u01/app/oracle/product/11.2.0/dbhome_1

 

$ crsctl status resource acfs.orahome11gR2_1.fs

NAME=acfs.orahome11gR2_1.fs

TYPE=local_resource

TARGET=ONLINE

STATE=ONLINE on macedonia

Trying stop DISKGROUP without umount filesystem

 

$ srvctl stop diskgroup -g DG_ORAHOME11GR2_1

PRCR-1065 : Failed to stop resource ora.DG_ORAHOME11GR2_1.dg

CRS-2529: Unable to act on ‘ora.DG_ORAHOME11GR2_1.dg’ because that would require stopping or relocating ‘acfs.orahome11gR2_1.fs’, but the force option was not specified

 

Now you can restart your server and make sure wich the filesystem will be mounted at startup of OHAS.

 

If everything is ok you can install Oracle Software on ACFS.