现在的位置: 首页 > 综合 > 正文

linux 上 Oracle自动启动与停止

2013年08月05日 ⁄ 综合 ⁄ 共 1003字 ⁄ 字号 评论关闭

一、 以root用户建立/etc/rc.d/init.d/oracle10g脚本文件,内容如下(环境变量设置根据实际情况进行修改):

#!/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自动启动和停止。

 

本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/wzy0623/archive/2007/06/27/1668662.aspx

抱歉!评论已关闭.