Pages

RAC Listeners

Server1

SID = INST1
IP = 192.168.126.1
VIP = srv_vip1
Interconnect = 10.10.10.1
Server2

SID = INST2
IP = 192.168.126.2
VIP = srv_vip2
Interconnect = 10.10.10.2
Server3

SID = INST3
IP = 192.168.126.3
VIP = srv_vip3
Interconnect = 10.10.10.3



1) listener.ora is different on all the nodes due to hostnames. Configure $ORACLE_HOME/network/admin/listener.ora on each of the nodes, referencing only the VIP address, as follows:


On server1:


SID_LIST_LISTENER_SERVER1 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = INST1)
      (ORACLE_HOME = /u01/app/oracle/db)
    )
  )

LISTENER_ SERVER1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
     (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = srv_vip1)(PORT = 1521)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = node1-priv-ip)(PORT = 1521)(IP = FIRST))
     )
    )
  )



On server2:


SID_LIST_LISTENER_SERVER2 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = INST2)
      (ORACLE_HOME = /u01/app/oracle/db)
    )
  )



LISTENER_ SERVER2 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
     (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = srv_vip2)(PORT = 1521)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = node2-priv-ip)(PORT = 1521)(IP = FIRST))
     )
    )
  )


On server3:


SID_LIST_LISTENER_SERVER3 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = INST3)
      (ORACLE_HOME = /u01/app/oracle/db)
    )
  )



LISTENER_ SERVER3 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
     (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = srv_vip3)(PORT = 1521)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = node3-priv-ip)(PORT = 1521)(IP = FIRST))
     )
    )
  )



2)  tnsnames.ora remains same on all the nodes . Create a entry on $ORACLE_HOME/network/admin/tnsnames.ora on each of the RAC nodes as follows:

MY_REMOTE_LISTENER=
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=srv_vip1)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=srv_vip2)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=srv_vip3)(PORT=1521))
)


LISTENER_INST1 =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = srv_vip1)(PORT = 1521))
  )


LISTENER_INST2 =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = srv_vip2)(PORT = 1521))
  )


LISTENER_INST3 =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = srv_vip3)(PORT = 1521))
  )




3) Connect as sysdba to one of the nodes and set the database parameter REMOTE_LISTENER, for instance, using the following command:
alter system set remote_listener = 'MY_REMOTE_LISTENER' scope=BOTH;

Parameter remote_listener , REMOTE_LISTENER=MY_REMOTE_LISTENE is resolved using MY_REMOTE_LISTENER  in tnsnames.ora. This entry should be in all tnsnames.ora

4) Still connected as sysdba, set the LOCAL_LISTENER parameter for each of the nodes as follows:


alter system set local_listener = '(ADDRESS=(PROTOCOL=TCP)(HOST=srv_vip1)(PORT=1521))' sid='INST1' scope=BOTH;
alter system set local_listener = '(ADDRESS=(PROTOCOL=TCP)(HOST=srv_vip2)(PORT=1521))' sid='INST2' scope=BOTH;
alter system set local_listener = '(ADDRESS=(PROTOCOL=TCP)(HOST=srv_vip3)(PORT=1521))' sid='INST3' scope=BOTH;

or

alter system set local_listener = 'LISTENER_INST1' sid='INST1' scope=BOTH;
alter system set local_listener = 'LISTENER_INST2' sid='INST2' scope=BOTH;
alter system set local_listener = 'LISTENER_INST3' sid='INST3' scope=BOTH;

Note : In this case , local_listener ,  sid.local_listener=listener_inst<n>  is resolved using LISTENER_INST<n> entries  in tnsnames.ora


5) Start listeners on their respective nodes:
lsnrctl start LISTENER_ SERVER1
lsnrctl start LISTENER_ SERVER2
lsnrctl start LISTENER_ SERVER3

6) Optionally,connect as sysdba on each of the instances and force registration as follows:
alter system register;

7) Verify the services registered on each listener (on the respective nodes)

lsnrctl services LISTENER_SERVER1;
lsnrctl services LISTENER_SERVER2;
lsnrctl services LISTENER_SERVER3;


Asm Listener in $ASM_HOME/network/admin/listener.ora on all nodes(SERVER1,SERVER2,SERVER3)  will have

SID_LIST_ASMLISTENER_SERVER1 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /u01/app/oracle/asm)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = +ASM)
      (SID_NAME = +ASM1)
      (ORACLE_HOME = /u01/app/oracle/asm)
    )
  )

ASMLISTENER_SERVER1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = srv_vip1)(PORT = 1521)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = node1-priv-ip)(PORT = 1521)(IP = FIRST))
    )
  )


SCAN Listener  :

SCAN provides a single name to be used in the client connection requests that does not change as the  no. of nodes changes.

Define the SCAN in your DNS as a single name that round robins to 3 IP
Addresses.  These IP addresses must be on the same subnet as the public network for the cluster.
Oracle strongly recommend to use DNS or GNS for SCAN name resolution and not the local host file.

Configure the SCAN to use DNS Round Robin resolution to three addresses.

SCAN listener will be running from GRID_HOME.
In 11gR2 onwards , local listener, will also be running from GRID_HOME.
Local listener LISTENER on all nodes will listen on local VIP.
SCAN listener will listen on SCAN vip.
REMOTE_LISTENER is set to the SCAN name:port


Scan Creation :

You have public IPs.
Nodes VIPS also exist.
Now create new Vips to be used with scan called SCAN VIPS or SCAN IP.

1. Create single DNS domain name that resolves to all of the IP addresses in your RAC.The IP addresses must be on the same subnet  as your default public network in the cluster. These are actually VIPS only called SCAN VIPS or SCAN IP.It must be resolvable without the domain suffix.
2. Create a SCAN listener for each of the above  Scan VIP. SCAN VIP and SCAN Listener works as a pair.When SCAN VIP fails , the corresponding SCAN listener will also be failed over to the same node.
3. Set the remote_listener and local_listener parameters

LOCAL_LISTENER   :   Use node VIP and port
REMOTE_LISTENER  :   scan.domain.com:1521 Allow Instance to register with SACN listeners as as remote listeners
                     IF the database was upgraded using the DBUA from a pre-11g Rel. 2 database, the DBUA will configure the REMOTE_LISTENER parameter
                     to point to the node-VIPs as well as the SCAN.
                     In earlier release it was set to server side TNSNAMES alias that resolves the host to the SCAN in the address list entry



Advantages : 

  • In 12c , accept only registration of Instances which are part of cluster that a SCAN listener is assigned to.
  • SCAN replace  a hostname or list of VIP in client tns.
  • If a node fails, Oracle detects the loss of connection to the VIP and redirects new connects to the surviving VIP's. This provide failover within cluster instances.
  • It is alternative to TAF only for automatic load balancing.  





Client :

To ensure connection failover with pre-11g Release 2 clients, change TNSNAMES.ora of PRE-11gR2 client so that it would use 3 address
lines, where each address line resolves to one of the SCAN VIPs. Earlier it used to be node VIPs  with earlier database release(10g/11R1)



Multiple-Subnet Support :

11.2.0.2     : let you use set up multiple ports on one SCAN
11.2.0.3     : not let you set up multiple ports on one SCAN
11.2.0.3.6   : let you use set up multiple ports on one SCAN
12c          : let you use set up multiple ports on one SCAN


Commands :

Check which VIPs are configured to use in SCAN :  srvctl config scan

Check VIPs used in SCAN are running :  srvctl status scan

Check which listeners are configured  to use in SCAN :  srvctl config scan_listener

Check if all SCAN listeners are running :  srvctl status scan_listener


To Stop SCAN listeners :  srvctl stop scan_listener
To Stop SCAN Vips :  srvctl stop scan