怎么用deinstall和命令行删除Oracle数据库软件

怎么用deinstall和命令行删除Oracle数据库软件

这篇文章将为大家详细讲解有关怎么用deinstall和命令行删除Oracle数据库软件,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

1. deinstall工具

1.1. 工具介绍

deinstall工具是oracle提供的数据库软件卸载工具,使用方法可以参考官方文档路径:Installing and Upgrading→Database Installation Guide for Linux→ 7 Removing Oracle Database Software
具体路径为:http://docs.oracle.com/cd/E11882_01/install.112/e47689/remove_oracle_sw.htm#LADBI1336


oracle总共提供了2种使用deinstall的方法:

(1)如果Oracle安装无误,可以直接调用$ORACLE_HOME下的脚本$ORACLE_HOME/deinstall/deinstall

(2)如果Oracle安装有问题或者是其他情况,可以下载独立的工具后,然后使用工具进行卸载。

官方文档给出的下载路径:

1.前往URL:

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

2.在Oracle Database 11g Release 2下载区域找到对应的平台版本,点击”See All”,在新打开的页面底部可以下载到数据库卸载工具。

另外,使用单独的deinstall进行卸载的时候,必须指定-home参数,查看官方文档说明:

  • (4)查看数据库实例的状态,如数据库实例启动,则关闭数据库实例。


  1. [oracle@DB074 ~]$ ps -ef | grep smon

  2. oracle 3559 1 0 14:44 ? 00:00:00 ora_smon_cams

  3. oracle 3662 31107 0 14:47 pts/1 00:00:00 grep smon

  4. [oracle@DB074 ~]$ sqlplus / as sysdba

  5. SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 11 14:47:25 2017

  6. Copyright (c) 1982, 2013, Oracle. All rights reserved.

  7. Connected to:

  8. Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

  9. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  10. SYS@cams>shutdown immediate;

  11. Database closed.

  12. Database dismounted.

  13. ORACLE instance shut down.

  14. SYS@cams>exit

  15. Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

  16. With the Partitioning, OLAP, Data Mining and Real Application Testing options

  17. [oracle@DB074 ~]$ ps -ef | grep smon

  18. oracle 3675 31107 0 14:47 pts/1 00:00:00 grep smon



(5)检查确保没有oracle进程启动


  1. [oracle@DB074 ~]$ ps -ef | grep ora

  2. root      1987  1945  0 Sep09 ? 00:01:16 hald-addon-storage: polling /dev/sr0 (every 2 sec)

  3. oracle    3677 31107  0 14:48 pts/1    00:00:00 ps -ef

  4. oracle    3678 31107  0 14:48 pts/1    00:00:00 grep ora

  5. root     31106 30170  0 11:34 pts/1    00:00:00 su - oracle

  6. oracle   31107 31106  0 11:34 pts/1    00:00:00 –bash



(6)切换到root用户,完整删除安装目录(如担心手滑,部分操作可以在oracle用户下完成)


  1. [root@DB074 oracle]# cd /

  2. [root@DB074 oracle]# rm -rf u01/



(7)将bin下面的文件删除,如果不知道具体在哪个bin路径下(有/usr/bin,/usr/local/bin等),可以先查找下系统路径


  1. [root@DB074 /]# find / -name oraenv

  2. /usr/local/bin/oraenv

  3. [root@DB074 /]# find / -name dbhome

  4. /usr/local/bin/dbhome

  5. [root@DB074 /]# find / -name coraenv

  6. /usr/local/bin/coraenv

  7. [root@DB074 /]# rm -rf /usr/local/bin/oraenv

  8. [root@DB074 /]# rm -rf /usr/local/bin/dbhome

  9. [root@DB074 /]# rm -rf /usr/local/bin/coraenv



(8)删除配置文件


  1. [root@DB074 ~]# rm -rf /etc/oraInst.loc

  2. [root@DB074 ~]# rm -rf /opt/ORCLfmap

  3. [root@DB074 ~]# rm -rf /etc/oratab



(9)删除home目录

  1. [root@DB074 ~]# rm -rf /home/oracle


(10)删除oracle用户和用户组


  1. [root@DB074 ~]# userdel -f oracle

  2. [root@DB074 ~]# groupdel -f oinstall

  3. [root@DB074 ~]# groupdel -f dba



(11)检查是否有自启动服务,进行删除


  1. [root@DB074 ~]#chkconfig –list

  2. [root@DB074 ~]#chkconfig --del XXX



3. 方法对比

(1)两种方法都能完成数据库软件的删除,使用deinstall工具的方法比较柔和,使用命令行删除的方法比较暴力。

(2)第一种方法删除后会有部分信息保留,如环境变量、安装软件、自定义目录等;第二种方法可以对数据库进行完整删除,也可以只删除部分内容。当然,两种方法没有好坏之分,可以视情况相结合使用。

(3)第二种方法操作过程中会多次在root用户下执行rm -rf命令,建议用户小心操作。

(4)文中没有尝试使用下载的deinstall工具进行卸载操作,读者可以在工作之余在测试环境中进行尝试。

关于“怎么用deinstall和命令行删除Oracle数据库软件”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。