RedHat Linux下Oracle啟動腳本的建立 dbstart oracle8.1.6
2024-08-29 13:30:57
供稿:網友
 
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 
來源:奧索