在 Ubuntu 中卸载 Oracle(以 Oracle Database 为例,常见于手动安装或使用 Oracle 提供的安装包),可以按下面的步骤进行。
先确认你是怎么安装的:
ps -ef | grep oracle
which oracle
ls /opt/oracle
ls /u01/app/oracle
常见安装路径:
/u01/app/oracle/opt/oracle# 切换到 oracle 用户
su - oracle
# 停止数据库
sqlplus / as sysdba
SQL> shutdown immediate
SQL> exit
# 停止监听
lsnrctl stop
如果是 Oracle Restart / ASM:
crsctl stop has
Oracle 自带 deinstall 工具:
# 找到 deinstall 路径
find /u01 -name deinstall
# 执行
/u01/app/oracle/product/19.3.0/dbhome_1/deinstall/deinstall
按提示一步步操作即可。
userdel -r oracle
groupdel oinstall
groupdel dba
rm -rf /u01/app/oracle
rm -rf /opt/oracle
rm -rf /etc/ora*
编辑:
vim ~/.bashrc
vim /etc/profile
删除类似内容:
export ORACLE_HOME=...
export ORACLE_SID=...
export PATH=$ORACLE_HOME/bin:$PATH
使配置生效:
source ~/.bashrc
systemctl disable oracle
rm -f /etc/systemd/system/oracle.service
sudo apt remove --purge oracle-xe
sudo rm -rf /u01/app/oracle
which sqlplus
ls /u01
ps -ef | grep oracle
如果你能告诉我:
我可以给你更精确的卸载命令。