监听器侦听错误的主机(localhost)

时间:2012-06-24 22:07:03

标签: oracle localhost listener

我创建了一个名为listener的监听器(使用netca)。

当我启动监听器(使用lsnrctl start)时,我有以下日志。

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 24-JUN-2012 17:56:35

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

Starting /opt/oracle/eesrv/11.2.0/db1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /opt/oracle/network/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/sakura/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=sakura)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                24-JUN-2012 17:56:35
Uptime                    0 days 0 hr. 0 min. 10 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/network/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/sakura/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
The listener supports no services
The command completed successfully

Q值。为什么监听器在本地主机上而不是在樱花上监听?!?

这是我的listener.ora文件(我明确指定使用sakura):

  

TRACE_DIRECTORY_PROD = /var/opt/oracle/otk/1.0/log/network/trace

     

SUBSCRIBE_FOR_NODE_DOWN_EVENT_PROD = OFF

     

LISTENER =(DESCRIPTION_LIST =       (DESCRIPTION =         (ADDRESS =(PROTOCOL = TCP)(HOST = sakura)(PORT = 1521))       ))

     

ADR_BASE_LISTENER = / opt / oracle

     

LOG_DIRECTORY_PROD = /var/opt/oracle/otk/1.0/log/network

为什么我做错了?

由于

2 个答案:

答案 0 :(得分:1)

扩展自评论

sakura似乎正在解析与localhost.localdomain相同的地址,即127.0.0.1。这表明/etc/hosts中有一个将sakura映射到127.0.0.1的条目。

你可以:

  • 删除该映射;
  • 将其更改为显示外部IP地址,如果它没有自动解析为;
  • 如果您有一个解析为外部IP的域名,请将listener.ora更改为使用完全限定的域名,例如: sakura.example.com;
  • 或更改您的listener.ora以直接使用外部IP地址而无需查找。

最后一个选项可能是最简单的,除非你有一个DHCP分配的IP地址;以及@dseibert建议的那些。

答案 1 :(得分:0)

如果您更改主机名:{newHostName}

步骤1.检查环境变量:

> export ORACLE_HOSTNAME={newHostName}
> export ORACLE_UNQNAME=ORCL
> export ORACLE_BASE=/oracle
> export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
> export ORACLE_SID=ORCL

第2步。在oracle安装目录(例如/ oracle)中找到有关“ oldHostName”的信息(例如oracle_12C.localdomain) 查看您的主机名:

  

主机名   grep -r“ oracle_12C” / oracle

对于我来说,我发现这些文件是使用新的“ newHostName”对其进行手动更改的“ oracle_12C.localdomain”:

File 1) /oracle/product/12.1.0/db_1/install/chainedInstall/globalcontext.xml
File 2) /oracle/product/12.1.0/db_1/inventory/Components21/oracle.rdbms.scheduler/12.2.0.1.0/context.xml
File 3) /oracle/product/12.1.0/db_1/inventory/Components21/oracle.ldap.client/12.2.0.1.0/context.xml
File 4) /oracle/product/12.1.0/db_1/inventory/Components21/oracle.server/12.2.0.1.0/context.xml
File 5) /oracle/product/12.1.0/db_1/inventoy/Clone/clone.xml

第3步。启动实例: 转到sqlplus:

  

cd $ ORACLE_HOME / bin   sqlplus / AS SYSDBA   SQL>启动

第4步。启动监听器{SID} 例如:

  

cd $ ORACLE_HOME / bin   lsnrctl启动ORCL

第5步。在控制台中检查结果 ... 服务“ ORCL”具有1个实例。 ...