如何卸载Oracle Database Express Edition?求助排查系统未卸载残留内容
Hey there! Let's break down the proper way to uninstall Oracle XE and make sure you don't leave any stray files, settings, or services lingering on your system. I'll cover both Windows and Linux since the steps differ a bit.
Uninstall Steps for Windows
Stop Oracle Services First
Open the Services console (services.mscvia Run dialog), find all services starting withOracle(likeOracleXETNSListenerandOracleServiceXE), right-click each and select Stop.Use the Official Uninstaller
Go to Control Panel → Programs and Features, locate Oracle Database Express Edition, right-click it and choose Uninstall. Follow the wizard prompts to complete the process.Delete Residual Files & Folders
- Remove the default installation directory:
C:\app\<YourUsername>\product\<VersionNumber>\XE - Check for leftover Oracle folders in
C:\Program Files\OracleandC:\ProgramData\Oracle(delete if present) - Clean Up the Registry (caution: backup your registry first!)
Openregedit, then delete these keys:HKEY_LOCAL_MACHINE\SOFTWARE\Oracle(only the XE-related subkeys, or the whole key if no other Oracle products are installed)HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services→ all entries starting withOracleHKEY_CURRENT_USER\Software\Oracle(if exists)
- Remove the default installation directory:
Uninstall Steps for Linux
Stop Oracle Services
Switch to theoracleuser:su - oracleShutdown the database:
sqlplus / as sysdba shutdown immediate; exit;Stop the listener:
lsnrctl stopRun the Official Deinstall Script
Switch torootuser, then execute the deinstall script (default path below, adjust version number as needed):/u01/app/oracle/product/18c/XE/deinstall/deinstallFollow the on-screen prompts to proceed with the uninstall.
Clean Up Residuals
- Delete the Oracle installation directory:
rm -rf /u01/app/oracle - Remove the
oracleuser and associated groups (only if they were created exclusively for Oracle):userdel -r oracle groupdel oinstall groupdel dba - Remove Oracle-related environment variables from files like
/etc/profile,/home/oracle/.bashrc, or/home/oracle/.bash_profile - Delete system config files:
rm -rf /etc/oracle rm /etc/oratab
- Delete the Oracle installation directory:
Easy-to-Miss Leftovers to Check For
No matter which OS you're using, don't forget these common stray items:
- Lingering Processes: Use Task Manager (Windows) or
ps -ef | grep oracle(Linux) to find and terminate any remaining Oracle processes. - Firewall Rules: If you opened port 1521 (default for Oracle) in your firewall, delete the corresponding inbound/outbound rules.
- Non-Default Data/Log Files: If you stored database files, redo logs, or archive logs in a custom location outside the main installation folder, manually delete those.
- Shortcuts & Start Menu Entries: (Windows only) Remove any Oracle shortcuts from your desktop and Start Menu.
- System Configuration Tweaks: (Linux only) Check
/etc/sysctl.conffor Oracle-related kernel parameters (like shared memory settings) and remove them if no longer needed.
Take your time verifying each step—missing even one small leftover can cause issues if you ever decide to reinstall Oracle later.
内容的提问来源于stack exchange,提问作者nongjai

