I want to connect with my Oracle database without installing Oracle Client.
I downloaded:
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?
The easy way to connect to oracle without tnsnames.ora is using EZCONNECT or you can say Oracl’ easy connect naming method.We can connect to oracle database across TCP/IP network. C:\Users\Amit.S>sqlplus scott/192.168.0.119:1521/orcl SQL*Plus: Release 11.2.0.3.0 Production on Tue aug 12 17:34:03 2020 Copyright (c) 1982, 2011, Oracle.
the tnsnames.ora file is found either in one of the default locations ($ORACLE_HOME/network/admin, /var/opt/oracle, etc) OR we might use the TNS_ADMIN environment variable to find it. Suppose you connected to oracle on the server using "sqlplus user/password".
It isn't. and you can connect to an Oracle database (you do not conect to "sqlplus", sqlplus is a program, not a server), using that ezconnect method IF and ONLY IF it has been configured on the server. Read the above page for information on that.
u can connect to sqlplus using the below syntax. No need to have a connect_identifier in tns.ora "U" is dead, look it up, you'll see. You sound like a 12 year old when YOU use "U" as a "word".
Your command should be:
sqlplus user/password@HOST
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 the HOST
isn't ever evaluated to establish if it exists, so it's effectively noise at this point).
C:\>sqlplus -l -s x/y @HOST
ERROR:
ORA-12560: TNS:protocol adapter error
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
With the space removed it looks for HOST
as a TNS alias:
C:\>sqlplus -l -s x/y@HOST
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
SP2-0751: Unable to connect to Oracle. Exiting SQL*Plus
For me that still gets an error since I don't have HOST
in my tnsnames.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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With