Beki
Beki

Reputation: 1766

Oracle: PDB created by DBCA does not update tnsnames.ora file, so there is no service to connect to (ORA-12514). Why?

I just created a pluggable database using Oracle's default Database Configuration Assistant:
Exact steps:

  1. Choose Manage Pluggable database
  2. Choose Create a Pluggable database
  3. Choose an available container created earlier (No username and password provided)
  4. Choose the default Create a new Pluggable database from another PDB (PDB$SEED selected)
  5. Give it a name (JUCHU_PDB), username, password
  6. Leave the default Create default user tablespace checked
  7. Confirm and Finish

I can confirm that it has been created. Status is normal

The problem is when I try to connect it via SQL Developer Tools (after restarting just in case), it is giving me ORA-12505 error.screenshot

Here is what my tnsnames.ora file looks like:

# tnsnames.ora Network Configuration File: C:\oracle19c\db_home\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.

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

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

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

LISTENER_ORCL =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))


LISTENER_MCF01 =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))


LISTENER_JUCHU =
  (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))


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

There is no service name called JUCHU_PDB.

Here is what lsnrctl status gives out:

LSNRCTL for 64-bit Windows: Version 19.0.0.0.0 - Production on 24-MAR-2022 16:53:50

Copyright (c) 1991, 2019, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 19.0.0.0.0 - Production
Start Date                24-MAR-2022 16:00:28
Uptime                    0 days 0 hr. 53 min. 21 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   c:\oracle19c\db_home\network\admin\listener.ora
Listener Log File         C:\oracle19c\diag\tnslsnr\BekiPC\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=BekiPC)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=BekiPC)(PORT=5500))(Security=(my_wallet_directory=C:\ORACLE19C\admin\orcl\xdb_wallet))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "27b3e285493242e3aba08ddd0564fa46" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "4dc420bf611146179e527cfa54e767d8" has 1 instance(s).
  Instance "juchu", status READY, has 1 handler(s) for this service...
Service "52448234712340b69f274bcc790ecfe0" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "8510a8f2f741499293d1fa8ffdb8566c" has 1 instance(s).
  Instance "juchu", status READY, has 1 handler(s) for this service...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "JUCHU" has 1 instance(s).
  Instance "juchu", status READY, has 1 handler(s) for this service...
Service "JUCHUXDB" has 1 instance(s).
  Instance "juchu", status READY, has 1 handler(s) for this service...
Service "MCF01" has 1 instance(s).
  Instance "mcf01", status READY, has 1 handler(s) for this service...
Service "MCF01XDB" has 1 instance(s).
  Instance "mcf01", status READY, has 1 handler(s) for this service...
Service "juchu_pdb" has 1 instance(s).
  Instance "juchu", status READY, has 1 handler(s) for this service...
Service "juchupdb" has 1 instance(s).
  Instance "juchu", status READY, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclpdb" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

Restarting did not help. What is going on? What am I missing here?

Upvotes: 0

Views: 924

Answers (2)

CamelTM
CamelTM

Reputation: 1250

Add to tnsnames.ora:

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

Upvotes: 1

in the connect screen from sqldeveloper you selected sid.

use service_name instead, and it will probably work.

Upvotes: 1

Related Questions