Connect to sql plus from command line using connection string Let's say I have a 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


Many thanks in advance!!
did you 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.