How to fix Oracle database 19c create pluggable database failing with ORA-65149: PDB name conflicts with existing service name in the CDB or the PDB

Oracle database 19c pluggable database cloning issues:

Create pluggable database command failing with error: 

SQL> create pluggable database "PROD" using '/oracle_home/19.0.0/dbs/PROD_PDB1.xml' NOCOPY;

create pluggable database "PROD" using '//oracle_home/19.0.0/dbs/PROD_PDB1.xml' NOCOPY

                          *

ERROR at line 1:

ORA-65149: PDB name conflicts with existing service name in the CDB or the PDB


Fix:

Connect CDB: sqlplus / as sysdba

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO


Below select query shows PDB name already exists:

SQL> select name, network_name, con_id# from cdb_service$;

NAME                      NETWORK_NAME                           CON_ID#

------------------------- ----------------------------------- ---------

PROD                    PROD                                       1

PRODCD                  PRODCD                                      1

SQL>


Stop service using below (replace PDB name PROD with your PDB name):

BEGIN

  DBMS_SERVICE.STOP_SERVICE ('PROD');

  END;

  /

    

Run below select query:


SQL> SELECT UTL_RAW.CAST_TO_RAW(NAME) FROM CDB_SERVICES WHERE NAME LIKE 'PROD';


UTL_RAW.CAST_TO_RAW(NAME)

-------------------------------------------------------------

43524D58424


SQL>


Replace above value from that select query and run below to delete that PDB service:


EXEC DBMS_SERVICE.DELETE_SERVICE(UTL_RAW.CAST_TO_VARCHAR2('43524D58424'));


Now try creating PDB with above command and it should run fine now:


SQL> create pluggable database "PROD" using '/oracle_home/19.0.0/dbs/PROD_PDB1.xml' NOCOPY;


Pluggable database created.


SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

        3 PROD                         MOUNTED

SQL>


Now open PDB in read write mode:

SQL> alter pluggable database "PROD" open read write;


        Happy troubleshooting 👍 Please comment if issue resolved.

Post a Comment

0 Comments