I want to connect with my Oracle database without installing Oracle Client.
I downloaded:
- "Instant Client Package - Basic" and
- "Instant Client Package - SQL*Plus"
Then I created folder on C:\Oracle\instantclient
, where I extracted all packages.
I have been set system environment
like:
Path - C:\Oracle\instantclient
NSL_LANG - with properly key
ORACLE_HOME - C:\Oracle\instantclient
ORACLE_SID - C:\Oracle\instantclient
TNS_ADMIN - C:\Oracle\instantclient
Then I created tnsnames.ora
file with configuration in C:\Oracle\instantclient
and when I puted a command to cmd:
sqlplus user/password @HOST
I have a message like:
ERROR:
ORA-12560: TNS:protocol adapter error
but when I tried like:
sqlplus user/password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=address to host)(Port=1521))(CONNECT_DATA=(SID=address to SID)))
everything works properly. Why SQL have a problem with recognize tnsnames.ora file?
Your command should be:
with no space between the password and
@HOST
part.With the space it treats the
@HOST
as a script to execute once you've logged in, and it tries to connect locally, which produced that TNS error. (As you don't log in theHOST
isn't ever evaluated to establish if it exists, so it's effectively noise at this point).With the space removed it looks for
HOST
as a TNS alias:For me that still gets an error since I don't have
HOST
in mytnsnames.ora
, but it's a different error and you can see it's at least trying to use it as a TNS alias. If you have it defined properly it will be able to connect to your database.