• Weblogic+Oracle11g设置开机自启动


    一、Oracle设置开机自启动

    1、编辑/etc/oratab文件

    如果/etc/oratab文件不存在,则需要使用root用户进入ORACLE_HOME目录执行root.sh

    [root@localhost ~ ]# cd $ORACLE_HOME
    [root@localhost dbhome_1]# sh root.sh 
    Performing root user operation for Oracle 11g 
    
    The following environment variables are set as:
        ORACLE_OWNER= oracle
        ORACLE_HOME=  /home/oracle/app/oracle/product/11.2.0/dbhome_1
    
    Enter the full pathname of the local bin directory: [/usr/local/bin]: 
       Copying dbhome to /usr/local/bin ...
       Copying oraenv to /usr/local/bin ...
       Copying coraenv to /usr/local/bin ...
    
    
    Creating /etc/oratab file...
    Entries will be added to the /etc/oratab file as needed by
    Database Configuration Assistant when a database is created
    Finished running generic part of root script.
    Now product-specific root actions will be performed.
    Finished product-specific root actions.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    编辑/etc/oratab文件,添加bxdb:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y

    # This file is used by ORACLE utilities.  It is created by root.sh
    # and updated by either Database Configuration Assistant while creating
    # a database or ASM Configuration Assistant while creating ASM instance.
    
    # A colon, ':', is used as the field terminator.  A new line terminates
    # the entry.  Lines beginning with a pound sign, '#', are comments.
    #
    # Entries are of the form:
    #   $ORACLE_SID:$ORACLE_HOME::
    #
    # The first and second fields are the system identifier and home
    # directory of the database respectively.  The third filed indicates
    # to the dbstart utility that the database should , "Y", or should not,
    # "N", be brought up at system boot time.
    #
    # Multiple entries with the same $ORACLE_SID are not allowed.
    #
    #
    
    bxdb:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

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

    执行dbstart

    [oracle@localhost ~]$ cd $ORACLE_HOME
    [oracle@localhost dbhome_1]$ cd bin
    [oracle@localhost bin]$ dbstart
    ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
    Usage: ./dbstart ORACLE_HOME
    Processing Database instance "bxdb": log file /home/oracle/app/oracle/product/11.2.0/dbhome_1/startup.log
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    编辑dbstart,将ORACLE_HOME_LISTNER= 将 O R A C L E H O M E L I S T N E R = 将ORACLE_HOME_LISTNER= ORACLEHOMELISTNER=ORACLE_HOME

    [oracle@localhost bin]$ vi dbstart
    ORACLE_HOME_LISTNER=$ORACLE_HOME
    
    • 1
    • 2

    3、编辑/etc/rc.d/rc.local文件,添加oracle启动脚本

    [root@localhost dbhome_1]# cd /etc/rc.d/
    
    [root@localhost rc.d]# vi 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 "/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
    su oracle -lc /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    二、WebLogic设置开机自启动

    1、编写启动主控脚本

    # vi startAdmin.sh
    nohup ./home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/startWebLogic.sh > /dev/null 2>&1 &
    
    • 1
    • 2

    2、编写启动受管服务脚本

    # vi startManagedServer_hmfms.sh
    nohup ./home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/bin/startManagedWebLogic.sh hmfms > /dev/null 2>&1 &
    
    • 1
    • 2

    3、编辑/etc/rc.d/rc.local文件,添加weblogic启动脚本

    [root@localhost dbhome_1]# cd /etc/rc.d/
    
    [root@localhost rc.d]# vi 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 weblogic -lc /home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/startAdmin.sh
    su weblogic -lc /home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/startManagedServer_hmfms.sh
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
  • 相关阅读:
    大模型在语音识别领域的最新进展与挑战
    Java网络编程、TCP、UDP、Socket通信---初识版
    一夜之间,3.0万 Star,全部清零。。
    (附源码)ssm客户信息管理系统 毕业设计 281609
    零基础Linux_6(开发工具_下)函数库链接+Makefile+实现进度条+Git
    深度学习-【目标检测】学习笔记 COCO数据集介绍及pycocotools简单使用
    jquery的隐藏和显示
    PDF文件如何设置密码保护?
    GPT-3/ChatGPT复现的经验教训
    【Linux】linux系统VIM简介_使用
  • 原文地址:https://blog.csdn.net/lhy030320999/article/details/126302048