Listener

How to Add a Cluster Listener on Default Network to Grid

Cluster listeners have a very special feature that can generate endpoint listeners dynamically on all nodes, one for each, to establish the connections either from the public or virtual IP of its node.

If you planned to add a cluster listener in the same network, you have to choose a different port to listen to. In this case, we picked port 1522.

Let’s see current configuration of all cluster listeners. There’s only one default cluster listener LISTENER.
[grid@primary01 ~]$ srvctl config listener
Name: LISTENER
Type: Database Listener
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1521
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:

Then, we added a cluster listener named LISTENER2 on port 1522 with current network.
[grid@primary01 ~]$ srvctl add listener -l listener2 -p 1522 -k 1
I added -k 1 to indicate that we want this listener to work in network 1 which is the default cluster network. Of course, you can skip the option.

Check all listeners’ configuration again.
[grid@primary01 ~]$ srvctl config listener
Name: LISTENER
Type: Database Listener
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1521
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:
Name: LISTENER2
Type: Database Listener
Network: 1, Owner: grid
Home: <CRS home>
End points: TCP:1522
Listener is enabled.
Listener is individually enabled on nodes:
Listener is individually disabled on nodes:

Startup the new listener. If it was planned to run on node 1 only, we can specify the node at startup.
[grid@primary01 ~]$ srvctl status listener -l listener2
Listener LISTENER2 is enabled
Listener LISTENER2 is not running
[grid@primary01 ~]$ srvctl start listener -l listener2 -n primary01
[grid@primary01 ~]$ srvctl status listener -l listener2
Listener LISTENER2 is enabled
Listener LISTENER2 is running on node(s): primary01

LISTENER2 is started on node 1. Next, we should take care about the initialization parameters related to listener.

Normally, you don’t have to set listener parameters, neither local_listener nor remote_listener and you should keep them null. This is because the background process LREG will register services with the default local and remote listener automatically. Once you changed the subnet of cluster network, you don’t have to worry about the settings of databases.

But with a different port 1522 which is not the default one, you should set local_listener for this node to point to the new addresses with specifying SID.
SQL> alter system set local_listener='(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=primary01)(PORT=1522))(ADDRESS=(PROTOCOL=TCP)(HOST=primary01-vip)(PORT=1522)))' sid='primdb1' scope=both;

System altered.

SQL> show parameter local_listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string      (ADDRESS_LIST=(ADDRESS=(PROTOC
                                                 OL=TCP)(HOST=primary01)(PORT=1
                                                 522))(ADDRESS=(PROTOCOL=TCP)(H
                                                 OST=primary01-vip)(PORT=1522))
                                                 )

Let’s see what services registered with this listener.
[grid@primary01 ~]$ lsnrctl status listener2

LSNRCTL for Linux: Version 12.1.0.2.0 - Production on X

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER2)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER2
Version                   TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date                X
Uptime                    0 days 0 hr. 0 min. 9 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/12.1.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/primary01/listener2/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER2)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.0.0.11)(PORT=1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.0.0.111)(PORT=1522)))
Services Summary...
Service "-MGMTDBXDB" has 1 instance(s).
  Instance "-MGMTDB", status READY, has 1 handler(s) for this service...
Service "_mgmtdb" has 1 instance(s).
  Instance "-MGMTDB", status READY, has 1 handler(s) for this service...
Service "compdb.example.com" has 1 instance(s).
  Instance "primdb1", status READY, has 1 handler(s) for this service...

Service "primary_cluster" has 1 instance(s).
  Instance "-MGMTDB", status READY, has 1 handler(s) for this service...
Service "primdbXDB.example.com" has 1 instance(s).
  Instance "primdb1", status READY, has 1 handler(s) for this service...
The command completed successfully

Good, the instance is registered with the new listener now.

Leave a Reply

Your email address will not be published. Required fields are marked *