#!/bin/ksh # ======================================================================================== # Title : oraenv_custom_code.ksh # Author : Darryl Hickson # Date : 22-JAN-15 # Purpose : Custom code to append to oraenv. Initial code will append the node number # : to the SID (if applicable) to set the true SID and creates the ORACLE_DB # : variable. # : Note: These changes will be overwritten if the root.sh script is rerun. # Modifications # 16AUG15 DH - Added code to check if a machine is part of a cluster if it is # running Grid Infrastructure. Avoids issue for stand-alone # machines. # 25JUL15 DH - Renamed oraenv_custom_code.txt to oraenv_custom_code.ksh # ======================================================================================== # ======================================================================================== # Set the ORACLE_DB so that the scripts will run for RAC and non-RAC # ======================================================================================== export ORACLE_DB=$ORACLE_SID # ======================================================================================== # Get the first few characters of the sid according to OS # ======================================================================================== export HOST_OS=`uname -s` if [ $HOST_OS = "Linux" ]; then export ORA_SID_PRE=${ORACLE_SID:0:4} elif [ $HOST_OS = "HP-UX" ]; then export ORA_SID_PRE=`expr substr $ORACLE_SID 1 4` fi # ======================================================================================== # Append the node number to the instance name for RAC and add nothing for non-RAC # Note: Will not append node number for ASM since it is already included. # ======================================================================================== if [ ${ORA_SID_PRE} != +ASM ] then if [ ! -z "${GI_HOME}" ]; then $GI_HOME/bin/cemutlo -n > /dev/null 2>&1 if [ $? -eq 0 ]; then export ORACLE_SID=${ORACLE_SID}`$GI_HOME/bin/olsnodes -n -l |awk '{print $2}'` fi fi fi echo ====================================== echo Oracle DB : $ORACLE_DB echo Oracle SID: $ORACLE_SID echo ======================================