ORA-65179: cannot keep datafiles for a pluggable database that is not unplugged
Error:
SQL> drop pluggable database pdb2;
drop pluggable database pdb2
*
ERROR at line 1:
ORA-65179: cannot keep datafiles for a pluggable database that is not unplugged
Solution:
Incomplete command, so use the following syntax to drop the pluggable database from the CDBROOT. Use either of the following commands:
Check the status that database is in close state:
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB4 READ WRITE NO
5 PDB2 MOUNTED
--Close the database if not closed:
SQL> alter pluggable database pdb4 close;
Pluggable database altered.
-- If you want to keep the data files in OS.
SQL> drop pluggable database pdb4 keep datafiles;
Pluggable database dropped.
OR
-- If you want to delete the data files from OS.
SQL> drop pluggable database pdb4 including datafiles;
Pluggable database dropped.