环境
1OS: CentOS 7.4; hosts: L134; IP: 192.168.1.134 2Oracle安装文件目录:/opt/oracle_install 3ORACLE_BASE:/data/app/oracle 4ORACLE_HOME: /data/app/oracle/product/11.2.0/db_1 5oraInventory: /data/app/oraInventory 6Oracle数据目录:/data/app/oradata/
方法1:使用oracle自带的deinstall卸载
1[oracle@L134 ~]$ cd $ORACLE_HOME/deinstall 2[oracle@L134 /data/app/oracle/product/11.2.0/db_1/deinstall]$ ./deinstall 3
然后根据提示一步一步进行操作即可。最后一步是确认操作,选择y,回车。
Do you want to continue (y - yes, n - no)? [n]: y
最后还要需要以root身份删除/etc/oraInst.loc这个文件。 我觉得方法2删除更方便更彻底。
方法2:手动删除相关文件和目录
-
关闭实例
sqlplus / as sysdba SQL> shutdown immediate
-
关闭listener
lsnrctl stop
-
删除安装目录
su - rm -rf /data/app/oracle/ /data/app/oraInventory/ /data/app/oradata/
-
以root权限删除/usr/bin下的相关文件。下周
cd /usr/local/bin/ rm -f dbhome oraenv coraenv
-
删除/etc/oratab
rm -f /etc/oratab
-
删除
rm -f /etc/oraInst.loc
-
删除oracle用户和用户组(如有必要)
userdel -r oracle groupdel oinstall groupdel dba groupdel oper
-
删除启动服务
chkconfig --del oracle
扩展
oracle自带的deinstall卸载的提示和日志信息
1[oracle@L134 /data/oracle/11g2/deinstall]$ ./deinstall 2Checking for required files and bootstrapping ... 3Please wait ... 4Location of logs /tmp/deinstall2018-03-08_08-53-24-AM/logs/ 5 6############ ORACLE DEINSTALL & DECONFIG TOOL START ############ 7 8 9######################## CHECK OPERATION START ######################## 10Install check configuration START 11 12 13Checking for existence of the Oracle home location /data/app/oracle/product/11.2.0/db_1 14Oracle Home type selected for de-install is: SIDB 15Oracle Base selected for de-install is: /data/app/oracle 16Checking for existence of central inventory location /data/app/oraInventory 17 18Install check configuration END 19 20 21Network Configuration check config START 22 23Network de-configuration trace file location: /tmp/deinstall2018-03-08_08-53-24-AM/logs/netdc_check1471463216126639250.log 24 25Specify all Single Instance listeners that are to be de-configured [LISTENER]: 26 27Network Configuration check config END 28 29Database Check Configuration START 30 31Database de-configuration trace file location: /tmp/deinstall2018-03-08_08-53-24-AM/logs/databasedc_check5326208000777792237.log 32 33Use comma as separator when specifying list of values as input 34 35Specify the list of database names that are configured in this Oracle home [orclyz]: 36 37###### For Database 'orclyz' ###### 38 39Single Instance Database 40The diagnostic destination location of the database: /data/app/oracle/diag/rdbms/orclyz 41Storage type used by the Database: FS 42Database file location: /data/app/oracle/oradata/orclyz,/data/app/oracle/flash_recovery_area/orclyz 43Flash recovery area location: /data/app/oracle/flash_recovery_area/ORCLYZ 44database spfile location: /data/app/oracle/product/11.2.0/db_1/dbs/spfileorclyz.ora 45 46The details of database(s) orclyz have been discovered automatically. Do you still want to modify the details of orclyz database(s)? [n]: 47 48Database Check Configuration END 49 50Enterprise Manager Configuration Assistant START 51 52EMCA de-configuration trace file location: /tmp/deinstall2018-03-08_08-53-24-AM/logs/emcadc_check.log 53 54Checking configuration for database orclyz 55Enterprise Manager Configuration Assistant END 56Oracle Configuration Manager check START 57OCM check log file location : /tmp/deinstall2018-03-08_08-53-24-AM/logs//ocm_check5456.log 58Oracle Configuration Manager check END 59 60######################### CHECK OPERATION END ######################### 61 62 63####################### CHECK OPERATION SUMMARY ####################### 64Oracle Home selected for de-install is: /data/app/oracle/product/11.2.0/db_1 65Inventory Location where the Oracle home registered is: /data/app/oraInventory 66Following Single Instance listener(s) will be de-configured: LISTENER 67The following databases were selected for de-configuration : orclyz 68Database unique name : orclyz 69Storage used : FS 70No Enterprise Manager configuration to be updated for any database(s) 71No Enterprise Manager ASM targets to update 72No Enterprise Manager listener targets to migrate 73Checking the config status for CCR 74Oracle Home exists with CCR directory, but CCR is not configured 75CCR check is finished 76Do you want to continue (y - yes, n - no)? [n]: y 77A log of this session will be written to: '/tmp/deinstall2018-03-08_08-53-24-AM/logs/deinstall_deconfig2018-03-08_08-53-33-AM.out' 78Any error messages from this session will be written to: '/tmp/deinstall2018-03-08_08-53-24-AM/logs/deinstall_deconfig2018-03-08_08-53-33-AM.err' 79 80######################## CLEAN OPERATION START ######################## 81 82Enterprise Manager Configuration Assistant START 83 84EMCA de-configuration trace file location: /tmp/deinstall2018-03-08_08-53-24-AM/logs/emcadc_clean.log 85 86Updating Enterprise Manager ASM targets (if any) 87Updating Enterprise Manager listener targets (if any) 88Enterprise Manager Configuration Assistant END 89Database de-configuration trace file location: /tmp/deinstall2018-03-08_08-53-24-AM/logs/databasedc_clean1081110075195191916.log 90Database Clean Configuration START orclyz 91This operation may take few minutes. 92Database Clean Configuration END orclyz 93 94Network Configuration clean config START 95 96Network de-configuration trace file location: /tmp/deinstall2018-03-08_08-53-24-AM/logs/netdc_clean1072295666521765217.log 97 98De-configuring Single Instance listener(s): LISTENER 99 100De-configuring listener: LISTENER 101 Stopping listener: LISTENER 102 Listener stopped successfully. 103 Deleting listener: LISTENER 104 Listener deleted successfully. 105Listener de-configured successfully. 106 107De-configuring Naming Methods configuration file... 108Naming Methods configuration file de-configured successfully. 109 110De-configuring backup files... 111Backup files de-configured successfully. 112 113The network configuration has been cleaned up successfully. 114 115Network Configuration clean config END 116 117Oracle Configuration Manager clean START 118OCM clean log file location : /tmp/deinstall2018-03-08_08-53-24-AM/logs//ocm_clean5456.log 119Oracle Configuration Manager clean END 120Oracle Universal Installer clean START 121 122Detach Oracle home '/data/app/oracle/product/11.2.0/db_1' from the central inventory on the local node : Done 123 124Delete directory '/data/app/oracle/product/11.2.0/db_1' on the local node : Done 125 126Delete directory '/data/app/oraInventory' on the local node : Done 127 128Delete directory '/data/app/oracle' on the local node : Done 129 130Oracle Universal Installer cleanup was successful. 131 132Oracle Universal Installer clean END 133 134 135Oracle install clean START 136 137Clean install operation removing temporary directory '/tmp/install' on node 'PostalDataDG' 138 139Oracle install clean END 140 141 142######################### CLEAN OPERATION END ######################### 143 144 145####################### CLEAN OPERATION SUMMARY ####################### 146Successfully de-configured the following database instances : orclyz 147Following Single Instance listener(s) were de-configured successfully: LISTENER 148Cleaning the config for CCR 149As CCR is not configured, so skipping the cleaning of CCR configuration 150CCR clean is finished 151Successfully detached Oracle home '/data/app/oracle/product/11.2.0/db_1' from the central inventory on the local node. 152Successfully deleted directory '/data/app/oracle/product/11.2.0/db_1' on the local node. 153Successfully deleted directory '/data/app/oraInventory' on the local node. 154Successfully deleted directory '/data/app/oracle' on the local node. 155Oracle Universal Installer cleanup was successful. 156 157 158Run 'rm -rf /etc/oraInst.loc' as root on node(s) 'PostalDataDG' at the end of the session. 159 160Oracle install successfully cleaned up the temporary directories. 161####################################################################### 162 163 164############# ORACLE DEINSTALL & DECONFIG TOOL END ############# 165
<br/> <br/>