ORA-12504: TNS:listener was not given I created container orcl2 database with pluggable database pdborcl2. When I try to connect 

SQL&gt; connect system@pdborcl2


I get this error: 


  ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA


My tnsnames.ora look as follows:

ORCL2 =  (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
  (SERVER = DEDICATED)
  (SERVICE_NAME = orcl2.localhost))) 
PDBORCL2 = (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pdborcl2.localhost)))


I can normally connect to orcl2 with:

SQL&gt; connect system@orcl2
You have CONNECT DATA instead of CONNECT_DATA (space instead of underscore). Fix that, and try again.