Bruno
Bruno

Reputation: 189

Listerner listening on wrong host (localhost)

I created a listener (using netca) called listener.

When I start the listener (using lsnrctl start) I have the following log.

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. Why is the listener listening on localhost and not on sakura ?!?

Here is my listener.ora file (where I clearly specify to use 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

Why did I do wrong ?

Thanks

Upvotes: 0

Views: 14031

Answers (2)

RodH
RodH

Reputation: 13

If you change your hostname: {newHostName}

Step 1. Check environment vars:

> 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

Step 2. Find in oracle installation dir (e.g. /oracle ) about "oldHostName" (e.g oracle_12C.localdomain) to view your hostname:

hostname grep -r "oracle_12C" /oracle

In my case I found these files to change it manually "oracle_12C.localdomain" with new "newHostName":

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

Step 3. Start instance: Go to sqlplus:

cd $ORACLE_HOME/bin sqlplus / AS SYSDBA SQL> STARTUP

Step 4. start listener {SID} e.g.:

cd $ORACLE_HOME/bin lsnrctl start ORCL

Step 5. Check result in console ... Service "ORCL" has 1 instance(s). ...

Upvotes: 0

Alex Poole
Alex Poole

Reputation: 191530

Expanded from comment

It appears that sakura is resolving to the same address as localhost.localdomain, i.e. 127.0.0.1. This suggests that there is an entry in the /etc/hosts that is mapping sakura to 127.0.0.1.

You can either:

  • remove that mapping;
  • change it to show an external IP address, if it doesn't resolve to one automatically;
  • change your listener.ora to use a fully-qualified domain name if you have one that resolves to the external IP, e.g. sakura.example.com;
  • or change your listener.ora to use the external IP address directly with no lookup.

The last option might be the simplest, unless you have a DHCP-assigned IP address; and os what @dseibert suggested.

Upvotes: 1

Related Questions