[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进行远程注册。
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