Chinaunix首页 | 论坛 | 博客
  • 博客访问: 333337
  • 博文数量: 103
  • 博客积分: 3886
  • 博客等级: 中校
  • 技术积分: 1005
  • 用 户 组: 普通用户
  • 注册时间: 2010-04-28 15:00
文章分类

全部博文(103)

文章存档

2011年(30)

2010年(73)

分类:

2010-05-26 14:50:33

following is the code of my shell, which i use for starting, stopping, restarting teh oracle and listener service, except your oracle home location and oracle user i do not think you need to change any thing..also i assume that you some basic knowledge of shell programming.
put this /etc/rc.d/init.d, then add this service by chkconfig -- add oracle (if oracle is the file name in whcih this shell exists).

it will run for 3,4,5 of runlevels with priority as 20, 80

thanx in advance..subodh

#!/bin/sh
#
# Description: This Scripts starts stops Oracle database and listner
#
# chkconfig: - 345 20 80
#
#
ORACLE_OWNR='oracle'
ORACLE_LOCN='/oracle/product/10.1.0/bin'

echo "Check whethere the file exists or not"

if [ ! -f '$ORACLE_LOCN/lsnrctl' -o ! -d $ORACLE_LOCN ]; then
echo "Unable to Start the Oracle Service"
fi
case "$1" in
start)
echo "Starting up Oracle Database and Listener Service"
su - $ORACLE_OWNR -c "$ORACLE_LOCN/dbstart"
su - $ORACLE_OWNR -c "$ORACLE_LOCN/lsnrctl start"
touch /var/log/oracle
;;
stop)
echo "Stoping Oracle Database and Listener Service"
su - $ORACLE_OWNR -c "$ORACLE_LOCN/dbshut"
su - $ORACLE_OWNR -c "$ORACLE_LOCN/lsnrctl stop"
touch /var/log/oracle
;;
restart|reload)
echo "Restarting Oracle Database and Listener Service"
$0 stop
$0 start
;;
*)
echo "Usuage Oracle start|stop|restart|reload"
exit 1
esac
exit 0

阅读(1801) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~