当前位置:首页 > 数据库 > Oracle

Oracle自定义服务,随操作系统启动和关闭

  1. 更改/etc/oratab中第三列值为Y,默认为N,也可更改为W

    格式如下: orcl:/u01/oracle/product/11.2/db_1:Y

  2. 编写启动服务,在/etc/init.d/创建

    简单如下:

    #!/bin/sh

    OPT_=$1

    case "$OPT_" in

    start)

       /bin/echo "$0 : (start)"

       su - oracle -c "/u01/oracle/product/11.2/db_1/bin/lsnrctl start"

       su - oracle -c "/u01/oracle/product/11.2/db_1/bin/dbstart"

       exit 0

    ;;

    stop)

       /bin/echo "$0 : (stop)"

       su - oracle -c "/u01/oracle/product/11.2/db_1/bin/lsnrctl stop"

       su - oracle -c "/u01/oracle/product/11.2/db_1/bin/dbshut"

     exit 0

    ;;

    *)

      /bin/echo ‘‘

      /bin/echo "usage:$0 (start|stop)"

      /bin/echo "   Invalid argument ==> "$OPT_""

      /bin/echo ‘‘

      exit

    ;;

    esac

  3. 设定随机启动关闭软连接

    需要查看当前启动级别 /etc/inittab 最后一行

    到对应目录结构下执行:

    ln -s /etc/init.d/start_shut S99oracle

    ln -s /etc/init.d/start_shut K01oracle


本文出自 “8016776” 博客,请务必保留此出处http://8026776.blog.51cto.com/8016776/1695947

原文:http://8026776.blog.51cto.com/8016776/1695947


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!