Steps to completely uninstall all existing Oracle databases and software from your RHEL 7 machine

IMPORTANT WARNING (READ FIRST)

This process will:

  • Delete all Oracle databases
  • Remove Oracle software
  • Clear inventory, listeners, and configs

👉 Proceed only if you are 100% sure no data is required
(If needed, take RMAN backups first)


🔹 STEP 1: Identify Existing Oracle Installations

1️⃣ Check /etc/oratab

cat /etc/oratab

You’ll see entries like:

ORCL:/u01/app/oracle/product/19.0.0/dbhome_1:Y
TEST:/u01/app/oracle/product/12.2.0/dbhome_1:Y

👉 Note all ORACLE_HOME paths


2️⃣ Check Running Databases

ps -ef | grep pmon

Example:

ora_pmon_ORCL
ora_pmon_TEST

🔹 STEP 2: Stop All Oracle Databases (oracle user)

su - oracle

Stop each database

sqlplus / as sysdba
shutdown immediate;
exit;

Repeat for each ORACLE_SID


Stop Listener

lsnrctl stop

🔹 STEP 3: Remove Databases Using DBCA (RECOMMENDED)

Still as oracle:

dbca

DBCA → Delete Database

  • Select each database
  • Check Delete database files
  • Confirm deletion

👉 This safely removes:

  • Datafiles
  • Control files
  • Redo logs
  • SPFILE

Repeat until all databases are deleted


🔹 STEP 4: Deinstall Oracle Software (oracle user)

For each ORACLE_HOME:

cd $ORACLE_HOME/deinstall
./deinstall

Answer prompts:

  • Remove Oracle Home → YES
  • Remove Inventory → NO (do later)

If multiple homes exist, repeat for all.


🔹 STEP 5: Remove Central Inventory (root user)

su - root
rm -rf /u01/app/oraInventory

🔹 STEP 6: Clean Oracle Directories (root user)

rm -rf /u01/app/oracle
rm -rf /u01/oradata
rm -rf /u01/fast_recovery_area

If other mount points exist:

find / -name "*oracle*" -type d

🔹 STEP 7: Remove Oracle Config Files

rm -f /etc/oratab
rm -f /etc/oraInst.loc

🔹 STEP 8: Kill Leftover Oracle Processes (If Any)

ps -ef | grep ora_ | grep -v grep
kill -9 <PID>

🔹 STEP 9: Clean Oracle User Environment

Login as oracle:

su - oracle

Edit:

vi ~/.bash_profile

❌ Remove:

ORACLE_HOME
ORACLE_SID
LD_LIBRARY_PATH

✔️ Keep only:

ORACLE_BASE
PATH

Or comment everything Oracle-related.


🔹 STEP 10: (Optional) Remove Oracle User & Groups (Full Reset)

⚠️ Do this only if you want absolute clean slate

userdel -r oracle
groupdel oinstall
groupdel dba
groupdel oper

Then recreate later during fresh install.


🔹 STEP 11: Verify System is Clean ✅

ps -ef | grep pmon
ls /u01/app
cat /etc/oratab

Expected:

  • ❌ No pmon
  • ❌ No /u01/app/oracle
  • /etc/oratab missing or empty

🎯 SYSTEM IS NOW 100% CLEAN

You are ready for:
Fresh Oracle 19c Software Install
New Database Creation
No conflicts / No inventory issues

Scroll to Top