操作Oracle的时候失误导致Oracle无法启动了,试过了所有的办法依旧不行,主要体现在无法登录sysdba,那么此时什么操作都做不了,无奈之下只能选择重装了,不过在重装Oracle前就需要先卸载已安装的Oracle。

关闭Oracle数据库

1
2
3
4
5
sqlplus /nolog

conn / as sysdba

SHUTDOWN IMMEDIATE;

停止Listerner进程

1
lsnrctl stop

使用deinstlal删除Oracle的可执行文件和配置文件

由于操作失误,无法登录sysdba,只能从第三步开始了。
$ORACLE_HOME/deinstall/下,执行:

1
./deinstall 

此时会输出如下信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Checking for required files and bootstrapping ...
Please wait ...
Location of logs /home/oracle/app/oracle11g/oraInventory/logs/

############ ORACLE DEINSTALL & DECONFIG TOOL START ############


######################## CHECK OPERATION START ########################
Install check configuration START
Checking for existence of the Oracle home location /home/oracle/app/oracle11g/product/11.2.0/db_2
Oracle Home type selected for de-install is: SIDB
Oracle Base selected for de-install is: /home/oracle/app/oracle11g
Checking for existence of central inventory location /home/oracle/app/oracle11g/oraInventory

Install check configuration END


Network Configuration check config START

Network de-configuration trace file location: /home/oracle/app/oracle11g/oraInventory/logs/netdc_check7601392942022282245.log

Specify all Single Instance listeners that are to be de-configured [LISTENER]:

Network Configuration check config END

Database Check Configuration START

Database de-configuration trace file location: /home/oracle/app/oracle11g/oraInventory/logs/databasedc_check2946133073081788603.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 []:
Database Check Configuration END

Enterprise Manager Configuration Assistant START

EMCA de-configuration trace file location: /home/oracle/app/oracle11g/oraInventory/logs/emcadc_check.log

Enterprise Manager Configuration Assistant END
Oracle Configuration Manager check START
OCM check log file location : /home/oracle/app/oracle11g/oraInventory/logs//ocm_check7739.log
Oracle Configuration Manager check END

######################### CHECK OPERATION END #########################


####################### CHECK OPERATION SUMMARY #######################
Oracle Home selected for de-install is: /home/oracle/app/oracle11g/product/11.2.0/db_2
Inventory Location where the Oracle home registered is: /home/oracle/app/oracle11g/oraInventory
Following Single Instance listener(s) will be de-configured: LISTENER
No Enterprise Manager configuration to be updated for any database(s)
No Enterprise Manager ASM targets to update
No Enterprise Manager listener targets to migrate
Checking the config status for CCR
Oracle Home exists with CCR directory, but CCR is not configured
CCR check is finished
Do you want to continue (y - yes, n - no)? [n]: y
A log of this session will be written to: '/home/oracle/app/oracle11g/oraInventory/logs/deinstall_deconfig2019-08-14_11-04-58-AM.out'
Any error messages from this session will be written to: '/home/oracle/app/oracle11g/oraInventory/logs/deinstall_deconfig2019-08-14_11-04-58-AM.err'

######################## CLEAN OPERATION START ########################

Enterprise Manager Configuration Assistant START

EMCA de-configuration trace file location: /home/oracle/app/oracle11g/oraInventory/logs/emcadc_clean.log

Updating Enterprise Manager ASM targets (if any)
Updating Enterprise Manager listener targets (if any)
Enterprise Manager Configuration Assistant END
Database de-configuration trace file location: /home/oracle/app/oracle11g/oraInventory/logs/databasedc_clean3487982831160761002.log

Network Configuration clean config START

Network de-configuration trace file location: /home/oracle/app/oracle11g/oraInventory/logs/netdc_clean6092033431033289084.log

De-configuring Single Instance listener(s): LISTENER

De-configuring listener: LISTENER
Stopping listener: LISTENER
Warning: Failed to stop listener. Listener may not be running.
Deleting listener: LISTENER
Listener deleted successfully.
Listener de-configured successfully.

De-configuring Listener configuration file...
Listener configuration file de-configured successfully.

De-configuring Naming Methods configuration file...
Naming Methods configuration file de-configured successfully.

De-configuring Local Net Service Names configuration file...
Local Net Service Names configuration file de-configured successfully.

De-configuring backup files...
Backup files de-configured successfully.

The network configuration has been cleaned up successfully.

Network Configuration clean config END

Oracle Configuration Manager clean START
OCM clean log file location : /home/oracle/app/oracle11g/oraInventory/logs//ocm_clean7739.log
Oracle Configuration Manager clean END
Oracle Universal Installer clean START

Detach Oracle home '/home/oracle/app/oracle11g/product/11.2.0/db_2' from the central inventory on the local node : Done

Delete directory '/home/oracle/app/oracle11g/product/11.2.0/db_2' on the local node : Done

The Oracle Base directory '/home/oracle/app/oracle11g' will not be removed on local node. The directory is in use by Oracle Home '/home/oracle/app/oracle11g/product/11.2.0/db_1'.

The Oracle Base directory '/home/oracle/app/oracle11g' will not be removed on local node. The directory is in use by central inventory.

Oracle Universal Installer cleanup was successful.

Oracle Universal Installer clean END


Oracle install clean START

Clean install operation removing temporary directory '/tmp/install' on node 'bogon'

Oracle install clean END


######################### CLEAN OPERATION END #########################


####################### CLEAN OPERATION SUMMARY #######################
Following Single Instance listener(s) were de-configured successfully: LISTENER
Cleaning the config for CCR
As CCR is not configured, so skipping the cleaning of CCR configuration
CCR clean is finished
Successfully detached Oracle home '/home/oracle/app/oracle11g/product/11.2.0/db_2' from the central inventory on the local node.
Successfully deleted directory '/home/oracle/app/oracle11g/product/11.2.0/db_2' on the local node.
Oracle Universal Installer cleanup was successful.

Oracle install successfully cleaned up the temporary directories.
#######################################################################


############# ORACLE DEINSTALL & DECONFIG TOOL END #############

删除/etc下面的oraInst.loc、oratab,删除/opt目录下的ORCLfmap

1
2
3
rm -fr /etc/oraInst.loc 
rm -fr /etc/oratab
rm -fr /opt/ORCLfmap/

删除/usr/local/bin下面的Oracle相关的所有文件

1
2
3
rm -fr /usr/local/bin/oraenv 
rm -fr /usr/local/bin/coraenv
rm -fr /usr/local/bin/dbhome

删除/tmp目录下Oracle相关的文件

1
2
3
rm -fr /tmp/deinstall2019-08-14_11-04-39-AM/
rm -fr /tmp/OraInstall2019-08-14_11-05-12-AM/
rm -fr /tmp/hsperfdata_oracle/

删除Oracle的安装目录

1
rm -fr /home/oracle/app/

删除Oracle用户相关

1
2
3
userdel oracle
groupdel dba
groupdel oinstall

重启系统,此时基本上已经干净,最好检查下环境变量,因为我卸载了oracle11g,安装的版本是oracle12c,那么有部分配置读取了原来的旧的环境变量。例如:我新安装的$ORACLE_HOME/home/oracle/app/oracle12c/product/11.2.0/db_2。不过也是临时用一下而已,无所谓了。