LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Oracle 9i Start Up Script w/ Redhat 9 (https://www.linuxquestions.org/questions/linux-software-2/oracle-9i-start-up-script-w-redhat-9-a-93720/)

linux_pioneer 09-17-2003 05:48 AM

Oracle 9i Start Up Script w/ Redhat 9
 
I'm running redhat 9 and installed Oracle 9i release 2. I need a start up script so the database and listeners start up everytime I boot up. I've tried a few but get errors each time. Does anyone know of a good start up script for redhat 9 and Oracle 9i R2?

Here is what I've tried:
#!/bin/bash
#
# starts and stops oracle 9i database, listener & http server
# fix kernel parameters for oracle

#oracle environment
export ORACLE_HOME=/opt/app/oracle/product/9.2
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin:$PATH
export NLS_LANG='american_america.we8iso8859p2'
export ORACLE_SID=ora9ip

export DISPLAY=:0
oracle_user=oracle

case $1 in
start)
# fix kernel parameters
echo 250 32000 100 128 > /proc/sys/kernel/sem
echo 536870912 > /proc/sys/kernel/shmmax
echo 4096 > /proc/sys/kernel/shmmni
echo 2097152 > /proc/sys/kernel/shmall
echo 65536 > /proc/sys/kernel/fs/file-max
echo 1024 65000 > /proc/sys/net/ipv4/ip_local_port_range

# start listener, apache and database
su - "$oracle_user"<<EOF
lsnrctl start
apachectl start
sqlplus /nolog<<EOL
connect / as sysdba
startup
EOL
EOF
;;

stop)
# stop listener, apache and database
su - "$oracle_user"<<EOF
lsnrctl stop
apachectl stop
sqlplus /nolog<<EOL
connect / as sysdba
shutdown immediate
EOL
EOF
;;

*)
echo "Usage: ora9ip [start|stop]"
;;

esac

and I've also tried this one:

#!/bin/bash
#
# Run-level Startup script for the Oracle Instance and Listener
#
# chkconfig: 345 91 19
# description: Startup/Shutdown Oracle listener and instance

ORA_HOME="/u01/app/oracle/product/9.2.0.1.0"
ORA_OWNR="oracle"

# if the executables do not exist -- display error

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

# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display

case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl start"
su - $ORA_OWNR -c $ORA_HOME/bin/dbstart
touch /var/lock/subsys/oracle
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su - $ORA_OWNR -c "$ORA_HOME/bin/lsnrctl stop"
su - $ORA_OWNR -c $ORA_HOME/bin/dbshut
rm -f /var/lock/subsys/oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 start|stop|restart|reload"
exit 1
esac
exit 0

The 1st gives me a few compiler errors. This second one gives me the Usage error saying that it does not understand the parameter that rh9 is giving it.


All times are GMT -5. The time now is 03:29 AM.