Sqldeveloper ORA-12505. TNS: listener does not currently know of SID given in connect descriptor

oracleoracle-sql-developersqlplusUbuntu

There are similar questions asked and answered in this network related to the error message given in the question, however this problem is a little different from each.

I have installed oracle 12c in my ubuntu can successfully connect to my hr user with sqlplus hr/hr@pdborcl through command prompt.

oracle@ubuntu:~$ sqlplus hr/hr@pdborcl
SQL*Plus: Release 12.1.0.2.0 Production on Mon Nov 16 21:57:24 2015
Copyright (c) 1982, 2014, Oracle.  All rights reserved.
Last Successful login time: Mon Nov 16 2015 21:24:32 +05:45
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>show user;
USER is "HR"

I am however trying to use sqldeveloper for ease. In the create connection option in sqldeveloper when I give the following credentials

I get the following error.
enter image description here
ORA-12505. TNS: listener does not currently know of SID given in connect descriptor.

However connection with

Username: sys

Password: ******

SID:orcl

And same all other credentials work fine.

My tnsname.ora has

PDBORCL =
  (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = pdborcl)
   )
 )

ORCL =
 (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
  (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl)
  )
 )

Best Answer

You have to use Service Names to connect to Pluggable Databases in 12c.

It's just one of those things that can trip you up, I guess! SQL Plus connecting OK probably threw you.