码迷,mamicode.com
首页 > 数据库 > 详细

Centos7 设置oracle11G开机自动启动

时间:2020-04-17 15:22:13      阅读:318      评论:0      收藏:0      [点我收藏+]

标签:key   esc   rac   hat   system   tab   san   $path   eve   

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开机自动启动

标签:key   esc   rac   hat   system   tab   san   $path   eve   

原文地址:https://www.cnblogs.com/lvhongwei/p/12720022.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!