oracle10g在redhat4 下面的启动脚本

来源:互联网 发布:淘宝客服日常工作 编辑:程序博客网 时间:2024/05/16 11:25

项目中需要用到一个在oracle下面能自动启动的脚本,在网上转了一圈之后经过测试和整理得到如下脚本

#!/bin/sh
#
# chkconfig: 35 95 1
# description: init script to start/stop oracle database 10g, TNS listener, EMS
#
#
# match these values to your environment:

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
EOO
    ;;

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

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

esac

exit 0