Due to security reasons some of environment require using a different port than default for the listener. Initially installing Grid Infrastructure, the administrator is not given the choice of which port wants to use. This means that changing the listener port must happen after the installation has completed successfully.This scenario happens in implementing phase before project live.
Below are steps to modify the scan listener port from default.
Default Port : 1521
New Port : 1621
Step 1: Checking scan listener configurations (run as grid user).
[oracle@node1 ]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): node2, node1
[oracle@node1 ]$ srvctl config listener
Name: LISTENER
Network: 1, Owner: oracle
Home: <CRS home>
End points: TCP:1521
[oracle@node1 ]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node node2
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node node1
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node node1
[oracle@node1 ]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521
Check below command in Database on all nodes:-
SQL> show parameter listeners.
Step 2: Modifying port number using srvctl as grid user.
Change port number of the traditional listener:
#srvctl modify listener -l LISTENER -p 1621
Change port number of the SCAN listener:
#srvctl modify scan_listener -p TCP:1621
Note : Changes are not effective until the listeners are restarted.
Step 3: Reload Both Listeners:
# Traditional listener
srvctl stop listener
srvctl start listener
# Scan listener
srvctl stop scan_listener
srvctl start scan_listener
Verify the listeners have picked up the new port.
[oracle@node1 admin]$ srvctl config listener
Name: LISTENER
Network: 1, Owner: oracle
Home: <CRS home>
End points: TCP:1621
[oracle@node1 admin]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1621
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1621
SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1621
Steps 4: Modify remote_listener parameter:
sql> alter system set remote_listener ='scan:1621' scope=both;
Step 5: Modify TNSNAMES.ORA files used for connectivity to reflect the new port.
Modify tnsnames.ora file in Oracle database home
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan)(PORT = 1621))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)
Restart database:
#srvctl stop database -d ORCL
#srvctl start database -d ORCL
Verify connection to the database using sqlplus
[oracle@node1 ~]$ sqlplus system/########@ORCL