Oracle RAC 下非缺省端口监听配置(listener.ora tnsnames.ora)
不论是单实例还是RAC,对于非缺省端口下(1521)的监听器,pmon进程不会将service/instance注册到监听器,即不会实现动态注册。与单实例相同,RAC非缺省端口的监听器也是通过设置参数local_listener来达到目的。除此之外,还可以对实例进行远程注册,以达到负载均衡的目的。这是通过一个参数remote_listener来实现。
一、创建非缺省的监听器
使用netca新建一个非缺省的listener,当然也可以直接修改各节点上的listener.ora
Oracle@bo2dbp:~> export DISPLAY=192.168.7.133:0.0
oracle@bo2dbp:~> netca
--选择cluster configuration
--选择所有的节点
--选择listener configuration
--选择add
--设定一个新的监听器的名字,假定为LISTENER_NEW
--选择tcp
--设定非缺省的端口号,此处设定为1314
--选择no,点击next等待完成
--如之前已经存在缺省的监听器,此时出现提示选择启动那个监听,选择刚建的LISTENER_NEW
--next,提示完成, finish
二、缺省监听器与非缺省监听器对照
- oracle@bo2dbp:~> ps -ef | grep lsnr
- oracle 21097 1 0 17:40 ? 00:00:00 /u01/oracle/db/bin/tnslsnr LISTENER_BO2DBP -inherit
- oracle 26228 1 0 17:58 ? 00:00:00 /u01/oracle/db/bin/tnslsnr LISTENER_NEW_BO2DBP -inherit
- oracle 28842 19468 0 17:58 pts/1 00:00:00 grep lsnr
- 此时可以看到有两个监听器,一个是原来缺省的,一个是新增加的,注意监听器的命名,RAC环境下是监听器的名字加上hostname
- 下面的listener.ora的内容已经包含了两个监听器,一个是缺省的,一个是非缺省的。
- 相应地,listener.ora中也多出了刚刚创建的非缺省监听器
- oracle@bo2dbp:~> more $ORACLE_HOME/network/admin/listener.ora
- # listener.ora.bo2dbp Network Configuration File: /u01/oracle/db/network/admin/listener.ora.bo2dbp
- # Generated by Oracle configuration tools.
- LISTENER_NEW_BO2DBP =
- (DESCRIPTION_LIST =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = bo2dbp-vip.2gotrade.com)(PORT = 1314)(IP = FIRST))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.51)(PORT = 1314)(IP = FIRST))
- )
- )
- LISTENER_BO2DBP =
- (DESCRIPTION_LIST =
- (DESCRIPTION =
- (ADDRESS = (PROTOCOL = TCP)(HOST = bo2dbp-vip.2gotrade.com)(PORT = 1521)(IP = FIRST))
- (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.51)(PORT = 1521)(IP = FIRST))
- )
- )
- SID_LIST_LISTENER_NEW_BO2DBP =
- (SID_LIST =
- (SID_DESC =
- (SID_NAME = PLSExtProc)
- (ORACLE_HOME = /u01/oracle/db)
- (PROGRAM = extproc)
- )
- )
- SID_LIST_LISTENER_BO2DBP =
- (SID_LIST =
- (SID_DESC =
- (SID_NAME = PLSExtProc)
- (ORACLE_HOME = /u01/oracle/db)
- (PROGRAM = extproc)
- )
- )
- #查看监听器的状态
- oracle@bo2dbp:~> ./crs_stat.sh
- Resource name Target State
- -------------- ------ -----
- ora.GOBO4.GOBO4A.inst ONLINE ONLINE on bo2dbp
- ora.GOBO4.GOBO4B.inst ONLINE ONLINE on bo2dbs
- ora.GOBO4.db ONLINE ONLINE on bo2dbp
- ora.bo2dbp.ASM1.asm ONLINE ONLINE on bo2dbp
- ora.bo2dbp.LISTENER_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
- ora.bo2dbp.LISTENER_NEW_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
- ora.bo2dbp.gsd ONLINE ONLINE on bo2dbp
- ora.bo2dbp.ons ONLINE ONLINE on bo2dbp
- ora.bo2dbp.vip ONLINE ONLINE on bo2dbp
- ora.bo2dbs.ASM2.asm ONLINE ONLINE on bo2dbs
- ora.bo2dbs.LISTENER_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
- ora.bo2dbs.LISTENER_NEW_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
- ora.bo2dbs.gsd ONLINE ONLINE on bo2dbs
- ora.bo2dbs.ons ONLINE ONLINE on bo2dbs
- ora.bo2dbs.vip ONLINE ONLINE on bo2dbs
- ora.ora10g.db ONLINE ONLINE on bo2dbp
- ora.ora10g.ora10g1.inst ONLINE ONLINE on bo2dbp
- ora.ora10g.ora10g2.inst ONLINE ONLINE on bo2dbs
- #比较缺省监听器与非缺省监听器的状态
- oracle@bo2dbp:~> lsnrctl
- LSNRCTL> set current_listener LISTENER_NEW_BO2DBP
- LSNRCTL> status #端口号为非缺省的情形下仅存在Service "PLSExtProc",这是因为没有动态注册的原因
- Services Summary...
- Service "PLSExtProc" has 1 instance(s).
- Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
- The command completed successfully
- LSNRCTL> set current_listener LISTENER_BO2DBP
- Current Listener is LISTENER_BO2DBP
- LSNRCTL> status
- .........
- Listening Endpoints Summary...
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.61)(PORT=1521)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.51)(PORT=1521)))
- Services Summary...
- .........
- Service "ora10g" has 2 instance(s).
- Instance "ora10g1", status READY, has 2 handler(s) for this service...
- Instance "ora10g2", status READY, has 1 handler(s) for this service...
- .........
- The command completed successfully
- oracle@bo2dbp:~> lsnrctl status #查看缺省监听器的状态(即断口号为1521)
- .......
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.61)(PORT=1521)))
- (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.51)(PORT=1521)))
- Services Summary...
- .......
- Service "ora10g" has 2 instance(s).
- Instance "ora10g1", status READY, has 2 handler(s) for this service...
- Instance "ora10g2", status READY, has 1 handler(s) for this service...
- .......
- The command completed successfully
- #查看此时local_listener与remote_listener参数
- #Author: Robinson Cheng
- #Blog : http://www.linuxidc.com
- SQL> show parameter instance_name
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- instance_name string ora10g1
- SQL> show parameter listener
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- local_listener string
- remote_listener string LISTENERS_ORA10G
- 结论,与单实例相同,如果未设定非缺省的listener,则使用listener 与LISTENER_BO2DBP查看到相同的结果
- 也就是说lsnrctl status [listener_nam]查看的本身就是缺省端口监听器的信息
- 对于非缺省端口的监听器,未设置local_listener时不会有数据库实例注册
- #关闭缺省的监听器
- SQL> ho srvctl stop listener -n bo2dbp -l LISTENER_BO2DBP
- SQL> ho srvctl stop listener -n bo2dbs -l LISTENER_BO2DBS
- SQL> ho ./crs_stat.sh
- Resource name Target State
- -------------- ------ -----
- ora.GOBO4.GOBO4A.inst OFFLINE OFFLINE
- ora.GOBO4.GOBO4B.inst OFFLINE OFFLINE
- ora.GOBO4.db OFFLINE OFFLINE
- ora.bo2dbp.ASM1.asm ONLINE ONLINE on bo2dbp
- ora.bo2dbp.LISTENER_BO2DBP.lsnr OFFLINE OFFLINE
- ora.bo2dbp.LISTENER_NEW_BO2DBP.lsnr ONLINE ONLINE on bo2dbp
- ora.bo2dbp.gsd ONLINE ONLINE on bo2dbp
- ora.bo2dbp.ons ONLINE ONLINE on bo2dbp
- ora.bo2dbp.vip ONLINE ONLINE on bo2dbp
- ora.bo2dbs.ASM2.asm ONLINE ONLINE on bo2dbs
- ora.bo2dbs.LISTENER_BO2DBS.lsnr OFFLINE OFFLINE
- ora.bo2dbs.LISTENER_NEW_BO2DBS.lsnr ONLINE ONLINE on bo2dbs
- ora.bo2dbs.gsd ONLINE ONLINE on bo2dbs
- ora.bo2dbs.ons ONLINE ONLINE on bo2dbs
- ora.bo2dbs.vip ONLINE ONLINE on bo2dbs
- ora.ora10g.db ONLINE ONLINE on bo2dbp
- ora.ora10g.ora10g1.inst ONLINE ONLINE on bo2dbp
- ora.ora10g.ora10g2.inst ONLINE ONLINE on bo2dbs
相关推荐
LuoXinLoves 2020-08-09
dataminer 2020-06-21
lklong 2020-11-22
oraclemch 2020-11-06
shilukun 2020-10-10
周嘉笙 2020-11-09
iilegend 2020-10-19
EricRay 2020-10-16
zhuzhufxz 2020-09-16
dataminer 2020-08-17
bfcady 2020-08-16
Hody 2020-08-16
FightFourEggs 2020-08-16
数据库设计 2020-08-16
Seandba 2020-08-16
Omega 2020-08-16
zjyzz 2020-08-16
yanghuatong 2020-08-16