/etc/oratab如下:
ora1:/u01/app/oracle/produce/8.1.7:Y
/etc/rc.d/init.d/oracle:脚本文件已生成
/etc/rc.d/rc0.d: K01oracle 已连接至 /etc/rc.d/init.d/oracle
/etc/rc.d/rc6.d: K01oracle 已连接至 /etc/rc.d/init.d/oracle
/etc/rc.d/rc2.d: S99oracle 已连接至 /etc/rc.d/init.d/oracle
/etc/rc.d/rc3.d: S99oracle 已连接至 /etc/rc.d/init.d/oracle
/etc/rc.d/rc4.d: S99oracle 已连接至 /etc/rc.d/init.d/oracle
---------------------------------------------------------------
write unix script and use "chkconfig" to add oracle as service
of the O.S.
- make sure u have set all necessary for the owner of oracle,
and then create a script file named "oracleSrvc",and
using "chmod" to set access permission. the content of the file:
(surely there are many mistake,please correct them yourself)
-------------
#!/bin/sh
#the following line says that this service is involved in run
#level 345 and is the 90th service to start and the 1st
#service to stop
#chkconfig 345 90 1
case "$1" in
start)
su -l theoracleuser -c lsnrctl start
su -l theoracleuser -c svrmgrl <
open
!
touch /var/lock/subsys/oracle
;;
stop)
su -l theoracleuser -c svrmgrl <<!
connect internal
shutdown abort
!
su -l theoracleuser -c lsnrctl start
rm /var/lock/subsys/oracle
;;
restart)
$0 start
$0 stop
;;
esac
exit 0
OK,add the service to system:
cp ./oracle /rc/init.d/oracle
chkconfig --add oracle
---------------------------------------------------------------
在/etc/rc.d/init.d下创建几个文件:
1、startdb正文如下
su - oracle <<EOF
svrmgrl
connect internal
startup
2、startlsn正文如下
su - oracle <<EOF
lsnrctl start
3、stopdb正文如下
su - oracle <<EOF
svrmgrl
connect internal
shutdown immediate
4、stoplsn 正文如下
su - oracle <<EOF
lsnrctl stop
5、修改文件执行属性:
chmod 711 startdb
chmod 711 startlsn
chmod 711 stopdb
chmod 711 stoplsn
6、创建链接:
ln -s /etc/init.d/startdb /etc/rc.d/rc5.d/S99dbstart
ln -s /etc/init.d/startlsn /etc/rc.d/rc5.d/S99dblsnstart
ln -s /etc/init.d/stopdb /etc/rc.d/rc0.d/K10dbstop
ln -s /etc/init.d/stoplsn /etc/rc.d/rc0.d/K10dblsnstop
重新启动。如果你是以字符方式启动的话,还要在rc3.d下创建链接。