Set the oracle11g boot to start automatically:
Setup in Redhat and CentOS allows the Oracle system to start automatically and is set to Disallowed by default.
1. Modify the/etc/oratab file under the root account:
# Vi/etc/oratab
Orcl=/db/app/oracle/product/11.1.0/db_1:n the last N is changed to Y,
2. Under Oracle account, modify the Oracle's own startup and shutdown scripts, respectively, Dbstart and Dbshut.
Both scripts enable the startup and shutdown of Oracle scripts.
Modify $oracle_home/bin/dbstart file under Account:
$ cd $ORACLE _home/bin
$ VI Dbstart
Find oracle_home_listner=$1 this line instead: oracle_home_listner= $ORACLE _home
$ cd $ORACLE _home/bin
$ VI Dbshut
Find oracle_home_listner=$1 this line instead: oracle_home_listner= $ORACLE _home
# cd/etc/rc.d/init.d/
Vim oracle.sh
#
#!/bin/bash
#chkconfig: 2345 80 25
#/etc/init.d/oracle11g
#description: ORACLE 11g Server
# run-level Startup script. For the Oracle Listener and Instances
# IT relies on the information on/etc/oratab
Export ORACLE_BASE=/U01
Export oracle_home=/u01/app/oracle/product/11.1
Export oracle_sid=ora11g
Export Oracle_ownr=oracle
Export path= $PATH: $ORACLE _home/bin
if [!-F $ORACLE _home/bin/dbstart-o!-D $ORACLE _home]
Then
echo "Oracle startup:cannot start"
Exit 1
Fi
Case "$" in
Start
# Oracle Listener and instance startup
Echo-n "Starting Oracle:"
Su $ORACLE _ownr-c "$ORACLE _home/bin/lsnrctl start"
Su $ORACLE _ownr-c "$ORACLE _home/bin/dbstart $ORACLE _home"
Touch/var/lock/oracle
echo "OK"
;;
Stop
# Oracle Listener and instance shutdown
Echo-n "Shutdown Oracle:"
Su $ORACLE _ownr-c "$ORACLE _home/bin/lsnrctl Stop"
Su $ORACLE _ownr-c "$ORACLE _home/bin/dbshut $ORACLE _home"
Rm-f/var/lock/oracle
echo "OK"
;;
Reload|restart)
$ stop
$ start
;;
*)
echo "Usage: ' basename ' Start|stop|restart|reload"
Exit 1
Esac
Exit 0
Chkconfig--add Oracle # Add Service
Chkconfig Oracle on # starts automatic motion
Chkconfig--list Oracle # See if it's successful
This article is from the "willing to share with you" blog, please be sure to keep this source http://9265463.blog.51cto.com/9255463/1767972
Set up oracle11g boot automatically