某现场有两个实例,且客户要求两个实例使用不同的端口,但是grid管理下的监听默认只能一个端口,可以通过以下方式解决
oracle下:
srvctl add listener -l listener_cc -p 1522 -o $ORACLE_HOME
srvctl add listener -l listener_rb -p 1523 -o $ORACLE_HOME
srvctl start listener_cc
srvctl start listener_rb
起来后,$ORACLE_HOME/network/admin下的listener.ora自动生成以下信息
cat /oracle/product/19c/network/admin/listener.ora
LISTENER_RB=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_RB)))) # line added by Agent
LISTENER_CC=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_CC)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_CC=ON # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER_CC=SUBNET # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_RB=ON # line added by Agent
VALID_NODE_CHECKING_REGISTRATION_LISTENER_RB=SUBNET # line added by Agent
然后修改cc和rb实例的local_listener如:
alter system set local_listener ='(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.236.98)(PORT=1522))';
即可
如果需要配置静态监听,可以在$ORACLE_HOME/network/admin下的listener.ora添加:
SID_LIST_LISTENER_CC =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME =cc)
(ORACLE_HOME = /oracle/product/19c)
(SID_NAME = cc)
)
)
SID_LIST_LISTENER_RB =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME =rb)
(ORACLE_HOME = /oracle/product/19c)
(SID_NAME = rb)
)
)
检查监听状态:
lsnrctl status listener_cc