• 设置linux下oracle开机自启动


    1.修改配置文件,vi /etc/oratab

    orcl:/u01/app/oracle/product/11.2.0/db_1:Y

    2.创建启动文件,/etc/init.d/

    #!/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.0/db_1
    ORA_OWNER=oracle 
    if [ ! -f $ORA_HOME/bin/dbstart ] 
    then 
    echo "Oracle startup: cannot start" 
    exit 
    fi 
    case "$1" in 
    'start') 
    # Start the Oracle databases: 
    echo "Starting Oracle Databases ... " 
    echo "-------------------------------------------------" >> /var/log/oracle 
    date +"%Y-%m-%d %H:%M:%S : Starting Oracle Databases as part of system up." >> /var/log/oracle 
    echo "-------------------------------------------------" >> /var/log/oracle 
    su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORACLE_HOME" >>/var/log/oracle 
    echo "Done" 
    # Start the Listener: 
    echo "Starting Oracle Listeners ... " 
    echo "-------------------------------------------------" >> /var/log/oracle 
    date +"%Y-%m-%d %H:%M:%S : Starting Oracle Listeners as part of system up." >> /var/log/oracle 
    echo "-------------------------------------------------" >> /var/log/oracle 
    su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" >>/var/log/oracle 
    echo "Done." 
    echo "-------------------------------------------------" >> /var/log/oracle 
    date +"%Y-%m-%d %H:%M:%S : Finished." >> /var/log/oracle 
    echo "-------------------------------------------------" >> /var/log/oracle 
    touch /var/lock/subsys/oracle 
    
    'stop') 
    # Stop the Oracle Listener: 
    echo "Stoping Oracle Listeners ... " 
    echo "-------------------------------------------------" >> /var/log/oracle 
    date +"%Y-%m-%d %H:%M:%S : Stoping Oracle Listener as part of system down." >> /var/log/oracle 
    echo "-------------------------------------------------" >> /var/log/oracle 
    su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop" >>/var/log/oracle 
    echo "Done." 
    rm -f /var/lock/subsys/oracle 
    # Stop the Oracle Database: 
    echo "Stoping Oracle Databases ... " 
    echo "-------------------------------------------------" >> /var/log/oracle 
    date +"%Y-%m-%d %H:%M:%S : Stoping Oracle Databases as part of system down." >> /var/log/oracle 
    echo "-------------------------------------------------" >> /var/log/oracle 
    su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORACLE_HOME" >>/var/log/oracle 
    echo "Done." 
    echo "" 
    echo "-------------------------------------------------" >> /var/log/oracle 
    date +"%Y-%m-%d %H:%M:%S : Finished." >> /var/log/oracle 
    echo "-------------------------------------------------" >> /var/log/oracle 
    
    'restart') 
    $0 stop 
    $0 start 
    
    esac 

    3.给刚建的脚本赋予可执行权限

    chmod a+x oracle

    4.添加oracle服务

    chkconfig --level 35 oracle on

    5.创建软连接

    #关机时关闭数据库
    ln -s /etc/init.d/oracle /etc/rc0.d/K01oracle
    
    #重启时关闭数据库
    ln -s /etc/init.d/oracle /etc/rc6.d/K01oracle

    6.使用方法

    #启动oracle
    service oracle start
    
    #关闭oracle
    service oracle stop
    
    #重启oracle
    service oracle restart
  • 相关阅读:
    CCCC L2-023. 图着色问题【set去重判不同种类个数/简单图论/判断两相邻点是否存在同色以及颜色个数】
    百练 04 简单的整数划分问题
    NYOJ90 整数划分(经典递归和dp)
    图遍历问题
    图着色问题
    Java 大数(整数+浮点数) 基本函数
    根据规律绘制图形(俗称蛇皮走位)
    KMP算法之我见
    CCCC L1-039. 古风排版【图形输出/循环控制行列/模拟/细节】
    HYSBZ 2818 Gcd【欧拉函数/莫比乌斯】
  • 原文地址:https://www.cnblogs.com/wolil/p/5567563.html
Copyright © 2020-2023  润新知