zoukankan      html  css  js  c++  java
  • Linux上Oracle自动启停方案

    环境

    CentOS 6 x86_64, Oracle 11g R2
     
    方案
    Oracle在$ORACLE_HOME/bin目录下提供了dbstart和dbshut两个脚本来启动和停止Oracle。dbstart脚本将启动指定的数据库实例和Listener。
     
    首先,修改/etc/oratab,把要自动启动的实例对应的启动标志设置为"Y"
    ORA01:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y
     
    然后,创建/etc/init.d/dbora脚本,内容如下:
    #!/bin/bash
    ### BEGIN INIT INFO # Provides: Oracle # Required
    -Start: $local_fs $network $remote_fs # Required-Stop: $local_fs $network $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start and stop oracle # Description: Oracle is a damn RDBMS ### END INIT INFO # # Change the value of ORACLE_HOME to specify the correct Oracle home # directory for your installation. ORACLE_HOME=/home/oracle/app/oracle/product/11.2.0/dbhome_1/ # # Change the value of ORACLE_OWNER to the login name of the # oracle owner at your site. # ORACLE_OWNER="oracle" LOCK_FILE="/var/lock/subsys/dbora" case $1 in 'start') su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME &" touch $LOCK_FILE ;; 'stop') su - $ORACLE_OWNER -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME &" rm -f $LOCK_FILE ;; *) echo "usage: $0 {start|stop}" exit ;; esac exit
     
    给dbora添加执行权限:
    chmod a+x /etc/init.d/dbora
     
    将dbora添加到自启动服务:
    chkconfig dbora on
     
    这样,Oracle就可以作为系统服务自动启停了。
     
    References
     
  • 相关阅读:
    网络爬虫之第一章网络请求
    rabbitmq学习(一) —— 安装篇
    jenkins自动构建部署
    httpclient初步封装
    谈谈“拥抱变化”
    mongo对分组数据进行排序
    困兽
    go语言——goland中项目目录及编译说明
    最长回文子串
    java中关于锁知识的整理
  • 原文地址:https://www.cnblogs.com/hellogc/p/3219481.html
Copyright © 2011-2022 走看看