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

  • 相关阅读:
    git常用命令总结
    sublime text文本中文显示繁体字修改设置
    正则表达式规则玩法
    网址总结
    维度灾难的问题
    Mybatis使用Map当做参数获取插入数据成功后返回的自增id
    Cenos7安装破解jira
    Linux下安装mysql-5.7.28详细步骤
    使用通用mapper时报错,tk.mybatis.mapper.MapperException:无法获取实体类xxx对应的表名!
    Mysql插入数据时,报错this is incompatible with sql_mode=only_full_group_by
  • 原文地址:https://www.cnblogs.com/kawashibara/p/8686390.html
Copyright © 2011-2022 走看看