代码改变世界

Oracle 11gR2 RAC修改监听默认端口

2015-10-26 14:55  AlfredZhao  阅读(...)  评论(...编辑  收藏

一、修改SCAN listener port

二、修改Listener Ports

三、Reference

一、修改SCAN listener port

To modify SCAN listener port
As grid user:

1.1 修改SCAN listener port

1.Modify SCAN listener port:

$GRID_HOME/bin/srvctl modify scan_listener -p
Update 11gR2 database init.ora parameter: alter system set remote_listener=':' scope=both;

示例:

[grid@jyracdb1 ~]$ $GRID_HOME/bin/srvctl modify scan_listener -p 1522
[oracle@jyracdb1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Oct 26 13:42:36 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> set linesize 100
SQL> show parameter listener  

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string       (ADDRESS=(PROTOCOL=TCP)(HOST=
                                                 192.168.99.192)(PORT=1521))
remote_listener                      string      jyracdb-scan:1521
SQL>  alter system set remote_listener='jyracdb-scan:1522' scope=both;    

System altered.

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string       (ADDRESS=(PROTOCOL=TCP)(HOST=
                                                 192.168.99.192)(PORT=1521))
remote_listener                      string      jyracdb-scan:1522
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

1.2 重启SCAN listener生效新端口

2.Restart SCAN listener so the new port will be effective:

$GRID_HOME/bin/srvctl stop scan_listener
$GRID_HOME/bin/srvctl start scan_listener

示例:

[grid@jyracdb1 ~]$ $GRID_HOME/bin/srvctl stop scan_listener
[grid@jyracdb1 ~]$ $GRID_HOME/bin/srvctl start scan_listener

1.3 确认更改

3.Confirm the change:

$GRID_HOME/bin/srvctl config scan_listener

示例:

[grid@jyracdb1 ~]$ $GRID_HOME/bin/srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1522

二、修改Listener Ports

首先获取当前你的监听程序的配置信息.

To get the current settings of your listener on RAC issue the following command:

srvctl config listener
The output should be similar to the following

Name: LISTENER
Network: 1, Owner: oracle
Home:
End points: TCP:1521

示例:

[grid@jyracdb1 ~]$ srvctl config listener
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1521

2.1 修改端口

(1) Amend the ports used with a command similar to the following
srvctl modify listener -l LISTENER -p "TCP:"
This changes the entry in OCR, so that a listener restart will pick up the new values. Existing connections will remain connected.

示例:

[grid@jyracdb1 ~]$ srvctl modify listener -l LISTENER -p "TCP:1522"

2.2 手工修改LOCAL_LISTENER

(3) LOCAL_LISTENER should be changed manually
An example would be
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=)(PORT=))))' scope=both sid='[<your-chosen-instance| * ] '

示例:

[oracle@jyracdb1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Mon Oct 26 14:11:00 2015

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.99.192)(PORT=1522))))' scope=both sid='racdb1';

System altered.

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.99.194)(PORT=1522))))' scope=both sid='racdb2';

System altered.

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string      (DESCRIPTION=(ADDRESS_LIST=(AD
                                                 DRESS=(PROTOCOL=TCP)(HOST=192.
                                                 168.99.192)(PORT=1522))))
remote_listener                      string      jyracdb-scan:1522
#注:节点2的local_listener输出也就是host不同。

2.3 重新启动监听程序

监听重新启动后,对应配置文件才会更改。

(5) endpoints_listener.ora and local_listener.ora for each SID are only changed after the listener is stopped and restarted.

示例:

[grid@jyracdb1 admin]$ srvctl stop listener
[grid@jyracdb1 admin]$ srvctl start listener

2.4 检查监听配置

(6) Check the configuration afterwards with "srvctl config Listener".

示例:

[oracle@jyracdb1 ~]$ srvctl config Listener
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1522

三、Reference

  • How to Modify SCAN Setting or SCAN Listener Port after Installation (文档 ID 972500.1)
  • Changing Listener Ports On RAC/EXADATA (文档 ID 1473035.1)