ORA-65122: Pluggable Database GUID Conflicts With The GUID Of An Existing Container (文档 ID 2416798.1)


SYS@CDBLHR18c> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         4 PDBLHR3                        MOUNTED
         7 PDBLHR2                        MOUNTED
SYS@CDBLHR18c> create pluggable database PDBLHR4
  2  using '/tmp/PDBLHR1.xml'
  3  nocopy tempfile reuse;
create pluggable database PDBLHR4
*
ERROR at line 1:
ORA-65122: Pluggable database GUID conflicts with the GUID of an existing
container.
SYS@CDBLHR18c> create pluggable database PDBLHR4 as clone
  2  using '/tmp/PDBLHR1.xml'
  3  nocopy tempfile reuse;
create pluggable database PDBLHR4 as clone
*
ERROR at line 1:
ORA-65139: Mismatch between XML metadata file and data file
/u08/app/oracle/oradata/CDBLHR18C/CDBLHR18C/8FF8F6081FDE6D87E053823BA8C0C041/dat
afile/o1_mf_system_go4h7gtb_.dbf for value of guid
(7A2048D2D3D3B765E053823BA8C0BE92 in the plug XML file,
8FF8F6081FDE6D87E053823BA8C0C041 in the data file)
-- 这里修改/tmp/PDBLHR1.xml文件,将<guid>7A2048D2D3D3B765E053823BA8C0BE92</guid>修改为<guid>8FF8F6081FDE6D87E053823BA8C0C041</guid>
SYS@CDBLHR18c> create pluggable database PDBLHR4 as clone
  2  using '/tmp/PDBLHR1.xml'
  3  nocopy tempfile reuse;
Pluggable database created.
SYS@CDBLHR18c> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDBLHR4                        MOUNTED
         4 PDBLHR3                        MOUNTED
         7 PDBLHR2                        MOUNTED

 







In this Document  


Symptoms

Cause

Solution


APPLIES TO:

Oracle Database - Enterprise Edition - Version 12.1.0.2 and later  
Information in this document applies to any platform.  

SYMPTOMS

Restored Pluggable database in a different container and unplugged. Dropped existing old PDB  and trying to plug in new PDB and getting error:
ORA-65122: Pluggable database GUID conflicts with the GUID of an existing container.


SQL> drop pluggable database PDB1 INCLUDING DATAFILES;

Pluggable database dropped.

SQL> SET SERVEROUTPUT ON
DECLARE
compatible CONSTANT VARCHAR2(3) := CASE DBMS_PDB.CHECK_PLUG_COMPATIBILITY(pdb_descr_file => '/tmp/cdbrf_pdb1.xml')
WHEN TRUE THEN
'YES'
ELSE 'NO'
END;
BEGIN
DBMS_OUTPUT.PUT_LINE(compatible);
END;
/SQL>
YES

PL/SQL procedure successfully completed.

SQL> create pluggable database PDB1
using '/tmp/cdbrf_pdb1.xml'
COPY FILE_NAME_CONVERT = ('+DATA', '+EON_DAT_QA');
; 2 3
create pluggable database pdb1
*
ERROR at line 1:
ORA-65122: Pluggable database GUID conflicts with the GUID of an existing container.



CAUSE

 The same PDB had been plugged previously hence the  GUID already exists

SOLUTION

 This is expected error.

Use  AS CLONE clause.

create pluggable database ....
AS CLONE using '.....xml'
file_name_convert=(...,..);

Or, if you would like to move the XML file, you can use:
create pluggable database ....
AS CLONE using '.....xml'
MOVE
file_name_convert=(...,..);

AS CLONE option is used when target CDB already contains a PDB that was created using the same set of data files. And this is the case here.

Please take a look at:
https://docs.oracle.com/database/121/SQLRF/statements_6010.htm#SQLRF55686  
"
AS CLONE Clause

Specify this clause only if the target CDB already contains a PDB that was created using the same set of data files. The source files remain as an unplugged PDB and can be used again. Specifying AS CLONE also ensures that Oracle Database generates new identifiers, such as DBID and GUID, for the new PDB.