e实例动态注册动作是在1521端口的监听程序上进行的,1531端口并没有被注册;
默认监听器的问题好解决,只要我们只保留一个监听即可。那么,如何让Oracle实例在1531端口进行注册,不在1521端口进行注册呢?
解决的方法就是使用local_listener配置参数。默认情况下,该参数为空。
SQL> show parameter listener;
NAME? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? TYPE? ? ? ? VALUE
------------------------------------ ----------- ------------------------------
listener_networks? ? ? ? ? ? ? ? ? ? string
local_listener? ? ? ? ? ? ? ? ? ? ? string
remote_listener? ? ? ? ? ? ? ? ? ? ? string
该参数用于明确指定Oracle实例向哪一个监听器上进行注册动作。通常对于非标准端口注册,都需要将注册监听信息修改参数。
SQL> show parameter local
NAME? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? TYPE? ? ? ? VALUE
------------------------------------ ----------- ------------------------------
local_listener? ? string? ? ? (ADDRESS_LIST=(Address=(Protoc? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ol=tcp)(HOST=AAALIFE)(Port=1531)))
log_archive_local_first? ? ? ? ? ? ? boolean? ? TRUE
parallel_force_local? ? ? ? ? ? ? ? boolean? ? FALSE
注意:该参数local_listener修改范围支持both方式,立即生效不需要重新启动实例。
此时,监听器状态如下:
[oracle@aaalife dbs]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 02:32:25
Copyright (c) 1991, 2013, Oracle.? All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias? ? ? ? ? ? ? ? ? ? LISTENER
Version? ? ? ? ? ? ? ? ? TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date? ? ? ? ? ? ? ? 07-SEP-2015 01:27:53
Uptime? ? ? ? ? ? ? ? ? ? 0 days 1 hr. 4 min. 32 sec
Trace Level? ? ? ? ? ? ? off
Security? ? ? ? ? ? ? ? ? ON: Local OS Authentication
SNMP? ? ? ? ? ? ? ? ? ? ? OFF
Listener Parameter File? /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File? ? ? ? /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@aaalife dbs]$ lsnrctl status my_listener
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 02:32:33
Copyright (c) 1991, 2013, Oracle.? All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1531)))
STATUS of the LISTENER
------------------------
Alias? ? ? ? ? ? ? ? ? ? LISTENER
Version? ? ? ? ? ? ? ? ? TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date? ? ? ? ? ? ? ? 07-SEP-2015 01:17:52
Uptime? ? ? ? ? ? ? ? ? ? 0 days 1 hr. 14 min. 41 sec
Trace Level? ? ? ? ? ? ? off
Security? ? ? ? ? ? ? ? ? ON: Local OS Authentication
SNMP? ? ? ? ? ? ? ? ? ? ? OFF
Listener Parameter File? /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File? ? ? ? /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1531)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1531)))
Services Summary...
Service "aaadb" has 1 instance(s).
Instance "aaadb", status READY, has 1 handler(s) for this service...
Service "aaadbXDB" has 1 instance(s).
Instance "aaadb", status READY, has 1 handler(s) for this service...
The command completed successfully
实例向1531端口进行动态注册了,原有1521默认监听器没有注册信息。
那么,还有一个问题,就是local_listener设置值。该值采用括号表达式进行书写,是Oracle Net Service内部使用的一种方式。从管理角度看,这种策略不是很好的方法。我们直接将端口编号书写在数据库参数中,不但容易泄露部署信息,而且在发生迁移、变更动作的时候,这种方式也会有一些问题。
所以,Oracle官方支持监听器别名方法进行配置local_listener。
3、设置监听器别名
一个很有意思的现象是,在local_listener的配置问题上,MOS和网络同仁们的差异是很大的。MOS官方意见是将监听器别名设置上,而网络同仁们无一例外的选择“括号表达式”。
笔者实验的