【基础原理】ORACLE RAC 如何增加监听、端口
[grid@rac1 ~]$ srvctl add listener -l LISTENER5 -o $ORACLE_HOME -p 1588 -k 1
[grid@rac1 ~]$ srvctl start listener -l LISTENER5
[grid@rac1 ~]$ vim /u01/app/11.2.0.4/grid/network/admin/listener.ora
[grid@rac1 ~]$ srvctl stop listener -l LISTENER5
[grid@rac1 ~]$ srvctl start listener -l LISTENER5
PRCC-1016 : LISTENER5 was already stopped
PRCR-1005 : Resource ora.LISTENER5.lsnr is already stopped
[grid@rac1 ~]$ srvctl start listener -l LISTENER5
[grid@rac1 ~]$ lsnrctl status LISTENER5
LSNRCTL for Linux: Version 11.2.0.4.0 – Production on 10-SEP-2020 05:56:23
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER5)))
STATUS of the LISTENER
————————
Alias LISTENER5
Version TNSLSNR for Linux: Version 11.2.0.4.0 – Production
Start Date 10-SEP-2020 05:56:12
Uptime 0 days 0 hr. 0 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0.4/grid/network/admin/listener.ora
Listener Log File /u01/app/11.2.0.4/grid/log/diag/tnslsnr/rac1/listener5/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER5)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.29.151)(PORT=1588)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.29.130)(PORT=1588)))
Services Summary…
Service “testdb” has 1 instance(s).
Instance “testdb1”, status UNKNOWN, has 1 handler(s) for this service…
The command completed successfully
[grid@rac1 ~]$ srvctl status listener
[grid@rac1 ~]$ su – oracle
Password:
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL> show parameter local_listener
NAME TYPE VALUE
———————————— ———– ——————————
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=1
92.168.29.130)(PORT=1521)), (A
DDRESS=(PROTOCOL=TCP)(HOST=192
.168.29.130)(PORT=1522)), (ADD
RESS=(PROTOCOL=TCP)(HOST=192.1
68.29.130)(PORT=1524))
SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.29.130)(PORT=1521))’,'(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.29.130)(PORT=1522))’,'(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.29.130)(PORT=1524))’,'(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.29.130)(PORT=1588))’;
local_listener有三种配置方式:
1.不配置,为空(默认注册到LISTENER,端口1521监听)。
2.配置为网络服务名(tnsnames连接别名?没错,就是它!)。
3.直接硬编码监听地址(语法与tnsnames里面ADDRESS段相同)。
SQL> EXIT
[oracle@rac1 ~]$ su – grid
Password:
[grid@rac1 ~]$ srvctl stop scan_listener
PRCC-1016 : LISTENER4_SCAN1 was already stopped
PRCR-1005 : Resource ora.LISTENER4_SCAN1.lsnr is already stopped
[grid@rac1 ~]$ srvctl remove scan_listener
Remove scan listener? (y/[n]) y
[grid@rac1 ~]$ srvctl config scan_listener
PRCS-1026 : Could not find Single Client Access Name listener resources TYPE=ora.scan_listener.type
[grid@rac1 ~]$ srvctl add scan_listener -l LSNR5 -p 1588
[grid@rac1 ~]$ srvctl config scan_listener
SCAN Listener LSNR5_SCAN1 exists. Port: TCP:1588
[grid@rac1 ~]$ srvctl start scan_listener
[grid@rac1 ~]$ su – oracle
Password:
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL> show parameter remote_listener
NAME TYPE VALUE
———————————— ———– ——————————
remote_listener string rac-scan:1524
SQL> alter system set remote_listener=’rac-scan:1588′;
System altered.
SQL> show parameter remote_listener
NAME TYPE VALUE
———————————— ———– ——————————
remote_listener string rac-scan:1588