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

How to enable Clients using SID to connect to PDB

In the CDB environment, if you use the PDB as SID in Connection string in TNS entry then it will give error because the PDB is not the instance name. Connection to the PDBs is possible with the service name and not SID.

Solution: there are two possible ways:

First you can use the service name in the TNS files instead of SID :

Example of tnsnames.ora file:

<my_alias> =
  (DESCRIPTION =
    (ADDRESS=(protocol = tcp)(HOST=hostname)(port = 1521))
    (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME = TEST))
  )

Second, If we want to use as SID then we need to configure one parameter :USE_SID_AS_SERVICE_<listerner_name> = ON” in Listener.ora file as follows and restart the listener

Example of listener.ora file:

LISTENER =
   (DESCRIPTION =
    (ADDRESS_LIST = (ADDRESS=(PROTOCOL=tcp)(HOST=<hostname.domain>)(PORT=1521))
   )

USE_SID_AS_SERVICE_LISTENER = ON

 

restart the listener after adding this parameter, then we can use the SID in tnsnames.ora file to connect with PDB databases.

Leave a Reply