Logo ← PostgreSQL Blog

How to Uninstall Oracle 19c on a Linux Machine

Oracle Database 19c provides powerful capabilities, but there may come a time when you need to uninstall it from your Linux machine. Here’s…

How to Uninstall Oracle 19c on a Linux Machine

Oracle Database 19c provides powerful capabilities, but there may come a time when you need to uninstall it from your Linux machine. Here’s a step-by-step guide to help you through the process.

Step 1: Remove Oracle Preinstallation Package

The first step is to remove the Oracle preinstallation package using the following command:

sudo yum remove -y oracle-database-preinstall-19c

Step 2: Delete Oracle User

When attempting to delete the Oracle user, you may encounter an error indicating that the user is currently in use by a process. To identify and terminate these processes, follow these commands:

sudo ps -u oracle          # View processes associated with the oracle user
sudo pkill -u oracle       # Terminate processes associated with the oracle user

Step 3: Remove Oracle User and Home Directory

Once you’ve terminated the processes associated with the Oracle user, you can proceed to delete the user and their home directory using the following command:

sudo userdel -r oracle     # The '-r' flag removes the user's home directory and files

Step 4: Delete Oracle Data Directory (Optional)

If you want to remove the Oracle data directory and its contents, you can use the rm command with the -r (recursive) flag. To automatically answer 'yes' to all prompts, you can use the yes command as follows:

yes | rm -r /u01          # Replace '/u01' with your Oracle data directory path

Note: Be extremely careful when using the rm command with the -r flag, as it will permanently delete all files and subdirectories without confirmation. Make sure you double-check the directory path to avoid accidental data loss.