DBCA – Delete a Pluggable Database

Now that Oracle Database 12c has been out for a few months, there has been a lot of information being written about in regards to the multi-tenant database features.  Although multi-tenant databases will allow us to do more with less resources there will be times when a pluggable database will need to be removed.  In this blog post, I want to show you how easy it is to delete a pluggable database using the Database Configuration Assistant (DBCA). 

Before we can delete a pluggable database with DBCA, we need to set our environment.  I normally use the oraenv command to set my environments.  This makes it a bit easier (less typing) than setting the environment manually also a good practice before working with Oracle tools.

[oracle@oel ~]$ . oraenv
ORACLE_SID = [oracle] ? ora12c
The Oracle base has been set to /oracle/app
[oracle@oel ~]$ env | grep ORA
ORACLE_SID=ora12c
ORACLE_BASE=/oracle/app
ORACLE_HOME=/oracle/app/product/12.1.0.1/dbhome_1

Before we start the DBCA, we need to see what pluggable databases are available within the consolidated database (CDB).  This information can be gained from the V$PDBS view.

SQL> select name, open_mode from v$pdbs;
NAME      OPEN_MODE
-------------------- ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
PDBTEST MOUNTED
PDB2 MOUNTED

Starting the DBCA is easy and will bring use to the first screen.  You will notice that Oracle has added a new option called “Manage Pluggable Databases“.  This is the path that the DBCA will use to manage, create, delete and alter any pluggable databases that are associated with the container database.  Select this radio button and then click next.  

[oracle@oel dbhome_1]$ dbca &
[1] 8853
 

dbca_delete1.png

 

On the Manage Pluggable Databases (step2), we see there are a lot of options for managing a pluggable database.  For the purpose of this post, we want to delete a pluggable database.  Select the radio button for deleting a pluggable database.

NewImage

The Database List (step 3) will give us the list of Oracle Database 12c Container Databases that we would like to delete the pluggable database from.  Select the 12c database that you would like to delete the pluggable from.  In this example, I’m going to use the ora12c database.

dbca_delete3.png

 

After selecting the db12c database that we want to delete the pluggable database from, we will be on the Delete Pluggable Database (step 4) screen. On this screen we see a drop down box that will present a list of pluggable databases that can be deleted.  Select the PDB that we want to delete.

dbca_delete4.png

After we selected the PDB to delete, DBCA puts us on a summary screen which explains what we are about to remove.  This screen listed the CDB that is doing to affected and which PDB with associated data files that will be deleted.

dbca_delete6.png

As with other processes within DBCA, we are presented with a Progress Page that will show us the progress of the PDB being removed.

dbca_delete.png

Once the PDB has been deleted, the DBCA will return a successful message.

dbca_delete7.png

After clicking OK, we can verify that the PDB was deleted by looking at the V$PDBS view within the database.

 

SQL> select name, open_mode from v$pdbs;
NAME      OPEN_MODE
-------------------- ----------
PDB$SEED READ ONLY
PDBTEST MOUNTED
PDB2 MOUNTED

I know this was a quick post, but hopefully, it is one that everyone can use if they want to remove a PDB from a CDB.

 

Enjoy!

twitter: @curtisbl294

blog: http://dbasolved.com

 

Please follow and like:

Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.