#!/bin/sh
# Akadia AG, Arvwenweg 4, CH-3604 Thun
# ----------------------------------------------------------------------
# File:       dbora
#
# Autor:      Martin Zahn / 22.02.2002
# 
# Purpose:    Startup Oracle Database(s) defined in 
#             /var/opt/oracle/oratab
# ----------------------------------------------------------------------

NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1; export NLS_LANG
ORACLE_OWNER=oracle; export ORACLE_OWNER
ORACLE_SCRIPTS_DIR=/export/home/oracle/config/adm;
export ORACLE_SCRIPTS_DIR

if [ ! -f $ORACLE_SCRIPTS_DIR/dbstart8.sh ]
then
  echo "Oracle 8 not started (no dbstart script)"
  exit
fi
if [ ! -f $ORACLE_SCRIPTS_DIR/dbshut8.sh ]
then
  echo "Oracle 8 not shutdown (no dbshut script)"
  exit
fi

if [ ! -f $ORACLE_SCRIPTS_DIR/dbstart9.sh ]
then
  echo "Oracle 9 not started (no dbstart script)"
  exit
fi
if [ ! -f $ORACLE_SCRIPTS_DIR/dbshut9.sh ]
then
  echo "Oracle 9 not shutdown (no dbshut script)"
  exit
fi

case "$1" in
  'start')  # Start Oracle Database

    su $ORACLE_OWNER -c $ORACLE_SCRIPTS_DIR/dbstart8.sh
    su $ORACLE_OWNER -c $ORACLE_SCRIPTS_DIR/dbstart9.sh
    ;;

  'stop')   # Stop Oracle Database

    su $ORACLE_OWNER -c $ORACLE_SCRIPTS_DIR/dbshut8.sh
    su $ORACLE_OWNER -c $ORACLE_SCRIPTS_DIR/dbshut9.sh
    ;;
esac
