重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3707|回复: 0
打印 上一主题 下一主题

[参数设置] 关于local_listener,remote_listener,listener_networks参数

[复制链接]
跳转到指定楼层
楼主
发表于 2021-3-5 13:08:46 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 郑全 于 2021-3-5 13:09 编辑



local_listener参数:
当oracle的本地监听为非默认情况时,会用到local_listener参数。

remote_listener参数:
而当监听和实例本身不在同一台服务器上时,remote_listener参数就会起作用了。

例如:

192.168.2.30为数据库服务器,没有配监听。编辑tnsnames.ora和设置remote_listener参数:

[oracle@test1 admin]$ cat tnsnames.ora
list1522 =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.50)(PORT = 1522))
   )
[oracle@test1 admin]$ sqlplus  / as sysdba
sql> alter system set remote_listener=list1522;

System altered.

sql> exit
192.168.2.50为单独的监听服务器:

[oracle@rac10g01 ~]$ lsnrctl status listener1522

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 11-JUN-2018 15:05:09

Copyright (c) 1991,2013,Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac10g01.localdomain)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER1522
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                11-JUN-2018 14:59:33
Uptime                    0 days 0 hr. 5 min. 36 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/11203/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac10g01/listener1522/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac10g01.localdomain)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
Services Summary...
Service "orcl11r2" has 1 instance(s).
  Instance "orcl11r2",status READY,has 1 handler(s) for this service...
Service "orcl11r2_s" has 1 instance(s).
  Instance "orcl11r2",has 2 handler(s) for this service...
The command completed successfully
在192.168.2.31上客户端登陆测试:

[oracle@test2 admin]$ tnsping orcl11r2_s

TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 11-JUN-2018 15:04:31

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

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.50)(PORT = 1522)) (CONNECT_DATA = (SERVER = shared) (SERVICE_NAME = orcl11r2_s)))
OK (0 msec)
[oracle@test2 admin]$ sqlplus test/test@orcl11r2_s

sql*Plus: Release 11.2.0.3.0 Production on Mon Jun 11 15:04:43 2018

Copyright (c) 1982,Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning,OLAP,Data Mining and Real Application Testing options

sql> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning,Data Mining and Real Application Testing options
这种数据库实例和监听不在同一台机器上的情况并不多见。最常见的用法是利用remote_listener参数对scan的listener进行远程注册。

listener_networks参数:
当rac加入额外的监听时,一般会设置此参数。

例如11g的rac环境,新加入个192.168.4.0网段,在此网段上建立端口为1522的新监听。

#vip2为新加入的网络

[grid@test2 ~]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.2.30  test1  test1.localdomain

192.168.2.31  test2  test2.localdomain
192.168.2.32  test3  test3.localdomain
192.168.2.33  test2-vip test2-vip.localdomain
192.168.2.34  test3-vip test3-vip.localdomain
192.168.3.31  test2-priv test2-priv.localdomain
192.168.3.32  test3-priv test3-priv.localdomain

#vip 2
192.168.4.31  test22  test22.localdomain
192.168.4.32  test33  test33.localdomain

192.168.4.33  test2-vip2 test2-vip2.localdomain
192.168.4.34  test3-vip2 test3-vip2.localdomain

#scan
192.168.2.35  rac11g-scan  rac11g-scan.localdomain
network 2为新的网络资源:

[grid@test2 ~]$ srvctl config network
Network exists: 1/192.168.2.0/255.255.255.0/ens32,type static
Network exists: 2/192.168.4.0/255.255.255.0/ens34,type static
当新的1522监听建立后,是没有任何服务注册进来的。这时就需要设置listener_networks参数了:

[oracle@test2 ~]$ sqlplus  / as sysdba

sql*Plus: Release 11.2.0.3.0 Production on Mon Jun 11 15:32:23 2018

Copyright (c) 1982,Real Application Clusters,Automatic Storage Management,Data Mining and Real Application Testing options

sql> show parameter listener_networks

NAME                     TYPE     VALUE
------------------------------------ ----------- ------------------------------
listener_networks             string     ((NAME=network1)(LOCAL_LISTENE
                         R=listener_net1)(REMOTE_LISTEN
                         ER=rac11g-scan:1521)),((NAME=
                         network2)(LOCAL_LISTENER=liste
                         ner_net2)(REMOTE_LISTENER=remo
                         te_net2))
此时看监听的状态,已经有新的服务自动注册进来了,这时,新的网段的vip就能对外提供监听服务了。

[grid@test2 ~]$ lsnrctl status listener1522

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-JUN-2018 15:34:00

Copyright (c) 1991,Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER1522)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER1522
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                11-JUN-2018 09:42:59
Uptime                    0 days 5 hr. 51 min. 1 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11203/grid/network/admin/listener.ora
Listener Log File         /u01/app/11203/grid/log/diag/tnslsnr/test2/listener1522/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.4.33)(PORT=1522)))
Services Summary...
Service "rac11g" has 2 instance(s).
  Instance "rac11g1",has 2 handler(s) for this service...
  Instance "rac11g2",has 1 handler(s) for this service...
The command completed successfully

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-1 10:23 , Processed in 0.139303 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表