首页

关于设置oracle在centos的linux操作系统下开机自动启动服务配置步骤整理

标签:oracle,centos,linux,开机配置,自动启动,rc.local,rc.d     发布时间:2018-09-01   

一、前言

关于在centos的linux操装系统安装oracle数据库,安装的详细步骤参见"在Centos6.7系统上安装Oracle11gR2详细步骤"相关文章,下面关于系统启动使oracle实例监听等相关服务自动运行启动。

二、配置步骤

1. oratab配置为N为Y

[root@centos6 etc]# vim  /home/oracle/app/oracle/product/11.2.0/dbhome_1/install/oratab@b@#xwood:/home/oracle/app/oracle/product/11.2.0/dbhome_1:N@b@xwood:/home/oracle/app/oracle/product/11.2.0/dbhome_1:Y

2. 设置oracle监听开机lsnrctl启动、dbstart服务启动为开机启动(oracle为安装oracle用户)

[root@centos6 ~]# vi  /etc/rc.d/rc.local @b@#!/bin/sh@b@#@b@# This script will be executed *after* all the other init scripts.@b@# You can put your own initialization stuff in here if you don't@b@# want to do the full Sys V style init stuff.@b@@b@touch /var/lock/subsys/local@b@@b@su oracle -lc "/home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"@b@@b@su oracle -lc /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart

3. 设置/etc/rc.d/rc.local 和 listener.log权限

[root@centos6 bin]# sudo  chmod  +x  /etc/rc.d/rc.local @b@[root@centos6 bin]# cd /home/oracle/app/oracle/product/11.2.0/dbhome_1/@b@[root@centos6 dbhome_1]# sudo  chmod  755  listener.log

4. 编辑dbstart - 设置ORACLE_HOME_LISTNER=$1 为ORACLE_HOME_LISTNER=$ORACLE_HOME

[root@centos6 dbhome_1]# vim  /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart@b@..@b@#ORACLE_HOME_LISTNER=$1@b@ORACLE_HOME_LISTNER=$ORACLE_HOME@b@..

修改dbstart文件的ORATAB - 将ORATAB=/etc/oratab 改为 ORATAB=/home/oracle/app/oracle/product/11.2.0/dbhome_1/install/oratab

[root@centos6 dbhome_1]# vim  /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/dbstart@b@..@b@#ORATAB=/etc/oratab@b@ORATAB=/home/oracle/app/oracle/product/11.2.0/dbhome_1/install/oratab@b@..

5. reboot重启系统,测试ok