zoukankan      html  css  js  c++  java
  • ORACLE设置自启动记录

    设置开机自启动
    1. 修改Oracle系统配置文件:/etc/oratab,只有这样,Oracle 自带的dbstart和dbshut才能够发挥作用。
    [root@hailiang ~]# vi /etc/oratab
    VDEDU:/u01/app/oracle/product/11.2.4/dbhome_1:Y

    2. 在 /etc/init.d/ 下创建文件oracle,内容如下:
    [root@hailiang ~]# vi /etc/init.d/oracle
    #!/bin/sh
    # chkconfig: 35 80 10
    # description: Oracle auto start-stop script.
    #
    # Set ORA_HOME to be equivalent to the $ORACLE_HOME
    # from which you wish to execute dbstart and dbshut;
    #
    # Set ORA_OWNER to the user id of the owner of the
    # Oracle database in ORA_HOME.
    ORA_HOME=/u01/app/oracle/product/11.2.4/dbhome_1
    ORA_OWNER=oracle
    LOGFILE=/var/log/oracle.log
    echo "#################################" >> ${LOGFILE}
    date +"### %T %a %D: Run Oracle" >> ${LOGFILE}
    if [ ! -f ${ORA_HOME}/bin/dbstart ] || [ ! -f ${ORA_HOME}/bin/dbshut ]; then
    echo "Error: Missing the script file ${ORA_HOME}/bin/dbstart or ${ORA_HOME}/bin/dbshut!" >> ${LOGFILE}
    echo "#################################" >> ${LOGFILE}
    exit
    fi
    start(){
    echo "###Startup Database..."
    su - ${ORA_OWNER} -c "${ORA_HOME}/bin/dbstart ${ORA_HOME}"
    echo "###Done."
    echo "###Run database control..."
    su - ${ORA_OWNER} -c "${ORA_HOME}/bin/emctl start dbconsole"
    echo "###Done."
    }
    stop(){
    echo "###Stop database control..."
    su - ${ORA_OWNER} -c "${ORA_HOME}/bin/emctl stop dbconsole"
    echo "###Done."
    echo "###Shutdown Database..."
    su - ${ORA_OWNER} -c "${ORA_HOME}/bin/dbshut ${ORA_HOME}"
    echo "###Done."
    }
    case "$1" in
    'start')
    start >> ${LOGFILE}
    ;;
    'stop')
    stop >> ${LOGFILE}
    ;;
    'restart')
    stop >> ${LOGFILE}
    start >> ${LOGFILE}
    ;;
    esac
    date +"### %T %a %D: Finished." >> ${LOGFILE}
    echo "#################################" >> ${LOGFILE}
    echo ""

    3.改变文件权限
    [root@hailiang ~]# chmod 755 /etc/init.d/oracle

    4.添加服务
    [root@hailiang ~]# chkconfig --level 35 oracle on

    5.需要在关机或重启机器之前停止数据库,做一下操作
    [root@hailiang ~]# ln -s /etc/init.d/oracle /etc/rc0.d/K01oracle
    [root@hailiang ~]# ln -s /etc/init.d/oracle /etc/rc6.d/K01oracle

    6.重新启动
    [root@hailiang ~]#reboot

  • 相关阅读:
    android 之MediaPlayer MP3播放,VideoView 视频播放,MediaRecorder 录音
    IPHONE 开发 4 iPhone应用程序目录构成,工程项目的构成
    iPhone交流
    UILabel 用法
    跨网段 访问
    IPHONE 开发 8 Object C Foundation.h它包括所有的类 方法 集合,(id)init,iphone上使用Sqlite的注意事项小结
    查看与某一个表相关的视图、存储过程、函数
    IPHONE 开发 1 体系介绍
    android 之手机拨号器,以及短信发送器的简单实现
    Linux命令整理
  • 原文地址:https://www.cnblogs.com/kawashibara/p/8686390.html
Copyright © 2011-2022 走看看