Logo

UNIX Shell Script

Database Startup

Tested on Oracle 8.1

Updated : 18-Apr-2002
Version : 2.0

Description

Simple database startup script. Gets the ORACLE_HOME from /etc/oratab. This script is an alternative Oracle supplied dbstart and dbstop scripts.

Parameters

$1 - ORACLE_SID of the database to startup.

Shell Source

#!/bin/ksh

DATABASE=$1

# Check that we have a database
if [ -z "${DATABASE}" ]
then
   echo
   echo "No Database Specified !"
   echo
   echo "Usage : ora_start.ksh "
   echo
   echo "where ORACLE_SID (Mandatory) - SID of database to start"
   echo
   echo " e.g.  $ ora_start.ksh PROD" 
   echo
   exit 1
fi

# Get the ORACLE_HOME from the oratab file
ORACLE_HOME=`cat /etc/oratab | grep $DATABASE | awk -F: '{print $2}'`
if [ ! -d "${ORACLE_HOME}" ]
then
  echo
  echo "$ORACLE_HOME does not exist !"
  echo
  exit 1
fi

ORACLE_SID=$DATABASE
export ORACLE_SID
PATH=.:$ORACLE_HOME/bin:$PATH; export PATH

echo " "
echo "Starting the Database" $DATABASE
echo " "

sqlplus << EOF
connect / as sysdba
startup
EOF
exit 0

Previous Oracle Version Links

Database Startup

Return to Index of SQL Scripts


Home | Company Profile | Services | Contact Us | SQL scripts and tips | Quiz
Legal

Logo