Q. My Oracle XE installation was working fine, but today I’m getting an error – which read as follows under Ubuntu Linux :


ORA-12154: TNS:could not resolve the connect identifier specified

How do I fix this problem without reinstalling Oracle?

A. Try following solutions:

Make sure DNS / host name resolution working fine

$ host oracle-server-ip
$ host oracle-server-hostname

Make sure /etc/resolv.conf and /etc/hosts and /etc/host.conf configured properly.

Make sure tnsnames.ora is configured properly:

Type the following command to login as oracle / dba user:
$ su - oracle
$ cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/
$ vi tnsnames.ora

Make sure hostname / IP is correctly defined and resolving perfectly:

# tnsnames.ora Network Configuration File:

XE =
    (ADDRESS = (PROTOCOL = TCP)(HOST = vivek-desktop)(PORT = 1521))

      (SID = PLSExtProc)

Make sure the host, port and service name specified are correct in listener.ora and above file:
$ cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/
$ vi listener.ora

My sample working file:

# listener.ora Network Configuration File:

    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /usr/lib/oracle/xe/app/oracle/product/10.2.0/server)
      (PROGRAM = extproc)

      (ADDRESS = (PROTOCOL = TCP)(HOST = vivek-desktop)(PORT = 1521))


Make sure firewall is not blocking TCP ports:
$ sudo iptables -L -n
If everything else failed try to trace problem by running strace:
$ su - oracle
$ strace -o /tmp/debug.sqlplus sqlplus user/password

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

12 comments… add one
  • Chandan May 4, 2015 @ 6:18

    Thank you for putting all the steps together for a quick check.But,
    I am currently facing a situation with the ORA-12154 error.
    I have checked all the things that you have listed up above but unable to find any resolution.
    My database mounted perfectly
    TNSPING is good
    I have also checked the TNSNAMES.ora and it is fine
    Listener configuration is good
    /etc/hosts, /etc/resolv.conf .. etc. everything is good but I am unable to connect to my database I am unable to understand what is the issue. Can you please help me in this.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.