Score:0

TNS:no listener - Installing oracle client on Ubuntu 22.04x86_64

bv flag

I am currently participating in a project where my task is to configure a connection from an Ubuntu 22.04x86_64 server to an internal Oracle DB server called myOracleDB.

First of all, a ping myOracleDB works fine, so the servers see each other. To rule out network problems we have also allowed all further connections on all ports in the meantime. So the next step was to install the oracle client. For this, I followed the installation on an older Ubuntu 16.04x86_64 server, where I can run sqlplus User@dbConn without any problems and everything works fine.

So, I first downloaded

  • oracle-instantclient19.6-basic-19.6.0.0.0-1.x86_64.rpm
  • oracle-instantclient19.6-devel-19.6.0.0.0-1.x86_64.rpm
  • oracle-instantclient19.6-odbc-19.6.0.0.0-1.x86_64.rpm
  • oracle-instantclient19.6-sqlplus-19.6.0.0.0-1.x86_64.rpm.

After that I converted them to debian packages using sudo alien --scripts --target="x86_64" and installed them sucessfully via sudo gdebi. With dpkg --list I now see

ii  oracle-instantcli 19.6.0.0.0-2  amd64         Oracle Instant Client Basic package
ii  oracle-instantcli 19.6.0.0.0-2  amd64         Development header files for Oracle Ins
ii  oracle-instantcli 19.6.0.0.0-2  amd64         Oracle Instant Client ODBC
ii  oracle-instantcli 19.6.0.0.0-2  amd64         Oracle Instant Client SQL*Plus package

Then I have configured the following:

  • cat /etc/ld.so.conf.d/oracle.conf gives /usr/lib/oracle/19.6/client64/lib/. (running sudo ldconfig as well)
  • export TNS_ADMIN=$ORACLE_PATH/network/admin with ORACLE_PATH=/usr/lib/oracle/19.6/client64/lib
  • Under $ORACLE_PATH/network/admin there is a tnsnames.ora containing

tnsnames.ora:

dbConn =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST =  myOracleDB)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = MYSN)
    )
  )

Finally I exported some variables: export

LD_LIBRARY_PATH=/usr/lib/oracle/$ORACLE_VER/client64/lib/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export ORACLE_HOME=$ORACLE_PATH
export ORACLE_SID=MYSN
export PATH=$PATH:$ORACLE_HOME/bin

With these settings, on my older server (Ubuntu 16.04) the connection works fine. However, when I'm using sqlplus User@dbConn on the current machine I get

ERROR:
ORA-12541: TNS:no listener

I may add the information that the old and current Ubuntu server are running in different subnets. Any ideas what may cause this problem? Again, the configuration files are definitely identical on both Ubuntu machines. Despite that, I also get the same error with instantclient versions other than 19.6 (e.g.: 21.7).

David avatar
cn flag
If I understand what you did. You built it on 16.04 a long gone EOL version of Ubuntu and then converted it to Debian an off topic non Ubuntu OS and then installed the apps you built onto a Ubuntu 22.04 machine.
Ai4l2s avatar
bv flag
I just mentioned the 16.04 server to show that the oracle database is listening and is working. On the Ubuntu 22.04 I built everything from scratch. However, I took the same version of the oracle instantclient (19.6) for the 22.04 installation that also seem to work with the "older" machine
David avatar
cn flag
Maybe need a newer client?
Ai4l2s avatar
bv flag
also tried the newst 21.7 oracle instantclient. same error
Bjarte Brandt avatar
cn flag
unset ORACLE_SID. This variable is used for IPC towards local Oracle Database processes. Make sure this one is successful: nc -vz myOracleDB 1521. Trace client syscalls (is tnsnames.ora picked up?): strace sqlplus u/p@TNSALIAS
Ai4l2s avatar
bv flag
nc -vz myOracleDB 1521 is successfull :/
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.