Steps to drop Oracle Database Without using DBCA

Sometimes you need to remove or drop the existing Oracle databases as a part of decommissioning activity. In this post I want to show you how to drop the database manually without using GUI tool DBCA.

Prerequisite:

Backup the database if required for future reference. Also find the location of datafiles, controlfiles and online redo log files of the database to be dropped. We will use it as a reference to cross verify if all the files are deleted or not.

SQL> select name from v$datafile;
SQL> select name from v$controlfile;
SQL> select member from v$logfile;

Steps to Drop Database Manually

STEP 1: Export the environmental variables and connect to the database as sysdba:
$ export ORACLE_HOME=ORACLE_HOME_LOCATION
$ EXPORT PATH=$ORACLE_HOME/bin:$PATH:.
$ export ORACLE_SID=mysid
STEP 2: Shut down the database:
SQL> shut immediate;
STEP 3: Start the database in Exclusive mode:
SQL> startup mount exclusive restrict;
STEP 4: Drop the database:
SQL> drop database;
STEP 5 : After dropping verify the below changes:
-> Cross verify if all the associated datafiles, comntrolfile and online redologs are removed
-> Remove the directories if not required
-> Remove the entry of the database from /etc/oratab
-> Remove crontabl entries/scripts if not required.