ORA-12154: TNS:could not resolve the connect identifier specified
Dears ,
i've created a docker image from oracle instant client for both versions "19 && 12.2.0.1" but i'm always receiving the below error ORA-12154: TNS:could not resolve the connect identifier specified.
i've copied the tnsnames.ora sqlnet.ora into /usr/lib/oracle/12.2/client64/lib/network/admin/.
Image build command : docker build --pull -t oracle/instantclient:12 .
Run command : docker run -ti --rm oracle/instantclient:12 sqlplus username@DBNAME
SQL*Plus: Release 12.2.0.1.0 Production on Mon Jun 29 14:21:45 2020
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Enter password: ERROR: ORA-12154: TNS:could not resolve the connect identifier specified
Docker file FROM oraclelinux:7-slim
ADD oracle-instantclient*.rpm /tmp/ COPY tnsnames.ora sqlnet.ora /usr/lib/oracle/12.2/client64/lib/network/admin/
RUN yum -y install /tmp/oracle-instantclient*.rpm &&
yum -y install iputils &&
yum -y install vim &&
rm -rf /var/cache/yum &&
rm -f /tmp/oracle-instantclient*.rpm &&
echo /usr/lib/oracle/12.2/client64/lib > /etc/ld.so.conf.d/oracle-instantclient12.2.conf &&
ldconfig
ENV PATH=$PATH:/usr/lib/oracle/12.2/client64/bin ENV ORACLE_HOME /usr/lib/oracle/12.2/client64 ENV TNS_ADMIN /usr/lib/oracle/12.2/client64/lib/network/admin ENV LD_LIBRARY_PATH /usr/lib/oracle/12.2/client64/lib
CMD ["sqlplus", "-v"]
Please make sure that in sqlnet.ora the parameter NAMES.DIRECTORY_PATH includes TNSNAMES. Turn on tracing will help you identify where is error in locating the tnsnames.ora.
@mostafamahmoud2015, your DBNAME TNS name cannot be resolved. Did you add the parameter NAMES.DIRECTORY_PATH as suggested by @onmp?
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
@gvenzl @onmp @cjbj I am facing the same issue. Please find the docker file below,
FROM ghcr.io/oracle/oraclelinux8-instantclient:21
RUN sqlplus username/password@"hostname:port/dbname"
I'm getting the following error.
SQL*Plus: Release 21.0.0.0.0 - Production on Tue Feb 7 10:38:31 2023
Version 21.9.0.0.0
Copyright (c) 1982, 2022, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
I don't have anything under network/admin except the Readme file. Should I need to create the tnsnames.ora and sqlnet.ora manually? If so, please help me with the contents of it.
Note : The same sqlplus command works in local machine without any additional settings. Only fails inside the docker.