转载自:http://blog.youkuaiyun.com/kcen_cai/article/details/26759449
[root@oracle ~]# cat /etc/init.d/oracle
#! /bin/bash#
# oracle Bring up/down oracle
#
# chkconfig: 2345 90 1
# description: Activates/Deactivates all network interfaces configured to \
# start at boot time.
#
# Source function library.
. /etc/init.d/functions
case "$1" in
start)
su - oracle -c "sourec /home/oracle/.11g;lsnrtctl start;start11g"
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit $rc
[root@oracle ~]# cat start11g
#!/bin/bash
source /home/oracle/.11g
lsnrctl start;
sqlplus / as sysdba
startup
EOF
chmod +x ./start11g
[root@oracle ~]# cat shutdown11g
#!/bin/bash
source /home/oracle/.11g
lsnrctl stop;
sqlplus / as sysdba
shutdown immediate
EOF
chmod +x ./shutdown11g
[root@oracle ~]# cat /etc/init.d/oracle
#! /bin/bash
#
# oracle Bring up/down oracle
#
# chkconfig: 2345 90 1
# description: Activates/Deactivates all network interfaces configured to \
# start at boot time.
#
# Source function library.
. /etc/init.d/functions
case "$1" in
start)
su - oracle -c "sourec /home/oracle/start11g"
;;
stop)
su - oracle -c "sourec /home/oracle/shutdown11g"
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $rc
chmod +x !$
chmod +x /etc/init.d/oracle
chkconfig oracle on