How to DROP PDB Database in 19c

We can Use the DROP PLUGGABLE DATABASE statement to drop a pluggable database (PDB).

When you drop a PDB, the control file of the multitenant container database (CDB) is modified to remove all references to the dropped PDB and its data files. Archived logs and backups associated with the dropped PDB are not deleted. You can delete them using Oracle Recovery Manager (RMAN), or you can retain them in case you subsequently want to perform point-in-time recovery of the PDB.

We can't rollback the DROP PLUGGABLE DATABASE statement.

Drop pluggable Database include database:


SYNTAX:-

 

DROP PLUGGABLE DATABASE <PDB_NAME> INCLUDING DATAFILES;

 

SQL> show pdbs

 

    CON_ID CON_NAME         OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                     READ ONLY  NO

         3 TESTPDB                        READ WRITE NO

         4 DEVPDB                         READ WRITE NO

SQL>

 

Close pluggable database

 

SQL> alter pluggable database DEVPDB close immediate;

 

Pluggable database altered.

 

SQL> show pdbs

 

    CON_ID CON_NAME           OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                     READ ONLY  NO

         3 TESTPDB                        READ WRITE NO

         4 DEVPDB                         MOUNTED



Drop DEVPDB

 

SQL> drop pluggable database DEVPDB including datafiles;

 

Pluggable database dropped.



Known Error: -

 

SQL> drop pluggable database DEVPDB;

drop pluggable database DEVPDB

*

ERROR at line 1:

ORA-65179: cannot keep datafiles for a pluggable database that is not unplugged

 

SQL> drop pluggable database DEVPDB including datafiles;

 

Pluggable database dropped.



DROP Pluggable database Keep Datafile:

  

SQL> alter pluggable database JIO unplug into 'jio.xml';

 

Pluggable database altered.

 

SQL> show pdbs

 

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 TESTPDB                        READ WRITE NO

         4 AIRTELPDB                      READ WRITE NO

         5 JIO                            MOUNTED

SQL> drop pluggable database JIO keep datafiles;

 

Pluggable database dropped.

 

SQL> show pdbs

 

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED

---------- ------------------------------ ---------- ----------

         2 PDB$SEED                       READ ONLY  NO

         3 TESTPDB                        READ WRITE NO

         4 AIRTELPDB                      READ WRITE NO

SQL>




 

Reference:-

 

https://docs.oracle.com/database/121/SQLRF/statements_8028.htm#SQLRF55699


Comments

Popular posts from this blog

How to troubleshoot long running concurrent request in R12.2

How to run Gather Schema Statistics in R12.2

How to compile forms in R12.2