重启has后,资源依然没有自动主导到CRS,但是可以通过srvctl添加数据库资源到CRS了,不再报没有权限等错误,不知道是否是Oracle 11gR2的一个bug。DBCA前需要重启一下has,或者先DBCA装完,然后重启has再添加数据库资源,我使用的是后者的方法
虽然资源添加上了,但是要启动数据库实例这个资源,还是报错,现在是提示TNS丢失连接,既然是TNS的错,那么就先用Oracle用户创建一个tnsnames.ora,完了再用Grid把监听启动(使用GI时,通常是用grid用户创建监听的)
[grid@zlm bin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 07-JAN-2015 00:19:36
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Starting /g01/app/11.2.0/grid/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /g01/app/11.2.0/grid/network/admin/listener.ora
Log messages written to /g01/app/grid/diag/tnslsnr/zlm/listener/alert/log.xml
Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=zlm)(PORT=1521)))
TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use
Listener failed to start. See the error message(s) above...
启动监听依然是报错
根据Linux Error: 98可以判断,发生这种问题是由于端口被程序绑定而没有释放造成
可以使用netstat -lp命令查询当前处于连接的程序以及对应的进程信息
然后用ps pid 察看对应的进程,并使用kill pid 关闭该进程即可
[grid@zlm bin]$ cat /g01/app/11.2.0/grid/network/admin/listener.ora
# listener.ora Network Configuration File: /g01/app/11.2.0/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = asm11g)
(ORACLE_HOME = /g01/app/11.2.0/grid)
(SID_NAME = asm11g)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = zlm)(PORT = 1521))
)
ADR_BASE_LISTENER = /g01/app/grid
[grid@zlm bin]$ echo $ORACLE_SID
+ASM
[grid@zlm bin]$ netca
用grid创建监听,提示1521端口已经被占用了
[root@zlm ~]# netstat -nalp|grep 1521
tcp 0 0 0.0.0.0:1521 0.0.0.0:* LISTEN 27855/tnslsnr
[root@zlm ~]# kill 27855
[root@zlm ~]# netstat -nalp|grep 1521
[root@zlm ~]#
直接启动也是报错:
[oracle@zlm asm11g]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Wed Jan 7 00:53:52 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+DATA/asm11g/spfileasm11g.ora'
ORA-17503: ksfdopn:2 Failed to open file +DATA/asm11g/spfileasm11g.ora
ORA-12547: TNS:lost contact
<txt>Started with pid=28061
</txt>
</msg>
<msg time='2015-01-07T01:13:47.048+08:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='zlm'
host_addr='180.168.41.175'>
<txt>Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=zlm)(PORT=1521)))
</txt>
</msg>
<msg time='2015-01-07T01:13:47.048+08:00' org_id='oracle' comp_id='tnslsnr'
type='UNKNOWN' level='16' host_id='zlm'
host_addr='180.168.41.175'>
<txt>TNS-12542: TNS:address already in use
TNS-12560: TNS:protocol adapter error
TNS-00512: Address already in use
Linux Error: 98: Address already in use
</txt>
</msg>
[grid@zlm alert]$ vi /etc/hosts
[grid@zlm alert]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
180.168.41.175 zlm
一直报监听被占用的问题原来出在这里,这个主机名的IP地址是自动生成的,没有对其进行过改动,把IP改成正确的,重新启动监听