Deinstall Oracle Software
Cleanly deinstall Oracle software with proper steps.
This article describes how to remove oracle database and software from a Linux server. We will first delete database using DBCA silent mode and then proceed with Oracle software deletion.
DBCA Delete Database
You can use DBCA to delete database from a Linux server. Use below command to run DBCA in silent mode and delete a database
dbca -silent -deleteDatabase -sysDBAUserName sys -sourceDB testdb
If dbca errors out stating cannot find the database, then make sure database entry is there in /etc/oratab file. Else dbca cannot delete the database.
Remove Oracle Software
Under your ORACLE_HOME, we get a deinstall utility that you can use to remove the oracle software from your Linux server. This should be your first choice
$ORACLE_HOME/deinstall/deinstall
ALTERNATIVELY - You can use runInstaller to deinstall Oracle software
./runInstaller -deinstall -home /u01/app/oracle/product/12.1.0/dbhome_1/
Manually Delete ORACLE HOME
Sometimes ORACLE software installation gets corrupted and in such case, above deinstallation utilities will not help you to remove oracle software. Stop all the oracle databases / processes running from the ORACLE_HOME and delete ORACLE_HOME files
cd $ORACLE_HOME
rm -rf *
Delete files and folders inside ORACLE_BASE
cd $ORACLE_BASE
rm -rf *
Remove oratab file
rm /etc/oratab
Enjoy!