oracle: local_listener,remote_listener,listener_networks参数

  • 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", status READY, 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, 2011, 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, OLAP, 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, 2011, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
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, 2011, 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", status READY, has 2 handler(s) for this service...
  Instance "rac11g2", status READY, has 1 handler(s) for this service...
The command completed successfully



  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值