Search code examples
oracle-databaseoracle12cdatabase-administration

Need Help To Resolve ORA-12154


I installed Oracle 12cR2. Everything is fine. Connected as SYS, Successful.

Now, what I did is changed my Container DB i.e. CDB$ROOT to ORCLPDB (Using Alter Session). And Created a User Called demo with password. Granted necessary permissions. Successful.

In that same session, I tried to connect to demo User, but unable to connect to it.

Error Shows as Follow:

ORA-12154: TNS:could not resolve the connect identifier specified.

How can I resolve this issue?
(Note: The user is in PDB)

tnsnames.ora

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

Solution

    • you are trying to connect to Demo/Password@ORCLPDB
    • there is no alias ORCLPDB in your tnsnames.ora, so Oracle complains that it can't find it
    • therefore:
      • connect to Demo/Password@ORCL (as you have ORCL in tnsnames.ora), or
      • modify the file and
        • add the new database alias (ORCLPDB) if it is a different database, or
        • add yet another alias for the same database, e.g. ORCL, ORCLPDB = ...