1.使用 deinstall 工具删除安装的 Oracle 软件的可执行文件和配置文件
[oracle@ocpstudy admin]$ cd $ORACLE_HOME
[oracle@ocpstudy db_1]$ cd deinstall
[oracle@ocpstudy deinstall]$ ls
bootstrap_files.lst bootstrap.pl deinstall deinstall.pl deinstall.xml jlib readme.txt response sshUserSetup.sh utl
[oracle@ocpstudy deinstall]$ ./deinstall
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /tmp/deinstall2024-03-16_09-22-00PM/logs/
############ ORACLE DECONFIG TOOL START ############
######################### DECONFIG CHECK OPERATION START #########################
## [START] Install check configuration ##
Checking for existence of the Oracle home location /u01/app/oracle/product/19.3.0/db_1
Oracle Home type selected for deinstall is: Oracle Single Instance Database
Oracle Base selected for deinstall is: /u01/app/oracle
Checking for existence of central inventory location /u01/app/oraInventory
## [END] Install check configuration ##
Network Configuration check config START
Network de-configuration trace file location: /tmp/deinstall2024-03-16_09-22-00PM/logs/netdc_check2024-03-16_09-22-21PM.log
Network Configuration check config END
Database Check Configuration START
Database de-configuration trace file location: /tmp/deinstall2024-03-16_09-22-00PM/logs/databasedc_check2024-03-16_09-22-21PM.log
Use comma as separator when specifying list of values as input
Specify the list of database names that are configured in this Oracle home [orcl,oradb]: --这里提示现在有两个数据库,确认删除哪个数据库,直接回车表示两个都删除。这个是测试环境,本例直接回车。
###### For Database 'orcl' ######
Single Instance Database
The diagnostic destination location of the database: /u01/app/oracle/diag/rdbms/orcl
Storage type used by the Database: FS
Database file location: /u01/app/oracle/oradata/ORCL,/u01/app/oracle/fast_recovery_area/ORCL
Fast recovery area location: /u01/app/oracle/fast_recovery_area/ORCL
database spfile location: /u01/app/oracle/product/19.3.0/db_1/dbs/spfileorcl.ora
###### For Database 'oradb' ######
Single Instance Database
The diagnostic destination location of the database: /u01/app/oracle/diag/rdbms/oradb
Storage type used by the Database: FS
Database file location: /u01/app/oracle/oradata/ORADB
Fast recovery area location: Does not exist
database spfile location: /u01/app/oracle/product/19.3.0/db_1/dbs/spfileoradb.ora
The details of database(s) orcl,oradb have been discovered automatically. Do you still want to modify the details of orcl,oradb database(s)? [n]: --这里询问是否显示详细信息,这里直接回车。
Database Check Configuration END
######################### DECONFIG CHECK OPERATION END #########################
####################### DECONFIG CHECK OPERATION SUMMARY #######################
Oracle Home selected for deinstall is: /u01/app/oracle/product/19.3.0/db_1
Inventory Location where the Oracle home registered is: /u01/app/oraInventory
The following databases were selected for de-configuration. The databases will be deleted and will not be useful upon de-configuration : orcl,oradb
Database unique name : orcl
Storage used : FS
Database unique name : oradb
Storage used : FS
Do you want to continue (y - yes, n - no)? [n]: y --这里选择y,表示继续删除。
A log of this session will be written to: '/tmp/deinstall2024-03-16_09-22-00PM/logs/deinstall_deconfig2024-03-16_09-22-16-PM.out'
Any error messages from this session will be written to: '/tmp/deinstall2024-03-16_09-22-00PM/logs/deinstall_deconfig2024-03-16_09-22-16-PM.err'
######################## DECONFIG CLEAN OPERATION START ########################
Database de-configuration trace file location: /tmp/deinstall2024-03-16_09-22-00PM/logs/databasedc_clean2024-03-16_09-22-21PM.log
Database Clean Configuration START orcl
This operation may take few minutes.
Database Clean Configuration END orcl
Database Clean Configuration START oradb
This operation may take few minutes.
Database Clean Configuration END oradb
Network Configuration clean config START
Network de-configuration trace file location: /tmp/deinstall2024-03-16_09-22-00PM/logs/netdc_clean2024-03-16_09-22-21PM.log
De-configuring backup files...
Backup files de-configured successfully.
The network configuration has been cleaned up successfully.
Network Configuration clean config END
######################### DECONFIG CLEAN OPERATION END #########################
####################### DECONFIG CLEAN OPERATION SUMMARY #######################
Successfully de-configured the following database instances : orcl,oradb
#######################################################################
############# ORACLE DECONFIG TOOL END #############
Using properties file /tmp/deinstall2024-03-16_09-22-00PM/response/deinstall_2024-03-16_09-22-16-PM.rsp
Location of logs /tmp/deinstall2024-03-16_09-22-00PM/logs/
############ ORACLE DEINSTALL TOOL START ############
####################### DEINSTALL CHECK OPERATION SUMMARY #######################
A log of this session will be written to: '/tmp/deinstall2024-03-16_09-22-00PM/logs/deinstall_deconfig2024-03-16_09-22-16-PM.out'
Any error messages from this session will be written to: '/tmp/deinstall2024-03-16_09-22-00PM/logs/deinstall_deconfig2024-03-16_09-22-16-PM.err'
######################## DEINSTALL CLEAN OPERATION START ########################
## [START] Preparing for Deinstall ##
Setting LOCAL_NODE to ocpstudy
Setting CRS_HOME to false
Setting oracle.installer.invPtrLoc to /tmp/deinstall2024-03-16_09-22-00PM/oraInst.loc
Setting oracle.installer.local to false
## [END] Preparing for Deinstall ##
Setting the force flag to false
Setting the force flag to cleanup the Oracle Base
Oracle Universal Installer clean START
Detach Oracle home '/u01/app/oracle/product/19.3.0/db_1' from the central inventory on the local node : Done
Delete directory '/u01/app/oracle/product/19.3.0/db_1' on the local node : Done
Delete directory '/u01/app/oraInventory' on the local node : Done
Delete directory '/u01/app/oracle' on the local node : Done
Oracle Universal Installer cleanup was successful.
Oracle Universal Installer clean END
## [START] Oracle install clean ##
## [END] Oracle install clean ##
######################### DEINSTALL CLEAN OPERATION END #########################
####################### DEINSTALL CLEAN OPERATION SUMMARY #######################
Successfully detached Oracle home '/u01/app/oracle/product/19.3.0/db_1' from the central inventory on the local node.
Successfully deleted directory '/u01/app/oracle/product/19.3.0/db_1' on the local node.
Successfully deleted directory '/u01/app/oraInventory' on the local node.
Successfully deleted directory '/u01/app/oracle' on the local node.
Oracle Universal Installer cleanup was successful.
Run 'rm -r /etc/oraInst.loc' as root on node(s) 'ocpstudy' at the end of the session.
Run 'rm -r /opt/ORCLfmap' as root on node(s) 'ocpstudy' at the end of the session.
Run 'rm -r /etc/oratab' as root on node(s) 'ocpstudy' at the end of the session.
Oracle deinstall tool successfully cleaned up temporary directories.
#######################################################################
############# ORACLE DEINSTALL TOOL END #############
[oracle@ocpstudy deinstall]$
到这里就卸载完成了,这是进入$ORACLE_HOME路径,会发面里面已经没有文件了。
[oracle@ocpstudy deinstall]$ echo $ORACLE_HOME
/u01/app/oracle/product/19.3.0/db_1
[oracle@ocpstudy deinstall]$ cd /u01/app/
[oracle@ocpstudy app]$ ls
[oracle@ocpstudy app]$
2.删除/etc 目录下的 oraInst.loc、oratab
[root@ocpstudy ~]# cd /etc
[root@ocpstudy etc]# ls ora --这里按两次tab键
oracle-release oraInst.loc oratab
[root@ocpstudy etc]# rm -f oraInst.loc
[root@ocpstudy etc]# rm -f oratab
3.删除/opt 目录下的 ORCLfmap
[root@ocpstudy etc]# cd /opt
[root@ocpstudy opt]# ls
ORCLfmap rh
[root@ocpstudy opt]# rm -rf ORCLfmap
4.删除/usr/local/bin 下面 Oracle 的所有文件
[root@ocpstudy opt]# cd /usr/local/bin
[root@ocpstudy bin]# ll
total 264
-rwxr-xr-x. 1 root root 6404 Mar 14 19:37 coraenv
-rwxr-xr-x. 1 root root 2445 Mar 14 19:37 dbhome
-rwxr-xr-x. 1 root root 6823 Mar 14 19:37 oraenv
-rwxr-xr-x. 1 root root 248592 Mar 16 18:08 rlwrap
[root@ocpstudy bin]# rm -f dbhome
[root@ocpstudy bin]# rm -f oraenv
5.删除/tmp 目录下 Oracle 的相关文件
[root@ocpstudy bin]# cd /tmp
[root@ocpstudy tmp]# ll
total 76
-rw-r--r--. 1 root root 1760 Mar 13 16:51 anaconda.log
-rw-r-----. 1 oracle oinstall 12284 Mar 16 21:39 Cleanup2024-03-16_09-39-02PM.log
drwxr-x---. 3 oracle oinstall 4096 Mar 16 01:07 CVU_19.0.0.0.0_oracle
drwxr-xr-x. 4 oracle oinstall 34 Mar 16 21:39 deinstall2024-03-16_09-22-00PM
drwxr-xr-x. 2 oracle oinstall 6 Mar 16 21:39 hsperfdata_oracle
drwxr-xr-x. 2 root root 18 Mar 13 15:54 hsperfdata_root
-rw-r--r--. 1 root root 581 Mar 13 16:48 ifcfg.log
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 15:30 InstallActions2024-03-14_03-30-44PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 15:34 InstallActions2024-03-14_03-34-22PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 15:45 InstallActions2024-03-14_03-45-49PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 15:52 InstallActions2024-03-14_03-52-05PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 15:53 InstallActions2024-03-14_03-53-27PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 16:02 InstallActions2024-03-14_04-02-30PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 16:55 InstallActions2024-03-14_04-55-53PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 17:02 InstallActions2024-03-14_05-02-05PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 17:03 InstallActions2024-03-14_05-03-15PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 17:04 InstallActions2024-03-14_05-04-45PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 17:06 InstallActions2024-03-14_05-06-44PM
drwxr-xr-x. 2 oracle oinstall 4096 Mar 14 17:09 InstallActions2024-03-14_05-09-01PM
-rwx------. 1 root root 836 Mar 13 16:20 ks-script-1UUfgY
drwxr-xr-x. 2 oracle oinstall 6 Mar 16 21:39 OraInstall2024-03-16_09-39-02PM
-rw-r--r--. 1 root root 0 Mar 13 16:37 packaging.log
-rw-r--r--. 1 root root 0 Mar 13 16:37 program.log
-rw-r--r--. 1 root root 0 Mar 13 16:37 sensitive-info.log
drwx------. 2 root root 24 Mar 14 17:08 ssh-5P9kvMNCwX0o
drwx------. 2 root root 25 Mar 13 16:51 ssh-Jb4LB2KmUIrP
drwx------. 2 oracle oinstall 24 Mar 14 17:18 ssh-Nc52D6WDwXkN
-rw-r--r--. 1 root root 0 Mar 13 16:37 storage.log
drwx------. 3 root root 17 Mar 14 17:08 systemd-private-c4f4a4ff56b448cf8995dfcc54d58e9f-bolt.service-uWgXrN
drwx------. 3 root root 17 Mar 14 17:08 systemd-private-c4f4a4ff56b448cf8995dfcc54d58e9f-colord.service-7VTlaR
drwx------. 3 root root 17 Mar 14 17:07 systemd-private-c4f4a4ff56b448cf8995dfcc54d58e9f-cups.service-fRm9ni
drwx------. 3 root root 17 Mar 14 17:08 systemd-private-c4f4a4ff56b448cf8995dfcc54d58e9f-fwupd.service-XS03n0
drwx------. 3 root root 17 Mar 14 17:07 systemd-private-c4f4a4ff56b448cf8995dfcc54d58e9f-rtkit-daemon.service-bBPyEg
drwx------. 2 root root 6 Mar 13 16:52 tracker-extract-files.0
drwx------. 2 oracle oinstall 6 Mar 14 20:11 tracker-extract-files.54321
drwx------. 2 root root 6 Mar 14 11:29 vmware-root_887-4013330030
drwx------. 2 root root 6 Mar 13 16:37 vmware-root_920-2731086625
drwx------. 2 root root 6 Mar 14 16:53 vmware-root_923-3988752765
drwx------. 2 root root 6 Mar 14 17:07 vmware-root_939-4022308693
-rw-------. 1 root root 0 Mar 13 15:49 yum.log
删除该路径下oracle用户 oinstall组的文件。
6.删除 Oracle 安装目录
7.删除 Oracle 用户, dba、oinstall 用户组
# userdel -r oracle
# groupdel dba
# groupdel oinstall
标签:03,教程,Mar,14,16,数据库,oracle,Oracle,root From: https://blog.csdn.net/Ruishine/article/details/136770253这里的 -r 选项表示在删除用户的同时删除用户的家目录。
注意,在删除用户的同时如果不删除用户的家目录,那么家目录就会变成没有属主和属组的目录,也就是垃圾文件。