Wrong hostname causing errors while starting listener

All posts relating to Oracle database administration.

Moderator: Tim...

Wrong hostname causing errors while starting listener

Postby ponic » Sat May 04, 2013 6:56 am

I am getting error when I am trying to connect to my database server from other machines, error is

Code: Select all
Io exception: The Network Adapter could not establish the connection

When I tried to do tnsping, I am getting error

Code: Select all
TNS-12545: Connect failed because target host or object does not exist

In my /etc/hosts my computer name is

Code: Select all
192.168.15.125  ol6.localdomain ol6

and in tnsnames.ora and listener.ora it is

Code: Select all
ol6-122.localdomain

so is that is causing the issue? If so how can I change my hostname in tnsnames and listner.ora?

Tried to start listener, getting the following errors

Code: Select all
lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-MAY-2013

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

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

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/ol6/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ol6-122.localdomain)(PORT=1521)))
TNS-12545: Connect failed because target host or object does not exist
 TNS-12560: TNS:protocol adapter error
  TNS-00515: Connect failed because target host or object does not exist
ponic
Senior Member
 
Posts: 160
Joined: Wed Mar 03, 2010 7:18 am

Re: Wrong hostname causing errors while starting listener

Postby Tim... » Sat May 04, 2013 7:29 am

Hi.

1) On the database server you must:

- Issue the "hostname" command and see what comes back.
- Make sure there is an entry on the "/etc/hosts" files for the hostname that is returned by the "hostname" command.
- Alter the listener.ora and tnsnames.ora files on the server, making sure any hostname references match that returned by the hostname command.
- Start the listener.

2) On any client that need to point to the DB:

- Amend the tnsnames.ora file to point to the correct hostsname.

That should be all you need to do.

Cheers

Tim...
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog
Tim...
Site Admin
 
Posts: 17940
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK

Re: Wrong hostname causing errors while starting listener

Postby ponic » Sat May 04, 2013 3:35 pm

Thanks Tim, it worked.

Regards
ponic
Senior Member
 
Posts: 160
Joined: Wed Mar 03, 2010 7:18 am

Re: Wrong hostname causing errors while starting listener

Postby Tim... » Sat May 04, 2013 9:07 pm

:)
Tim...
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OakTable Member
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: http://www.oracle-base.com
My blog: http://www.oracle-base.com/blog
Tim...
Site Admin
 
Posts: 17940
Joined: Mon Nov 01, 2004 5:56 pm
Location: England, UK


Return to Oracle Database Administration

Who is online

Users browsing this forum: No registered users and 2 guests

cron