I am trying to connect to an Oracle database from SQLPLUS using service_name but I received the
ORA-12154 error (ORA-12154: TNS:could not resolve the connect identifier specified.
NOTE: when I am using the SQL Developer, everything works fine.
here it is my tnsnames.ora settings:
SAMPLEDB =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = sampledb)
)
)
This is the connection command I use:
sqlplus test/password@localhost:1521/sampledb
Can someone tell me what am I doing wrong, please?
Besides the obvious (the command to start SQL*Plus is, of course,
sqlplus
), you are missing a line in the definition of theSAMPLEDB
connect identifier.Insert between the first and the second line the following line (EXACTLY as written below):
You must have deleted it somehow.