zoukankan      html  css  js  c++  java
  • Oracle 开机自动启动设置

    步骤:

    1:查看ORACLE_HOME是否设置

    $ echo $ORACLE_HOME
    /u01/app/oracle/product/11.2.0/dbhome_1

    2:执行dbstart 数据库自带启动脚本

    [oracle@njdzjkdb ~]$ cd $ORACLE_HOME
    [oracle@njdzjkdb dbhome_1]$ cd bin/
    [oracle@njdzjkdb bin]$ dbstart
    ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener Usage: /u01/app/oracle/product/11.2.0/db_1/bin/dbstart ORACLE_HOME
    错误提示:ORACLE_HOME_LISTNER 没有设置
    
    [oracle@njdzjkdb bin]$ ll | grep dbs
    -rwxr-x---. 1 oracle oinstall 6088 1月 1 2000 dbshut
    -rwxr-x---. 1 oracle oinstall 13892 12月 11 16:01 dbstart
    
    编辑 dbstart,将ORACLE_HOME_LISTNER=$1修改成 ORACLE_HOME_LISTNER=$ORACLE_HOME 前提是$ORACLE_HOME环境设置正确
    
    [oracle@njdzjkdb bin]$ vi dbstart 
    
    ORACLE_HOME_LISTNER=/u01/app/oracle/product/11.2.0/dbhome_1

    3:编辑/etc/oratab文件

    dbca建库时都会自动创建/etc/oratab文件
    将orcl:/u01/app/oracle/product/11.2.0/dbhome_1:N
    修改成 orcl:/u01/app/oracle/product/11.2.0/dbhome_1:Y

    4:编辑/etc/rc.d/rc.local启动文件,添加数据库启动脚本dbstart

    [root@njdzjkdb ~]# vi /etc/rc.d/rc.local
    #!/bin/bash
    # THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
    #
    # It is highly advisable to create own systemd services or udev rules
    # to run scripts during boot instead of using this file.
    #
    # In contrast to previous versions due to parallel execution during boot
    # this script will NOT be run after all other services.
    #
    # Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
    # that this script will be executed during boot.
    
    touch /var/lock/subsys/local
    su oracle -lc "/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
    su oracle -lc /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart

    5:重启主机,查看数据库和监听是自启动

    6:查看数据库是否处于open状态

    select status from v$instance
  • 相关阅读:
    PAT Basic 1023 组个最小数 (20 分)
    PAT Advanced 1048 Find Coins (25 分)
    PAT Basic 1005 继续(3n+1)猜想 (25 分)
    PAT Advanced 1050 String Subtraction (20 分)
    PAT Advanced 1041 Be Unique (20 分)
    PAT Basic 1047 编程团体赛 (20 分)
    SpringSecurity整合SpringBoot
    给正在运行的Docker容器动态绑定卷组
    linux 中格式化json字符串
    docker/kubernetes国内源/镜像源解决方式
  • 原文地址:https://www.cnblogs.com/meiling12/p/8443823.html
Copyright © 2011-2022 走看看