Connect to remote oracle via cygwin sqlplus
I am trying to use cygwin sqlplus to connect to a remote oracle installation located at myserver.mycompany.com port 1530. When I try
sqlplus username@myserver.mycompany.com:1530/orcl
I am getting the error:
ORA-12154: TNS:could not resolve the connect identifier specified
When I install ORACLE_HOME
to / cygdrive/c/oracle/product/10.2.0/client_1
, I get another error:
Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
I can telnet connect to server port 1530 and SQL Developer installed locally can also connect to the database. What am I doing wrong?
source to share
I didn't know there is a cygwin native client for Oracle (correct me if I'm wrong, but I can't find any mention of this on the Oracle website). If you are using Cygwin with a Windows client, you need to use your own window path. It won't understand your path / cygdrive.
However, I have used Win32 Oracle clients with cygwin and got it working - the same shell scripts will work on Cygwin, Linux and Solaris.
source to share
No cygwin Oracle client. As stated above, use ORACLE_HOME set to window path.
In the first half of your question, try to see what the TNS_NAMES env variable is set to, and if it is not set, you may need to set it to the correct location. Usually it defaults to% ORACLE_HOME% / network / admin / tnsnames.ora. SQL Developer keeps its own copy of the tnsnames file, so you cannot answer this to fix this issue.
source to share
Combining the details with the other answers (which is a bit of me, so I'm posting it as a separate answer instead of comments):
$ORACLE_SID
and, if set, $TNS_ADMIN
(and possibly other Oracle variables related to move) should use Windows paths. Of course, your Cygwin variable $PATH
must use Cygwin ( /drives/c/โฆ
) notation . So I included in mine .bashrc
:
export ORACLE_HOME=c:\\Oracle\\product\\12.1.0\\dbhome_1
export TNS_ADMIN=d:\\Oracle\TNSAdmin
export PATH=$PATH:$(cygpath -u $ORACLE_HOME)/BIN
After that, I had no more problems calling for example. tnsping
or sqlplus
. Since the above is just an example, you should of course adjust the paths to reflect your setup / configuration :)
source to share
I have the same error as you,
you have to set not only ORACLE_HOME
in windows variables,
But also PATH
include%ORACLE_HOME%\bin
then you can open windows cmd,
try it sqlplus username/password@your_define_tnsname
if everything is ok then remove all settings ORACLE PATH
in cygwin, restart cygwin, try it.
if fail, should let sqlplus work well in windows cmd first
source to share