Linux_CentOS_7.9_Oracle11gr2配置数据库及监听服务自启动多方案实操之简易记录

前言: 作为运维保障,都无法准确预估硬件宕机的突发阶段,其生产数据实时在产出,那作为dba数据库服务以及相关Listener的其重要性、必要性就突显而出。这里拿虚拟机试验做个配置记录,便于大家学习参考。

实现方法一:

环境变量值::$ORACLE_HOME= /data/oracle/product/11.2.0/db_1/
一、安装好Oracle数据库后: 完成配置执行dbstart和dbshut
[root@orcl3 ~]# su - oracle
[oracle@orcl3 ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /data/oracle/product/11.2.0/db_1/bin/dbstart ORACLE_HOME

在这里插入图片描述
错误原因:dbstart和dbshut脚本文件中ORACLE_HOME_LISTNER的设置有问题

[oracle@orcl3 ~]$ vim /data/oracle/product/11.2.0/db_1/bin/dbstart
[oracle@orcl3 ~]$ vim /data/oracle/product/11.2.0/db_1/bin/dbshut 

分别打开两个文件找到以下行并修改:

ORACLE_HOME_LISTNER=$1
修改为:
ORACLE_HOME_LISTNER=$ORACLE_HOME

在这里插入图片描述

二、Linux启动时自动启动Oracle监听和实例
1、修改/etc/oratab文件
[root@orcl3 data]# vim /etc/oratab
找到:   orcl:/data/oracle/product/11.2.0/db_1/:N   
修改为: orcl:/data/oracle/product/11.2.0/db_1/:Y

在这里插入图片描述
#----------------------------#
如果没有/etc/oratab文件,需要执行以下步骤(如有可直接跳过此步骤)
Root下执行以下脚本,生成/etc/oratab文件

[root@orcl3 ~]# /data/oracle/product/11.2.0/db_1/root.sh 
[root@orcl3 ~]# /data/oraInventory/orainstRoot.sh
[root@orcl3 ~]# /data/oracle/product/11.2.0/db_1/root.sh 
Performing root user operation for Oracle 11g 
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /data/oracle/product/11.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]: 
The contents of "dbhome" have not changed. No need to overwrite.
The contents of "oraenv" have not changed. No need to overwrite.
The contents of "coraenv" have not changed. No need to overwrite.

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions 

猜你喜欢

转载自blog.csdn.net/lookboydfw/article/details/135383310