#!/bin/bash
#
#########################################################################################
#
# Script: BI schedule script
# Description: Script to load BI data from production
# Author: J.Minnaar / ABS Laundry Business Solutions
#
#### Changelog ##########################################################################
# 1.0, 20110406 - initial version
# 2.0, 20230801 - modified for V10 ETL
#########################################################################################

# script root location
export ABS_ROOTDIR=/u01/app/obiee/Scripts/ScheduleLoadScripts

# export the oracle home of the client what will be used to run the export from
export ORACLE_HOME=/u01/app/oracle/product/19.3.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$PATH

#### Check Oracle home #########################################
if [ ! -d "$ORACLE_HOME" ]
then
    echo "The ORACLE_HOME setting ($ORACLE_HOME) points to a non-existing"
    echo "directory. Please check the configuration script."
    exit 1
fi

export LOGFILENAME=$ABS_ROOTDIR/BI_LOAD.LOG

touch $LOGFILENAME
echo 'start task' >> $LOGFILENAME
echo `date +%Y%b%d_%H%M%S` >> $LOGFILENAME

sqlplus -s ABSDATAWAREHOUSE_V10/ABSDATAWAREHOUSE_V10@ABS1 @$ABS_ROOTDIR/execute_BI_warehouse_load_v10.sql >> $LOGFILENAME
echo 'end task' >> $LOGFILENAME
echo `date +%Y%b%d_%H%M%S` >> $LOGFILENAME

echo . >> $LOGFILENAME