Occasionally, you may need to drop a PDB. You may want to do so because you do not need the PDB anymore or because you are transferring (unplugging/plugging) to a different CDB and you want to drop the PDB from the original CDB.
If you need to remove a PDB, you can do it in two ways:
• Drop the PDB and its data files.
• Drop the PDB and leave its data files in place.
If you never plan on using the PDB again, then you can drop it and specify that the data files also be removed.
If you plan on plugging the PDB into a different CDB, then (of course) don’t drop the data files, as doing so removes them from disk.
To drop a PDB, first connect to the root container as a privileged account, and close the PDB:
SQL> alter pluggable database mmpdb close immediate;
This example drops the PDB and its data files:
SQL> drop pluggable database mmpdb including datafiles;
If successful, you should see this message:
Pluggable database dropped.
This next example drops a PDB without removing the data files. You may want to do this if you’re moving the pluggable database to a different CDB:
SQL> drop pluggable database mmpdb;
In this manner, the PDB is disassociated from the CDB, but its data files remain intact on disk.