I have oracle database Oracle Database 12c Enterprise Edition 12.2.0.1.0, and I created a pluggable database named DEVDB to use it in web application development, I created it using the Database Configuration Assistant, during the creation process I created a user/password to connect to that DB, then I modified the file tnsnames.ora adding this:
DEVDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = devdb)
)
)
Using DBeaver or SQL developer I can connect to the PDB successfully as you can see in the image blow:
but when I try to connect to the DB trying this from sqlplus command line:
sql> conn user/password@DEVDB
I get the following error message:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Warning: You are no longer connected to ORACLE.
This is show pdbs
command result:
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 ORCLPDB READ WRITE NO
4 DEVDB READ WRITE NO
I reloaded lsnrctl
many times and tried again but I get the same error.
I would like to be able to connect the PDB from sqlplus command line and understand the cause of that error
Any help please ??