如果/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.
编辑/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
执行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
编辑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
[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
# vi startAdmin.sh
nohup ./home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/startWebLogic.sh > /dev/null 2>&1 &
# vi startManagedServer_hmfms.sh
nohup ./home/weblogic/Oracle/Middleware/user_projects/domains/base_domain/bin/startManagedWebLogic.sh hmfms > /dev/null 2>&1 &
[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