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 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 - 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: ******


And same all other credentials work fine.

My tnsname.ora has

   (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (SERVICE_NAME = pdborcl)

  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (SERVICE_NAME = orcl)

4 Answers 4


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.


I had the same problem. And I solved it by using SERVICE NAME (an alias) instead of SID:

1. Open file tnsnames.ora from your ORACLE_HOME folder. In case you don't know its location, do the following steps

Windows (open cmd)

> sqlplus // connect to sqlplus, login as sysdba
 as / sysdba
 // then type your password that you set in configuration setup step
 // next 3 lines used for getting ORACLE_HOME
 > var OHM varchar2(100);
 > EXEC dbms_system.get_env('ORACLE_HOME', :OHM);

Linux (open Terminal Ctrl+Alt+T)


tnsnames.ora is located at [Your_ORACLE_HOME]/Network/Admin. Open it with your editor.

2. In tnsnames.ora file, look for the line which contains the SERVICE_NAME

enter image description here

3. Select Service name and type above name, TEST success and you've done!

enter image description here


Hostname also gives this error: Instead of writing localhost there, try to type your "COMPUTER name" (for example: if you PC name is User_PC) write it User_PC the rest leave default!


You need to start the database to connect. Im using Express Edition 11g. I had faced the same problem. Problem disappears once you select Start Database option from Start>All Programs>Oracle 11g Express edition. Alternatively, you can go to the drive where you have installed oracle (in my case) D:/app/oracle/product/11.2.0/server/bin. Here you will find a Windows Batch File called StartDB. Double click on this and your database will start and your connections will test successfully.

Not the answer you're looking for? Browse other questions tagged or ask your own question.