首页 > 数据库 > Oracle > Oracle 11gR2 RAC修改监听默认端口
To modify SCAN listener port
As grid user:
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 1g Enterprise Edition Release 11.2.0.4.0 - 4bit 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 1g Enterprise Edition Release 11.2.0.4.0 - 4bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options
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
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
首先获取当前你的监听程序的配置信息.
To get the current settings of your listener on RAC issue the following command:
srvctl config listener
The output should be similar to the followingName: 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
(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"
(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不同。
监听重新启动后,对应配置文件才会更改。
(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
(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
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26655292/viewspace-2121298/ ,如需转载,请注明出处,否则将追究法律责任。