• 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

  • 相关阅读:
    Java并发编程:Lock
    java多线程中的生产者与消费者之等待唤醒机制@Version2.0
    java多线程中的生产者与消费者之等待唤醒机制@Version1.0
    vim 自动补全
    git 忽略文件的三种方式
    vim 查找整个工程
    vim 寄存器的使用
    我的vim插件列表
    web前端面试系列 一 js闭包
    web前端面试系列
  • 原文地址:https://www.cnblogs.com/kawashibara/p/8686390.html
Copyright © 2020-2023  润新知