# @(#)17 1.3 src/43haes/usr/sbin/cluster/sa/oracle/sbin/ASUtilities.sh, hacmp.assist.oracle, 61haes_r714 4/13/06 21:37:27
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# 61haes_r714 src/43haes/usr/sbin/cluster/sa/oracle/sbin/ASUtilities.sh 1.3
#
# Licensed Materials - Property of IBM
#
# Restricted Materials of IBM
#
# COPYRIGHT International Business Machines Corp. 2006
# All Rights Reserved
#
# US Government Users Restricted Rights - Use, duplication or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#
# IBM_PROLOG_END_TAG
#----------------------------------------------------------------------------
# Global Definitions:
#----------------------------------------------------------------------------
. /usr/es/sbin/cluster/sa/oracle/sbin/IO
#----------------------------------------------------------------------------
# Functions:
# osaSetASEnvs
# osaASFindComps
# osaASGetVGs
# osaASFindInstances
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------
# Functions:
# osaSetASEnvs
#
# Purpose:
# Should be called before any AS-related operations are performed.
# It is also VERY IMPORTANT to call (or re-call) it if $ORACLE_HOME
# has been modified in current process and future operations are
# going to be performed in this process.
#
# Arguments:
# (1) ORACLE_HOME
#
# Returns:
# 0 success
# <0 failure
#
function osaSetASEnvs {
[[ "$VERBOSE_LOGGING" == "high" ]] && set -x
if [[ -n $1 ]]; then
ORACLE_HOME=$1
export ORACLE_HOME
fi
OSA_OPMN_CONF_FILE=$ORACLE_HOME/opmn/conf/opmn.xml
OPMN_BINPATH=$ORACLE_HOME/opmn/bin
export OSA_OPMN_CONF_FILE OPMN_BINPATH
}
#----------------------------------------------------------------------------
# Function:
# osaASGetConfigChecksum
#
# Purpose:
# Obtain the opmn.xml checksum to determine if the opmn configuration
# file has changed since the last time we've run verification
#
# Arguments:
# n/a
#
# Returns:
# 0 on success
# <0 on failure
#
function osaASGetConfigChecksum {
typeset m n file
[[ ! -f $OSA_OPMN_CONF_FILE ]] && return 1
/bin/cksum $OSA_OPMN_CONF_FILE | read m n file
echo $m-$n
return 0
}
#----------------------------------------------------------------------------
# Function:
# osaASFindComps
#
# Purpose:
# Find installed components (i.e., resource groups for AS).
# Done by looking up Oracle AS components configured within
# $ORACLE_HOME/opmn/conf/
#
# Arguments:
# n/a
#
# Output:
# List of Oracle Components installed
#
# Returns:
# 0 success
#
function osaASFindComps {
[[ "$VERBOSE_LOGGING" == "high" ]] && set -x
set -A allASInstances
typeset -A comps
typeset line expr instance component index
[[ ! -f $OSA_OPMN_CONF_FILE ]] && return 1
while read line; do
if [[ -z $instance ]]; then # not in an instance section yet
# just keep looking for more the instance section
expr=${line##""} # clean up instance name
# echo "Instance definition found for: " $instance
fi
elif [[ $line == "" ]]; then
osaASPushInstance $instance comps
unset instance
unset comps
else # we are in an instance section so we now look for components
expr=${line##" _
typeset instance_name=${inst//\./\_}
for index in ${!compref[*]}; do
key=${instance_name}"_"${index}
allASComponents[$key]="${compref[$index]}"
done
}
# Name : ASUtilities::osaASGetProps()
# Description: Get properties related to specific component.
# Arguments:
# (1) name: component name
# Returns:
# hash of properties specific to given component
#----------------------------------------------------------------------------
# Function:
# osaASGetVGs
#
# Purpose:
# Returns the Volume Group containing $ORACLE_HOME
#
# Arguments:
# -none-
#
# Returns:
# Returns(echos) a VG name
#
function osaASGetVGs {
[[ "$VERBOSE_LOGGING" == "high" ]] && set -x
typeset vg=$(KLIB_AIX_get_vg_by_path $ORACLE_HOME)
echo $vg
}
#----------------------------------------------------------------------------
# Function:
# osaASFindInstances
#
# Purpose:
# Find the Oracle Instances (Application Server)
#
# Arguments:
# n/a
#
# Output:
# list of instances
#
# Returns:
# n/a
#
function osaASFindInstances {
[[ "$VERBOSE_LOGGING" == "high" ]] && set -x
osaASFindComps
typeset inst
for inst in ${allASInstances[*]}; do
echo $inst
done
}