Oracle 11g RAC 环境下单实例非缺省监听及端口配置(二)

2014-11-24 17:47:46 · 作者: · 浏览: 1
= 192.168.7.21)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = cnbo.orasrv.com)
)
)


--提示没有找到监听器,无法ping通,因为我们配置的监听器并没有启动
--尽管服务在缺省的监听器注册,但无法ping,即此路不通
[oracle@linux1 ~]$ tnsping cnbo


TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 16-AUG-2013 14:28:47


Copyright (c) 1997, 2009, Oracle. All rights reserved.


Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.21)(PORT = 1522)))
(CONNECT_DATA = (SERVICE_NAME = cnbo.orasrv.com)))
TNS-12541: TNS:no listener


--下面我们启动非缺省的监听器
[oracle@linux1 ~]$ lsnrctl start LISTENER_CNBO


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-AUG-2013 14:29:14
..............
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux1.orasrv.com)(PORT=1522)))
The listener supports no services
The command completed successfully


[oracle@linux1 ~]$ lsnrctl status LISTENER_CNBO


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-AUG-2013 14:30:20
.............
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux1.orasrv.com)(PORT=1522)))
The listener supports no services -->没有任何服务及实例注册到监听器,等N久也不会有实例注册
The command completed successfully -->因为这个是非缺省的,而且我们还没有配置动态注册


--下面我们来设置动态注册
--查看参数local_listener,此时已经被设置了,而且端口是1521,IP用的是虚IP
--这就是为什么实例创建后,会被自动注册到grid用户下缺省监听器的缘故
SQL> show parameter local_lis


NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD
DRESS=(PROTOCOL=TCP)(HOST=linu
x1-vip)(PORT=1521))))


--设置动态注册,收到了错误消息
SQL> alter system set local_listener='LISTENER_CNBO';
alter system set local_listener='LISTENER_CNBO'
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-00119: invalid specification for system parameter LOCAL_LISTENER
ORA-00132: syntax error or unresolved network name 'LISTENER_CNBO'


--对于前面出现的错误,给出两种解决方案,
--一是按照前面local_listener参数值的格式设置新的ip及端口,或者将这个描述信息添加到tnsnames.ora文件中
--下面我们选用了第二种解决方案
[oracle@linux1 ~]$ echo "
> LISTENER_CNBO =
> (ADDRESS_LIST =
> (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.21)(PORT = 1522))
> )">>$ORACLE_HOME/network/admin/tnsnames.ora


--再次设置参数local_listener
SQL> alter system set local_listener='LISTENER_CNBO';


System altered.


--下面可以看到实例及服务已经自动注册到监听器LISTENER_CNBO
[oracle@linux1 ~]$ lsnrctl status LISTENER_CNBO


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-AUG-2013 14:35:04
...................
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linux1.orasrv.com)(PORT=1522)))
Services Summary...
Service "cnbo.orasrv.com" has 1 instance(s).
Instance "cnbo", status READY, has 1 handler(s) for this service...
Service "cnboXDB.orasrv.com" has 1 instance(s).
Instance "cnbo", status READY, has 1 handler(s) for this service...
The command completed successfully


--下面查看grid用户下原来的服务cnbo.orasrv.com及实例cnbo也不复存在
[grid@linux1 ~]$ lsnrctl status


LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-AUG-2013 14:37:46
.....
Listening Endp