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

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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 12 comments so far... add one

CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
12 comments… add one
  • venu R May 19, 2008 @ 8:37

    Dear sir,

    Thank you for send the every time latest infomation on linux based and also do me some help to me.
    How do i install Oracle10g on RedHat Enterprises Linux 5 kindly send me the same with step by step.

    Thanks & Regards,
    Venu R,
    IT Dept,
    Avantha Technologies Ltd

    • Ashwin Patel Jan 30, 2011 @ 1:03

      Send me an email, i’ll send you complete step by step installation of Oracle 10g on Linux RHEL3, 4 , 5 , 6. Also its the same procedure to install 11g.

      Ashwin Patel

  • Raju ponthapillli Jan 9, 2009 @ 4:41

    this solution very useful to biggners to change listener.ora and tnsnames.ora file
    to configure system

  • manoj kulkarni Mar 7, 2011 @ 10:13

    i have configure SDU and TDU configuration in tnsnames.ora and listener.ora
    file to increase the network performance , but now iam getting error code 12154 while connecting through sqlplus…………. my all syntax for the above files are correct there is no any spell mistake.

    please giude me.

    manoj kulkarni
    microstop infotech.

  • zbhknight Oct 1, 2011 @ 3:29

    So strange, it always reports an error which says TNS-12533 illegal address parameters
    I have get the debugging file, but I don’t know how to analyse it.

  • Suresh.Rapaka Jan 18, 2012 @ 5:20


    Even i did all modifications, getting same error…

    Can you help me more in this issue ?

    Thanks in advance


  • nbs Mar 12, 2012 @ 6:47

    i also have this problem. how to solve this problem.

  • preetha Apr 11, 2012 @ 15:42

    $ su – oracle
    $ cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/network/admin/
    $ vi tnsnames.ora
    where to type these commands and how to check?

  • preetha Apr 11, 2012 @ 15:46

    $ host oracle-server-ip
    $ host oracle-server-hostname
    where to type these command and how to check?

  • Javed May 14, 2012 @ 7:34

    Clean some space on disk.

  • ahmed Oct 30, 2013 @ 10:14

    thank you from the answer

  • 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.

Use HTML <pre>...</pre> for code samples. Problem posting comment? Email me @ webmaster@cyberciti.biz