RedHat(Linux) Oracle数据库设置开机自启动

Posted ClarkYu

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RedHat(Linux) Oracle数据库设置开机自启动相关的知识,希望对你有一定的参考价值。

1 首先修改/etc/oratab文件添加如下行:
ycr:/u01/app/oracle/product/12.1.0/dbhome_1:Y




关于/etc/oratab文件解释如下:
# 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:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third field 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.
#
#
ycr:/u01/app/oracle/product/12.1.0/dbhome_1:Y
上面三个参数的意义分别为,实例名、ORACLE HOME、是否允许使用dbstart启动数据库


2 修改文件/etc/rc.d/rc.local,添加如下行:
su oracle -lc "/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl start"
su oracle -lc "/u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart"


关于rc.local解释如下:
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don‘t
# want to do the full Sys V style init stuff.


touch /var/lock/subsys/local
su oracle -lc "/u01/app/oracle/product/12.1.0/dbhome_1/bin/lsnrctl start"
su oracle -lc "/u01/app/oracle/product/12.1.0/dbhome_1/bin/dbstart"

/etc/rc.d/rc.local做为初始化脚本中,的最后一个随开机启动。
















































以上是关于RedHat(Linux) Oracle数据库设置开机自启动的主要内容,如果未能解决你的问题,请参考以下文章

linux oracle 怎么创建新的数据库

QtSql编程RedHat linux系统下oracle数据库中文乱码

Redhat6.5安装oracle11g

Oracle11g(RedHat Enterprise Linux6.7)-ASM

Linux-Oracle 安装配置步骤

实现Redhat Linux 6和Windows通过Windows Server AD统一认证并共享访问Oracle ZS存储系统