Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

instant client not using tnsnames.ora

User_E8EN9Dec 12 2022

I'm using the docker oracle client as described in the official repo
However I can't connect to my oracle database based on my tnsnames.ora file.

For the client I've used this tnsnames.ora in default directory /usr/lib/oracle/21/client64/lib/network/admin/ :

XE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle-xe)(PORT = 1521))
)
(CONNECT_DATA =
(SID = XE)
(SERVICE_NAME = XE)
)
)
oracle-xe is the name of the docker container running my database (from official repo as well).

First I have to say that when I install ping to the docker client container, I can ping oracle-xe. Also I can connect to the database using sql developer from my windows. And from the oracle client docker container if I use this command line it works :

sqlplus userName/password@oracle-xe/XE

My problem is only when trying to connect using the tnsnames.ora inside the oracle client container.

Here is my command line to run the client : docker run -ti --network=sai --rm oracle-instant client bash

when I run sqlplus (without parameters) and after entering username/password I got this message :

ORA-12162: TNS:net service name is incorrectly specified

then if I set the ORACLE_SID variable (which shouldn't be needed since it's defined in the tnsnames.ora) I got this other error :

ORA-12545: Connect failed because target host or object does not exist

I've put my tnsnames.ora in the default directory: /usr/lib/oracle/21/client64/lib/network/admin

I've tried exporting the following variables :

export ORACLE_HOME=/usr/lib/oracle/21/client64/lib

export TNS_ADMIN=/usr/lib/oracle/21/client64/lib/network/admin

I've also tried ORACLE_HOME=/usr/lib/oracle/21/client64

but still have the same issue. visit here

I wanted to try tensing but it's not included in the oracle instant client and I didn't know where to find it. I tried using the one installed in the oracle database container but it's not working.

I hope someone can help me solve this issue

Comments
Post Details
Added on Dec 12 2022
3 comments
563 views