Centos7 设置oracle11G开机自动启动
Posted Tooken
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
以上是关于Centos7 设置oracle11G开机自动启动的主要内容,如果未能解决你的问题,请参考以下文章