Friday, June 3, 2016

Delete or Drop Oracle Database 12c

You can choose among multiple options to drop Oracle databases. 

1. DBCA (Silent Method or GUI)
2. Command Line Interface (startup mount restrict and then issue drop database)
3. Manually cleaning up files

In 12c using dbca you can even drop in particular pluggable databases too using the option Manage Pluggable databases and then delete pluggable database. In this post I will provide screenshot's to  drop database in 12c.

Set your environment variables properly (ORACLE_HOME) and invoke dbca and select Delete Database







 At this stage you can check the name of the DB and pdbseed  those will be getting deleted including control files, system, sysaux, undotbs, users, temp after that hit finish



 At this stage it will even throw a pop up screen to open the database in restrict mode. You can ignore it and hit next.



Done with database deletion including pluggable database in it. 

It will even clean up oratab entries, but you need to manually delete pdbseed directory and log dump directories (bdump, cdump)

If it a RAC system you even need to clean up the ASM diskgroups associated with the database manually.

If you would like to drop the database from sql command prompt, you can perform the below steps.

1. shutdown immediate
2. startup mount exclusive
3. alter system enable restricted session
4. drop database