随笔-13  评论-28  文章-63  trackbacks-0
#!/bin/bash
#
# chkconfig: 35 95 1
# description: init script to start/stop oracle database 10g, TNS listener, EMS, isqlplus

#

# match these values to your environment:

export ORACLE_BASE=/home/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/db_1
# export ORACLE_TERM=xterm
export PATH=$PATH:$ORACLE_HOME/bin
export NLS_LANG='american_america.ZHS16GBK'
export ORACLE_SID=esales
# export DISPLAY=localhost:0
export ORACLE_USER=oracle

# see how we are called:
case $1 in
start)
su - "$ORACLE_USER"<<EOO
lsnrctl start
sqlplus /nolog<<EOS
connect / as sysdba
startup
EOS
emctl start dbconsole
isqlplusctl start
EOO
;;

stop)
su - "$ORACLE_USER"<<EOO
lsnrctl stop
sqlplus /nolog<<EOS
connect / as sysdba
shutdown immediate
EOS
emctl stop dbconsole
isqlplusctl stop
EOO
;;

*)
echo "Usage: $0 {start|stop}"
;;
esac



二、 以root用户执行以下命令
chmod 755 /etc/rc.d/init.d/oracle10g
chkconfig --add oracle10g


三、 重启服务
service oracle10g stop
service oracle10g start

 

这样在开关机的时候oracle自动启动和停止。
posted on 2008-10-16 14:51 七匹狼 阅读(571) 评论(0)  编辑  收藏 所属分类: oracle

只有注册用户登录后才能发表评论。


网站导航: