共計 2875 個字符,預計需要花費 8 分鐘才能閱讀完成。
這篇文章將為大家詳細講解有關怎么用 deinstall 和命令行刪除 Oracle 數據庫軟件,丸趣 TV 小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
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)查看數據庫實例的狀態,如數據庫實例啟動,則關閉數據庫實例。
[oracle@DB074 ~]$ ps -ef | grep smon
oracle 3559 1 0 14:44 ? 00:00:00 ora_smon_cams
oracle 3662 31107 0 14:47 pts/1 00:00:00 grep smon
[oracle@DB074 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Sep 11 14:47:25 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@cams shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@cams exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@DB074 ~]$ ps -ef | grep smon
oracle 3675 31107 0 14:47 pts/1 00:00:00 grep smon
(5)檢查確保沒有 oracle 進程啟動
[oracle@DB074 ~]$ ps -ef | grep ora
root 1987 1945 0 Sep09 ? 00:01:16 hald-addon-storage: polling /dev/sr0 (every 2 sec)
oracle 3677 31107 0 14:48 pts/1 00:00:00 ps -ef
oracle 3678 31107 0 14:48 pts/1 00:00:00 grep ora
root 31106 30170 0 11:34 pts/1 00:00:00 su – oracle
oracle 31107 31106 0 11:34 pts/1 00:00:00 –bash
(6)切換到 root 用戶,完整刪除安裝目錄(如擔心手滑,部分操作可以在 oracle 用戶下完成)
[root@DB074 oracle]# cd /
[root@DB074 oracle]# rm -rf u01/
(7)將 bin 下面的文件刪除,如果不知道具體在哪個 bin 路徑下(有 /usr/bin,/usr/local/bin 等),可以先查找下系統路徑
[root@DB074 /]# find / -name oraenv
/usr/local/bin/oraenv
[root@DB074 /]# find / -name dbhome
/usr/local/bin/dbhome
[root@DB074 /]# find / -name coraenv
/usr/local/bin/coraenv
[root@DB074 /]# rm -rf /usr/local/bin/oraenv
[root@DB074 /]# rm -rf /usr/local/bin/dbhome
[root@DB074 /]# rm -rf /usr/local/bin/coraenv
(8)刪除配置文件
[root@DB074 ~]# rm -rf /etc/oraInst.loc
[root@DB074 ~]# rm -rf /opt/ORCLfmap
[root@DB074 ~]# rm -rf /etc/oratab
(9)刪除 home 目錄
[root@DB074 ~]# rm -rf /home/oracle
(10)刪除 oracle 用戶和用戶組
[root@DB074 ~]# userdel -f oracle
[root@DB074 ~]# groupdel -f oinstall
[root@DB074 ~]# groupdel -f dba
(11)檢查是否有自啟動服務,進行刪除
[root@DB074 ~]#chkconfig –list
[root@DB074 ~]#chkconfig –del XXX
3. 方法對比
(1)兩種方法都能完成數據庫軟件的刪除,使用 deinstall 工具的方法比較柔和,使用命令行刪除的方法比較暴力。
(2)第一種方法刪除后會有部分信息保留,如環境變量、安裝軟件、自定義目錄等;第二種方法可以對數據庫進行完整刪除,也可以只刪除部分內容。當然,兩種方法沒有好壞之分,可以視情況相結合使用。
(3)第二種方法操作過程中會多次在 root 用戶下執行 rm -rf 命令,建議用戶小心操作。
(4)文中沒有嘗試使用下載的 deinstall 工具進行卸載操作,讀者可以在工作之余在測試環境中進行嘗試。
關于“怎么用 deinstall 和命令行刪除 Oracle 數據庫軟件”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,使各位可以學到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。