Centos7 设置oracle11G开机自动启动

Centos7 设置oracle11G开机自动启动

1.vim /etc/oratab

把orcl:/data/oracle/product/11.2.0/db_1:N

修改成orcl:/data/oracle/product/11.2.0/db_1:Y

2.vim 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 -c /data/oracle/product/11.2.0/db_1/bin/lsnrctl start
su - oracle -c /data/oracle/product/11.2.0/db_1/bin/dbstart

 

3.新建文件

vim /etc/init.d/oracle

 


#!/bin/sh
# chkconfig: 345 61 61
# description: Oracle 11g R2 AutoRun Servimces
# /etc/init.d/oracle
#
# Run-level Startup script for the Oracle Instance, Listener, and
# Web Interface
export ORACLE_BASE=/data/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=ORCL
export PATH=$PATH:$ORACLE_HOME/bin
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
su $ORA_OWNR -lc $ORACLE_HOME/bin/dbstart

 

上一篇:完全卸载oracle11g步骤


下一篇:Oracle11g的安装(详细版)