The multi-tenancy option, introduced in Oracle database, allows a single container database (CDB) to host multiple separate pluggable databases (PDB).
This article simply demonstrates how to Plug a pdb,unplugging a PDB operation in CDB.
One, plugged PDB into Unplugged PDB
Sql> Show PDBs
con_id con_name OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
3 PDB01 READ WRITE NO
Sql>alter Pluggable database pdb01 close immediate;
Sql>alter Pluggable database Pdb01 unplug into '/home/oracle/pdb01.xml ';
[Email protected] ~]$ pwd
/home/oracle
[email protected] ~]$ ll Pdb01.xml
-rw-r--r--. 1 Oracle Oinstall 7758 May 7 05:09 Pdb01.xml
[email protected] ~]$ cat Pdb01.xml
<?xml version= "1.0" encoding= "UTF-8"?>
<PDB>
<xmlversion>1</xmlversion>
<pdbname>PDB01</pdbname>
<cid>3</cid>
<byteorder>1</byteorder>
<vsn>203424000</vsn>
<vsns>
<vsnnum>12.2.0.1.0</vsnnum>
<cdbcompt>12.2.0.0.0</cdbcompt>
<pdbcompt>12.2.0.0.0</pdbcompt>
<vsnlibnum>0.0.0.0.24</vsnlibnum>
<vsnsql>24</vsnsql>
<vsnbsv>8.0.0.0.0</vsnbsv>
</vsns>
<dbid>2550500229</dbid>
... Omitted
Sql> Show PDBs
con_id con_name OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
3 PDB01 Mounted
sql> Drop pluggable database pdb01 keep datafiles;
Pluggable database dropped.
Sql> Show PDBs
con_id con_name OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
Second, Plug Unplugged PDB into CDB
Sql> SELECT name,cdb from V$database;
NAME CDB
--------- ---
ANDYCDB YES
Sql> Create pluggable database pdb01 using '/home/oracle/pdb01.xml ';
Pluggable database created.
Sql> Show PDBs
con_id con_name OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
3 PDB01 Mounted
sql> Alter pluggable database PDB01 open;
Pluggable database altered.
Sql> Show PDBs
con_id con_name OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 Pdb$seed READ only NO
3 PDB01 READ WRITE NO
Oracle 12c Multi-tenancy Plug a pdb,unplugging a PDB in CDB