Wednesday, September 17, 2008

Oracle 9i Startup Script on CentOS 4.4

Here is startup script for oracle 9i release 2 on centos 4.4

1. Save this script on /etc/init.d/oracle

#!/bin/sh
# 15 September 2008
# Created by Johannes Sitorus
# description: Oracle auto start-stop script.

ORA_HOME=/data/oracle/9.2.0
ORA_OWNER=oracle

if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi

case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNER -c $ORA_HOME/bin/dbstart
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login
# will not prompt the user for any values
su - $ORA_OWNER -c $ORA_HOME/bin/dbshut
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop"
;;
*)
echo $"Usage: $0 {start|stop}"
exit 1

esac

2. chkconfig --level 35 oracle on

P.S Replace the variable as needed