# SAP R/3 Environment - please do not edit
[HIS_DSN]
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-11.0.so.2260.0
ServerName=CIS_DB
doexit=return
if expr match "$0" ".*hdbenv.sh$" >/dev/null; then doexit=exit; fi
#$doexit -1
#
# this statement remains only because it is edited by installer software. Should be eliminated
#
DEFAULTHOSTNAME=fdhana
# For SAP HANA development: put path to locally-built executables
# to override installed executables here (.../gen/opt or .../gen/dbg).
DEV_PATH=""
function checks_and_settings {
typeset doexit=return
#
# check for SIDadm user name convention
# guess SAPSYSTEMNAME, if not yet defined, and add it to environment
#
if [ "x$SAPSYSTEMNAME" = "x" ]; then
typeset usr=$(whoami)
if expr match ${usr} "[a-z][a-z0-9][a-z0-9]adm" != 6 >/dev/null ; then
echo "hdbenv.sh: HDB script requires <sid>adm user, but got '${usr}'"
$doexit 1
fi
SAPSYSTEMNAME=`expr substr "$usr" 1 3 | tr "[:lower:]" "[:upper:]"`
export SAPSYSTEMNAME
fi
#
# Evaluate Virtual Hostname: given as $1, or found in sapservices, or defaulted to 'physical' hostname
#
# the next block assures that the variable VTHOSTNAME 'virtual host name' be defined
typeset source
if [ "$1" = "" ]; then
[ $# != 0 ] && shift
#
# get local virtual host name out of sapservices. take only the first host name found if more given
# ignore lines commented out
#
typeset inputfile=/usr/sap/sapservices
typeset SID=$SAPSYSTEMNAME
VTHOSTNAME=`grep "^[ ]*[^#].*pf=/.*/${SID}/\(SYS/profile\|profile\)/${SID}_HDB[0-9][0-9]_" $inputfile | sed "s:.*pf=/.*/${SID}/\(SYS/profile\|profile\)/${SID}_HDB[0-9][0-9]_\([^ ]*\).*:\2:" | head -1`
if [ "$VTHOSTNAME" = "" ]
then
source="in $inputfile"
VTHOSTNAME=`grep "^/usr/sap/waitforhdb.*[#].*pf=/.*/${SID}/\(SYS/profile\|profile\)/${SID}_HDB[0-9][0-9]_" $inputfile | sed "s:.*pf=/.*/${SID}/\(SYS/profile\|profile\)/${SID}_HDB[0-9][0-9]_\([^ ]*\).*:\2:" | head -1`
fi
if [ -z "$VTHOSTNAME" ]
then
echo "hdbenv.sh: Host name not found out of $inputfile, defaulting to local physical host" >&2
source='as physical host'
VTHOSTNAME=`hostname`
fi
else
source='on command line'
VTHOSTNAME="$1"; shift
fi
#
# check for consistency between an already defined SAP_RETRIEVAL_PATH and the VTHOSTNAME evaluated before
#
if [ "x$SAP_RETRIEVAL_PATH" != "x" ]; then
typeset host=`basename $SAP_RETRIEVAL_PATH`
if [ "$VTHOSTNAME" != "$host" ]
then
echo "hdbenv.sh: Hostname $host defined in \$SAP_RETRIEVAL_PATH=$SAP_RETRIEVAL_PATH differs from host name defined $source." >&2
fi
fi
#
# guess instance number - there may be only one in this SID per virtual host
#
typeset TINSTANCE=`find /usr/sap/"$SAPSYSTEMNAME"/SYS/profile/"$SAPSYSTEMNAME"_HDB[0-9][0-9]_$VTHOSTNAME -exec expr substr {} 33 2 \; 2>/dev/null`
# variable 'COMMAND' may be set by the 'HDB' command script sourcing this file:
if [ ${#TINSTANCE} -lt 2 ] && [ "$COMMAND" = "start" ]; then # find any instance
TINSTANCE=`find /usr/sap/"$SAPSYSTEMNAME"/SYS/profile/"$SAPSYSTEMNAME"_HDB[0-9][0-9]_* -exec expr substr {} 33 2 \; 2>/dev/null`
if [ ${#TINSTANCE} -gt 2 ]; then # take only first
TINSTANCE=`expr substr "$TINSTANCE" 1 2`
fi
fi
if [ ${#TINSTANCE} -lt 2 ]; then
echo "hdbenv.sh: Error: Instance not found for host $VTHOSTNAME"
$doexit 1
fi
if [ ${#TINSTANCE} -gt 2 ]; then