How do I use sqlplus connect string?

702    Asked by DaniloGuidi in SQL Server , Asked on Sep 29, 2022

Let's say I have an Oracle database. I have a username = x, password = y, database = z. Also I know the port = a, SID = b, Hostname = c.

So how do I need to connect correctly? I used many options like:

sqlplus x/y@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=c)(PORT=a))(CONNECT_DATA=(SID=z)(SERVER=DEDICATED)))'

sqlplus (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=c)(PORT=a))(CONNECT_DATA=(SID=b)))

Submitting these command lines usually gives me back error messages like:

ORA-12560: TNS:protocol adapter error

ORA-12514: TNS:listener does not currently know of service


Answered by Danna sahi

For sqlplus connect string, you should try:


sqlplus username/password@host:port/service

sqlplus x/y@c:a/b

modern versions of sqlplus (version 11 or newer) understand this syntax and you don't need a tnsnames.ora file.



Your Answer

Interviews

Parent Categories