Plugging a pluggable database (PDB) to a container database (CDB) is just like creating a new PDB. It's always good to check PDB compatibility before you start plugging it.
If you are aware of DB version from where the PDB is unplugged and if it's the same version, you can choose to skip this check. But I would still recommend doing it as it won't take much time.
Here I'll plug in 2 PDBs, PDB3 unplugged as PDB Archive & PDB4 unplugged as XML.
PLSQL Code to check compatibility.
DECLARE l_result BOOLEAN; BEGIN l_result := DBMS_PDB.check_plug_compatibility( pdb_descr_file => 'C:\app\oracle\oradata\pdb3.pdb', pdb_name => 'pdb3'); IF l_result THEN DBMS_OUTPUT.PUT_LINE('compatible'); ELSE DBMS_OUTPUT.PUT_LINE('incompatible'); END IF; END; /
Checking compatibility for PDB3 Archive.
SQL> SET SERVEROUTPUT ON SQL> DECLARE 2 l_result BOOLEAN; 3 BEGIN 4 l_result := DBMS_PDB.check_plug_compatibility( 5 pdb_descr_file => 'C:\app\oracle\oradata\pdb3.pdb', 6 pdb_name => 'pdb3'); 7 8 IF l_result THEN 9 DBMS_OUTPUT.PUT_LINE('compatible'); 10 ELSE 11 DBMS_OUTPUT.PUT_LINE('incompatible'); 12 END IF; 13 END; 14 / compatible PL/SQL procedure successfully completed.
Similarly doing the check for PDB4 unplugged as XML.
SQL> DECLARE 2 l_result BOOLEAN; 3 BEGIN 4 l_result := DBMS_PDB.check_plug_compatibility( 5 pdb_descr_file => 'C:\app\oracle\oradata\pdb4.xml', 6 pdb_name => 'pdb4'); 7 8 IF l_result THEN 9 DBMS_OUTPUT.PUT_LINE('compatible'); 10 ELSE 11 DBMS_OUTPUT.PUT_LINE('incompatible'); 12 END IF; 13 END; 14 / compatible PL/SQL procedure successfully completed.
Both shown compatible. In case of incompatibility, you can verify the violations using the query below.
SQL> set lines 200 pages 200; SQL> col time for a30; SQL> col name for a30; SQL> col cause for a50; SQL> select time, name, cause from PDB_PLUG_IN_VIOLATIONS; no rows selected
You can see that there's no violation added for PDB3 or PDB4. So we can proceed with plugging in our PDBs.
Plug in PDB3 from PDB Archive & XML
SQL> ALTER SYSTEM SET db_create_file_dest='C:\app\oracle\oradata'; System altered. SQL> create pluggable database pdb3 using 'C:\app\oracle\oradata\pdb3.pdb'; Pluggable database created.
Now let's do the same for PDB4, but ensure you have copied the datafiles back to required location if you have delete them with your DROP command, if you had excluded them, you can proceed directly.
SQL> create pluggable database pdb4 using 'C:\app\oracle\oradata\pdb4.xml' nocopy tempfile reuse; Pluggable database created.
Verify if newly created PDBs are listed now and open them.
SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 PDB2 READ WRITE NO 5 PDB3 MOUNTED 6 PDB4 MOUNTED SQL> SQL> SQL> alter pluggable database all open; Pluggable database altered. SQL> show pdbs; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 PDB1 READ WRITE NO 4 PDB2 READ WRITE NO 5 PDB3 READ WRITE NO 6 PDB4 READ WRITE NO
I hope this helps !!
No comments:
Post a Comment