Multitenant - Unplugged and Plugged database with Different GUID NO copy method on same host database.
UPLUGGABLE : PDB2
PLUGGABLE :PLM3
NOTE: If we specify CLONE kewords with NOCOPY then with different GUID created and able to create PLUGGABLE DATABASE on same host CDB database.
ERROR :
ORA-65122: Pluggable database GUID conflicts with the GUID of an existing container.
Keywards:
- ALTER PLUGGABLE DATABASE PDB2 UNPLUG INTO '/HOME/ORACLE/PDB2.PDB';
- Check compatibilty of unpluggable and pluggable on both host or remote database.
DECLARE
2 compatible BOOLEAN := FALSE;
BEGIN
compatible := DBMS_PDB.CHECK_PLUG_COMPATIBILITY(PDB_DESCR_FILE => '/home/oracle/pdb3.xml');
if compatible then
DBMS_OUTPUT.PUT_LINE('It is compatible');
else
DBMS_OUTPUT.PUT_LINE('It is NOT compatible');
end if;
END;
/
- CREATE PLUGGABLE DATABASE PLM3 AS CLONE USING '/HOME/ORACLE/PDB2.PDB' COPY;
SELECT NAME FROM V$DATAFILE WHERE CON_ID = (SELECT CON_ID FROM V$PDBS WHERE NAME='PDB2');
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PLM1 READ WRITE NO
4 PDB2 READ WRITE NO
5 PLM2 READ WRITE NO
SQL> SELECT NAME FROM V$DATAFILE WHERE CON_ID = (SELECT CON_ID FROM V$PDBS WHERE NAME='PDB2');
NAME
----------------------------------------------------------------------------------------------------
/u01/app/oracle/oradata/SMRCDB/PDB2/system01.dbf
/u01/app/oracle/oradata/SMRCDB/PDB2/sysaux01.dbf
/u01/app/oracle/oradata/SMRCDB/PDB2/undotbs01.dbf
SQL> ALTER SESSION SET CONTAINER=PDB2;
Session altered.
SQL> SELECT ROUND(SUM(BYTES)/1024/1024,2) SPACE_IN_MB FROM DBA_SEGMENTS;
SPACE_IN_MB
-----------
585.75
SQL>
ALTER PLUGGABLE DATABASE pdb2 UNPLUG INTO '/home/oracle/pdb2.pdb';
SQL> ALTER SESSION SET CONTAINER=cdb$root;
Session altered.
SQL> ALTER PLUGGABLE DATABASE PDB2 close;
Pluggable database altered.
SQL> ALTER PLUGGABLE DATABASE pdb2 UNPLUG INTO '/home/oracle/pdb2.pdb';
Pluggable database altered.
SQL> host ls -alh /home/oracle/pdb2.pdb
-rw-r--r-- 1 oracle oinstall 161M Aug 7 19:59 /home/oracle/pdb2.pdb
SQL>
CREATE PLUGGABLE DATABASE PLM3 USING '/home/oracle/pdb2.pdb' COPY;
SQL> CREATE PLUGGABLE DATABASE PLM3 USING '/home/oracle/pdb2.pdb' COPY;
CREATE PLUGGABLE DATABASE PLM3 USING '/home/oracle/pdb2.pdb' COPY
*
ERROR at line 1:
ORA-65122: Pluggable database GUID conflicts with the GUID of an existing container.
SQL>
CREATE PLUGGABLE DATABASE pdb6 AS CLONE USING '/home/oracle/pdb5.pdb' COPY;
CREATE PLUGGABLE DATABASE PLM3 AS CLONE USING '/home/oracle/pdb2.pdb' COPY;
SQL> CREATE PLUGGABLE DATABASE PLM3 AS CLONE USING '/home/oracle/pdb2.pdb' COPY;
Pluggable database created.
SQL> ALTER PLUGGABLE DATABASE PLM3 open;
Pluggable database altered.
SQL> col pdb_name format a5
SQL> SELECT PDB_NAME, STATUS FROM CDB_PDBS WHERE PDB_NAME IN ('PDB2','PLM3');
PDB_N STATUS
----- ----------
PDB2 UNPLUGGED
PLM3 NORMAL
SQL> SELECT OPEN_MODE FROM V$PDBS WHERE NAME IN ('PDB2','PLM3');
OPEN_MODE
----------
MOUNTED
READ WRITE
SQL> sho pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PLM1 READ WRITE NO
4 PDB2 MOUNTED
5 PLM2 READ WRITE NO
7 PLM3 READ WRITE NO
SQL> SELECT GUID FROM V$PDBS WHERE NAME='PLM3';
GUID
--------------------------------
AC4B491CE9DAB663E0534938A8C039B1
SQL> SELECT GUID FROM V$PDBS WHERE NAME='PDB2';
GUID
--------------------------------
AC217FDB78BE1A68E0534938A8C0C30E
No comments:
Post a Comment