Automatic start Oracle database linux RedHat

A small script to automatically start an Oracle DB:

Source   
# chkconfig: 2345 80 20
# description: Oracle Database
#!/bin/bash
start() {
su - oracle <<EOF
lsnrctl start
sqlplus / as sysdba<<EOO
startup
EOO
EOF
}
stop() {
su - oracle <<EOF
sqlplus / as sysdba<<EOO
shutdown immediate
EOO
lsnrctl stop
EOF
}
case "$1" in
start)
start
;;
stop)
stop
;;
*)
echo $"Usage: $0 {start|stop}"
esac

Start the database as “oracle” user, you have to have all correctemente configured environment variables.

You can install this script with chkconfig, because the head is prepared for this

Leave a Reply