redhat linux下oracle启动脚本的建立
2001-06-05 8:25
发布者:crystal 阅读次数:102 一、修改$oracle_home/bin/dbstart脚本
首先测试你的$oracle/bin/dbstart脚本,如果能正常启动oracle,请跳到第二部分。
本人运行环境为redhat7.1+oracle8.1.6,发现dbstart脚本有问题,不能得到当前运行的oracle的版本号。编辑dbstart,找到
status=1
if [ “$version” = “8.1” ]
在之前加上
version=”8.1″
二、建立/etc/init.d/oracle脚本如下:#!/bin/bash
#
# oracle this shell script takes care of starting and stopping
# the mysql subsystem (mysqld).
#
# chkconfig: – 90 10
# description: oracle database server.
# processname: oracle
ora_home=/home/oracle
ora_owner=oracle
prog=”oracle”
# source function library.
. /etc/rc.d/init.d/functions
if [ ! -f $ora_home/bin/dbstart ]
then
echo “oracle startup: cannot start”
exit
fi
start(){
su – $ora_owner -c $ora_home/bin/dbstart >/dev/null 2>&1 &
ret=$?
if [ $ret -eq 0 ]; then
action $”starting $prog: ” /bin/true
else
action $”starting $prog: ” /bin/false
fi
[ $ret -eq 0 ] && touch /var/lock/subsys/oracled
return $ret
}
stop(){
su – $ora_owner -c $ora_home/bin/dbshut >/dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]; then
action $”stopping $prog: ” /bin/true
else
action $”stopping $prog: ” /bin/false
fi
[ $ret -eq 0 ] && rm -f /var/lock/subsys/oracled
return $ret
}
restart(){
stop
start
}
# see how we were called.
case “$1” in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
condrestart
;;
*)
echo $”usage: $0 {start|stop|restart}”
exit 1
esac
三、运行命令chkconfig –add oracle,注册系统服务,然后就可以用ntsysv命令来管理你的oracle服务了。
四、可以到
http://fancao.oso.com.cn/script/dbstart
http://fancao.oso.com.cn/script/oracle
下载本文所提及文件。
作者:凡草0515
来源:奥索