Sunday, March 15, 2015

How to Rename the Oracle Listener & Change Listener port

How to Rename the Oracle Listener & Change Listener port

After installation of SAP system or in support phase, the requirement comes to change the oracle listener port number or even some time it is needed to rename the LISTENER to LISTENER_SID or something.

Lets first see how to change listener port.

To change the port you need to modify 3 files. two tnsnames.ora and one listener.ora file.
The location of tnsnames.ora will be at below two locations
  1. /sapmnt//profile/oracle/tnsnames.ora
  2. $ORACLE_HOME/network/admin/tnsnames.ora
tnsnames.ora.jpg
3. $ORACLE_HOME/network/admin/listener.ora
listener.ora1.jpg
  • Stop sap application
  • Stop listener
  • No need to stop your database.
Now you can change the port numbers in the 3 files mentioned above, The port number is marked with red line can be changed with another number which is permissible as per your scenario.

Now you can start the listener, and your database is running then you can check connectivity from your application server 
 it should work now.
telnet.jpg
You can also do the telnet from Database server or application server to the new port, it should connect.
telnet

Change of listener port done.

Now lets move to rename the listener name itself.

If you can notice listener.ora screenshot above, you can see the name is LISTENER, which is default value.
Now you want to rename it, lets say LISTENER_ECC.
If you will execute
$ ps -ef|grep lsn
  orar q 1007798  1   0   Apr 10 -  3:57 /oracle/R  Q/112_64/bin/tnslsnr LISTENER -inherit
This will show the listener process and its Name.

1. Here you need to stop your listener
$ lsnrctl stop LISTENER

2. Now you can modify the file
$ORACLE_HOME/network/admin/listener.ora
listener.ora.jpg
As per the screenshot, you need to change LISTENER to LISTENER_ECC in listener.ora file where it is marked with red line, save it and start the new listener
$  lsnrctl start LISTENER_ECC
Then check the process name when you will do
$ ps -ef|grep lsn
orar s 1069298  1   0   Mar 29 -  4:39 /oracle/R  S/112_64/bin/tnslsnr LISTENER_ECC -inherit

Now you can see the listener is started with new name.


You need to change the local listener inside oracle database, for that please proceed as below
Let your new listener LISTENER_ECC keep running
Start your SQL prompt with ora

SQL> show parameter local_listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string

Here you need to modify the parameter "local_listener"

SQL> alter system set local_listener='(address=(protocol=tcp)(host=ara- - -dbp05)(port=1521))';
System altered.

Note: hostname and port should be same as it is mentioned in listener.ora

SQL> alter system register;
System altered.




The renaming of listener is complete!

Hope this will be of help to some of us.

No comments: