Changing of Listener Port is not a regular activity. But Application team can request you to change it. Today, we are going to learn how to change Local listener port in Oracle 19c RAC and Non Rac.
Table of Contents
Why to Change Local Listener Port in Oracle 19c
You might be wondering what makes application team to ask you change the port –
- Audit Point, It’s mandate to keep local listener to be on different port than on default port – 1521
- You have created a New setup and New environment runs on new setup on New port , but since application team has done port opening based on old set up. Hence they requested us to change the port.
- List of Trojan ports which are highlighted by Auditors every quarter to us. Based on that we have to keep an eye what port we are using.
Points to Remember –
- Understand the type of listener requires port change, Does it run from Grid home or Oracle Home.
- If you are using dynamic registration or RAC system, you need to change the local_listener parameter in database .
- You should know your environment, DB links ( Many application uses self pointing db links ) This point will be mandatory in case of Single instance database. In RAC connections are through SCAN in most of the cases.
This activity requires Downtime, Please do it in lean period and with proper communication with Application Team.
Lets jump to practical steps –
Step by Step on How to change Listener Port in RAC Oracle 19c
Check the Status of Local Listener
Check the status, and see what all database/services are registered on local listener, Since my database was not running on the server hence it didn’t show my database services. Here I am changing port from default to 1900
grid@oracledbworld:~$ lsnrctl status LISTENER LSNRCTL for Solaris: Version 19.0.0.0.0 - Production on 19-MAY-2022 11:35:11 Copyright (c) 1991, 2021, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Solaris: Version 19.0.0.0.0 - Production Start Date 11-MAY-2022 16:02:28 Uptime 7 days 19 hr. 32 min. 43 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/oracle/app/product/grid/19.3.0/network/admin/listener.ora Listener Log File /u01/oracle/orabase/diag/tnslsnr/oracledbworld/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.XX.XX.1)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.XX.XX.33)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_ARCH_ODW" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_DATA_ODW" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_MGMT" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_OCR_VOTE" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_REDO_ODW_1" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_REDO_ODW_2" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... The command completed successfully grid@oracledbworld:~$
Modify the listener’s port using Srvctl command.
grid@oracledbworld:~$ srvctl modify listener -l listener -p 1900
Stop and Start of Listener service
grid@oracledbworld:~$ srvctl stop listener grid@oracledbworld:~$ srvctl start listener
grid@oracledbworld:~$ ps -ef | grep tns grid 21235 1 0 11:37:18 ? 0:00 /u01/oracle/app/product/grid/19.3.0/bin/tnslsnr LISTENER -no_crs_notify -inherit grid 21244 1 0 11:37:20 ? 0:00 /u01/oracle/app/product/grid/19.3.0/bin/tnslsnr LIST_ODW -no_crs_notify -inherit grid 12948 1 0 May 11 ? 0:15 /u01/oracle/app/product/grid/19.3.0/bin/tnslsnr MGMTLSNR -no_crs_notify -inherit grid 14321 1 0 May 11 ? 0:18 /u01/oracle/app/product/grid/19.3.0/bin/tnslsnr LISTENER_SCAN2 -no_crs_notify -inherit grid 14237 1 0 May 11 ? 0:19 /u01/oracle/app/product/grid/19.3.0/bin/tnslsnr LISTENER_SCAN3 -no_crs_notify -inherit grid 13050 1 0 May 11 ? 4:13 /u01/oracle/app/product/grid/19.3.0/bin/tnslsnr ASMNET1LSNR_ASM -no_crs_notify -inherit grid 21266 20261 0 11:37:34 pts/1 0:00 grep tns
Check status of Local listener
grid@oracledbworld:~$ lsnrctl status LISTENER LSNRCTL for Solaris: Version 19.0.0.0.0 - Production on 19-MAY-2022 11:42:00 Copyright (c) 1991, 2021, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Solaris: Version 19.0.0.0.0 - Production Start Date 19-MAY-2022 11:40:28 Uptime 0 days 0 hr. 1 min. 32 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/oracle/app/product/grid/19.3.0/network/admin/listener.ora Listener Log File /u01/oracle/orabase/diag/tnslsnr/oracledbworld/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.XX.XX.1)(PORT=1900))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.XX.XX.33)(PORT=1900))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_ARCH_ODW" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_DATA_ODW" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_MGMT" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_OCR_VOTE" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_REDO_ODW_1" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "+ASM_REDO_ODW_2" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... The command completed successfully grid@oracledbworld:~$
Now you need to verify if ASM instance local listener parameter is refreshed or not. In my case if was refreshed automatically.
Changes to be done on Database end
Make changes in Local listener parameter instance wise. Check the listener status once again.
show parameter local alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.XX.XX.33)(PORT=1900)))' sid='node1'; alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.XX.XX.34)(PORT=1900)))' sid='node2';
Confirmation Before you release to Application Team
Once activity is completed, you have to ensure that you are able to connect from client connection.
sqlplus sys/<password>@tns_name_alias_db_name