Linux hostname对Oracle实例以及监听的影响

在Linux平台中,对hostname的修改,是否对ORACLE数据库实例或监听进程有影响呢?如果有影响,又要如何解决问题呢?另外/etc/hosts下相关内容的修改,是否也会影响实例或监听呢?这里涉及的场景非常多,当然关系也非常复杂,我们下面通过几个例子来测试验证一下。

如下所示,服务器/etc/hosts 与/etc/sysconfig/network的原始配置信息如下

[[email protected] ~]# more /etc/hosts
# Do not remove the following line, or various programs

# that require network functionality will fail.

#::1            localhost6.localdomain6 localhost6

127.0.0.1       localhost.localdomain localhost

192.168.27.134  test test 

[[email protected] ~]# 

 

 

[[email protected] ~]# more /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=test

GATEWAY=192.168.27.1

[[email protected] ~]# 

1: 首先假设有个需求,需要修改hostname,使之变成test.edution.com(加上域名部分), 那么此时是否有问题呢?我们先修改/etc/sysconfig/network下的HOSTNAME,然后重启服务器

[[email protected] ~]# more  /etc/sysconfig/network
NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=test.eduction.com

GATEWAY=192.168.27.1

 

[[email protected] ~]# vi /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

#::1            localhost6.localdomain6 localhost6

127.0.0.1       localhost.localdomain localhost

192.168.27.134  test test

然后我们重启数据库实例后,并没有任何问题,但是重启监听的时候遇到下面错误:

[[email protected] ~]$ sqlplus / as sysdba
 

SQL*Plus: Release 10.2.0.5.0 - Production on Sat Jun 18 16:42:21 2016

 

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

 

Connected to an idle instance.

 

SQL> startup

ORACLE instance started.

 

Total System Global Area 1509949440 bytes

Fixed Size                  2096472 bytes

Variable Size            1392509608 bytes

Database Buffers           67108864 bytes

Redo Buffers               48234496 bytes

Database mounted.

Database opened.

SQL> exit

Disconnected from Oracle Database 10g Release 10.2.0.5.0 - 64bit Production

[[email protected] ~]$ lsnrctl start

 

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 18-JUN-2016 16:42:47

 

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

 

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

 

TNSLSNR for Linux: Version 10.2.0.5.0 - Production

Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.eduction.com)(PORT=1521)))

 

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

TNS-12535: TNS:operation timed out

 TNS-12560: TNS:protocol adapter error

  TNS-00505: Operation timed out

   Linux Error: 110: Connection timed out

[[email protected] ~]$ 

出现这个问题时,必须修改/etc/hosts下主机名的部分,使之与/etc/sysconfig/network下的HOSTNAME一致,上面错误就能解决。如下红色部分所示:

[[email protected] ~]# more /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=test.eduction.com

GATEWAY=192.168.27.1

[[email protected] ~]# more /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

#::1 localhost6.localdomain6 localhost6

127.0.0.1 localhost.localdomain localhost

192.168.27.134 test.eduction.com test

[[email protected] ~]#

由于这里测试,我修改了域名,如果服务器真实域名部分跟/etc/resolv.conf一致,那么数据库实例启动过程中,监控告警日志,就会发现告警日志里面会出现大量ORA-07445 & ORA-00108错误

2:修改/etc/sysconfig/network下的hostname并使之生效,如下所示

[[email protected] ~]$ more /etc/hosts
# Do not remove the following line, or various programs

# that require network functionality will fail.

#::1            localhost6.localdomain6 localhost6

127.0.0.1       localhost.localdomain localhost

192.168.27.134  test.eduction.com  test 

[[email protected] ~]$ more /etc/sysconfig/network

NETWORKING=yes

NETWORKING_IPV6=no

HOSTNAME=kerry.eduction.com

GATEWAY=192.168.27.1

数据库实例启动并没有任何问题,但是监听启动出现上面一样的错误。 如果域名使用真实的域名,则会遇到另外一种情况,告警日志里面也会出现下面错误

Errors in file /u01/app/oracle/admin/SCM2/bdump/scm2_ora_4494.trc:

ORA-07445: exception encountered: core dump [kslgetl()+120] [SIGSEGV] [Address not mapped to object] [0x000000210] [] []

ORA-00108: failed to set up dispatcher to accept connection asynchronously

关于这个,可以参考官方文档ORA-07445: [kslgetl()+80] Followed by ORA-108: failed to set up dispatcher to accept connection asynchronously (文档 ID 1298804.1)

3: 如果屏蔽/etc/hosts下的localhost部分,如下所示,此时有可能会影响监听

[[email protected] ~]# more /etc/hosts
# Do not remove the following line, or various programs

# that require network functionality will fail.

#::1            localhost6.localdomain6 localhost6

#127.0.0.1       localhost.localdomain localhost

192.168.27.134  kerry.eduction.com  kerry 

[[email protected] ~]# 

 

 

[[email protected] ~]$ lsnrctl start

 

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 18-JUN-2016 17:45:37

 

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

 

Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

 

TNSLSNR for Linux: Version 10.2.0.5.0 - Production

Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=kerry.eduction.com)(PORT=1521)))

 

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

TNS-12547: TNS:lost contact

 TNS-12560: TNS:protocol adapter error

  TNS-00517: Lost contact

   Linux Error: 104: Connection reset by peer

这是因为我没有在$ORACLE_HOME/network/admin下配置listener.ora,所以在注释或删除了/etc/hosts下localhost部分后就会出现这个错误,因为在没有listener.ora下的情况下,都会使用默认值(如下官方文档描述),监听进程会使用本机配置127.0.0.1注册监听服务,所以会出现上面错误信息,官方文档关于这方面的描述如下所示:

Oracle Net Listener Configuration Overview

Note:

Oracle Database 10g and later databases require a version 10 or later listener. Earlier versions of the listener are not supported for use with Oracle Database 10g and later databases. However, you can use a version 10 listener with previous versions of Oracle Database.

A listener is configured with one or more listening protocol addresses, information about supported services, and parameters that control its runtime behavior. The listener configuration is stored in a configuration file named listener.ora.

Because all of the configuration parameters have default values, it is possible to start and use a listener with no configuration. This default listener has a name of LISTENER, supports no services on startup, and listens on the following TCP/IP protocol address:

(ADDRESS=(PROTOCOL=tcp)(HOST=host_name)(PORT=1521))

Supported services, that is, the services to which the listener forwards client requests, can be configured in the listener.ora file or this information can be dynamically registered with the listener. This dynamic registration feature is called service registration. The registration is performed by the PMON process—an instance background process—of each database instance that has the necessary configuration in the database initialization parameter file. Dynamic service registration does not require any configuration in the listener.ora file.

解决方案两种:

1:在$ORACLE_HOME/network/admin/下配置listener.ora文件。则屏蔽或删除/etc/hosts下127.0.0.1后,监听不会有任何问题。

2:在配置文件/etc/hosts下增加localhost(红色部分所示)也能解决这个问题。

[[email protected] ~]# more /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

#::1 localhost6.localdomain6 localhost6

#127.0.0.1 localhost.localdomain localhost

192.168.27.134 kerry.eduction.com kerry localhost

[[email protected] ~]#

具体可以参考官方文档Starting TNS Listener or LSNRCTL Start Yields TNS-12541, Linux Error: 111: Connection Refused (文档 ID 343295.1)

另外,我们这里也忽略了lisnter.ora里面的配置,如果该配置文件使用的是hostname而不是IP,那么也会遇到一些问题。

时间: 2024-08-06 07:51:56

Linux hostname对Oracle实例以及监听的影响的相关文章

Linux下安装oracle遇到启动监听服务器启动失败

1.发现监听服务器没有启动,则  lsntctl start 启动监听服务器: 2.发现TNS-12555问题: 3.查找TNS-12555错误,找到一个满意的答案: chmod  777 /var/tmp/.oracle 4.重新启动监听服务器,启动成功!

Linux下启动Oracle服务和监听程序

注:如果读者是出现监听无法启动 请参阅本人实录解决办法:http://blog.csdn.net/johnstrive/archive/2009/08/06/4418481.aspx Oracle数据库是重量级的,其管理非常复杂,将其在Linux平台上的启动和关闭步骤整理一下. 安装完毕oracle以后,需要创建oracle系统用户,并在/home/oracle下面的.bash_profile添加几个环境变量:ORACLE_SID,ORACLE_BASE,ORACLE_HOME.比如: expo

配置Oracle数据库和监听随Linux系统自启动【转】

配置Oracle数据库和监听随Linux系统自启动 在某些情况下需要在Linux操作系统上提供一种无人值守的随机启动Oracle的功能,目的也许仅仅是为了帮助那些对Oracle细节非常不关心的朋友.当然,如果有可能,一定不要使用这种自动化的方法,因为有太多不确定的因素存在.正途还是一边手工启动数据库,一边监控alert日志,以便第一时间发现问题解决问题. Anyway,随Linux系统启动数据库还是有其存在价值的,下面通过这个小文儿给大家展示一下这个自动化过程. 1.确保“/etc/oratab

Linux下的启动oracle服务 启动监听 开放端口操作

尝试登录oracle 使用root用户将没有sqlplus命令 [[email protected] ~]# sqlplus /nolog bash: sqlplus: 未找到命令... [[email protected] ~]# su oracle [[email protected] root]$ sqlplus /nolog bash: sqlplus: 未找到命令... 切换为oracle账户尝试登录oracle 此处的/和as之间要有空格 而且只有用oracle账户登录才能生效 否则

Oracle非默认监听的处理会遇到的问题以及处理方法

第一种情况:只是修改默认端口 1.当前监听状态: C:\Windows\system32>lsnrctl status LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 05-3月 -2015 11:48:45 Copyright (c) 1991, 2010, Oracle. All rights reserved. 正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=zen

AIX下RAC搭建 Oracle10G(五)安装oracle、建立监听

AIX下RAC搭建系列 AIX下RAC搭建 Oracle10G(五)安装oracle.建立监听 环境 节点 节点1 节点2 小机型号 IBM P-series 630 IBM P-series 630 主机名 AIX203 AIX204 交换机 SAN光纤交换机 存储 SAN T3存储 大纲流程例如以下: 第一部分:主机配置 一.检測系统环境 二.网络配置 三.用户和组 四.网络參数调整 五.时间同步 六.卷组 第二部分:安装hacmp并配置 七.hacmp安装并配置 第三部分:安装CRS 八.

修改oracle 10g rac监听端口号为1523的步骤

修改oracle  10g rac监听端口号为1523的步骤 一. 修改listener.ora ,将其中的1521改为1523.事先做该文件的备份,以便快速复原 二. 修改tnsnames.ora ,将remote_listener对应的值 在 tnsnames.ora中的参数改为1523,事先做该文件的备份,以便快速复原 三. 修改local_listener数据库初始化参数 alter system set local_listener = '(ADDRESS = (PROTOCOL =

oracle 11g rac 监听程序offline

oracle 11g rac 监听程序在调整过网络后出现监听进程offline,而且两台节点之间频繁切换,查看日志/var/log/message 发现有频繁的注册撤销动作. 监听日志 /u01/app/oracle/diag/tnslsnr/rac1/listener/trace/listener.log监听文件 /u01/app/11.2.0/grid/network/admin/listener.oraoracle错误日志 /u01/app/oracle/diag/rdbms/oaorcl

Oracle 11g RAC 监听日常管理

需要必须掌握的命令,上周遇到了一个小问题,就是需要重启数据库监听,有的同学竟然使用oracle用户重启监听,原理就搞错了怎么行.以下操作都需要再grid用户下进行操作. 1.查看监听状态 <roidb2:+ASM2:/home/grid>$srvctl status listener Listener LISTENER is enabled Listener LISTENER is running on node(s): roidb1,roidb2 <roidb2:+ASM2:/home