Friday, October 31, 2014

listener file on 2 nodes cluster 11gR2

cluster with 2 nodes sun001 and sun002

sun001
VIP         sun001-VIP
HOST IP          HOST=x.x.x.xx 

sun001
VIP         sun002-VIP
HOST IP          HOST=x.x.x.yy

PORT = 1521

Directory for trace and logs /oramisc01/oracle

NOTE : location of listener file is <grid_home> not <db_home>


Starting with Oracle Grid Infrastructure 11g Release 2 the node listener run out of the Oracle Grid Infrastructure home and listens on the node-VIP using the specified port (default port is 1521). 


Ever since Oracle Database 11g Release 2, SCAN is an essential part of the Oracle RAC database configuration and therefore the REMOTE_LISTENER parameter is set to the SCAN per default, assuming that the database is created using standard Oracle tools (e.g. the formerly mentioned DBCA). This allows the instances to register with the SCAN Listeners as remote listeners to provide information on what services are being provided by the instance, the current load and a recommendation on how many incoming connections should be directed to the instance.

Single Client Access Name (SCAN) is a feature used in Oracle Real Application Clusters environments that provides a single name for clients to access any Oracle Database running in a cluster.

SCAN resolves to three IP addresses using a round-robin algorithm. 


You can check the SCAN configuration in DNS using “nslookup”

READ MORE http://www.oracle.com/technetwork/products/clustering/overview/scan-129069.pdf


listener.ora and endpoints_listener.ora are in <grid_home>/network/admin directory

$ cat listener.ora on both nodes


LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))            # line added by Agent
LISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN3))))                # line added by Agent
LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN2))))                # line added by Agent
LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1))))                # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON                # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN2=ON                # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON                # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent

# custom parameters
ADR_BASE_LISTENER = /oramisc01/oracle
ADR_BASE_LISTENER_SCAN1 = /oramisc01/oracle
ADR_BASE_LISTENER_SCAN2 = /oramisc01/oracle
ADR_BASE_LISTENER_SCAN3 = /oramisc01/oracle


$ cat endpoints_listener.ora on node 1 sun001 (notice sun001–vip, ping sun001-vip to verify)



LISTENER_sun001=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST=sun001-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.xx)(PORT=1521)(IP=FIRST))))                # line added by Agent


$ cat endpoints_listener.ora on node 2 lnx70177 (notice sun002–vip, ping sun002-vip to verify)

LISTENER_sun001=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
(HOST=sun002-vip)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.yy)(PORT=1521)(IP=FIRST))))              # line added by Agent


# start/stop sequence
srvctl start listener
srvctl start scan
srvctl start scan_listener

stop in the same order as above

# How to check config
srvctl config  listener
srvctl config  scan
srvctl config  scan_listener

# How to check status
srvctl status listener
srvctl status scan
srvctl status scan_listener


# sample 

set environment to grid home

sun001@grid $  srvctl config listener
Name: LISTENER
Network: 1, Owner: oracle
Home: <CRS home>
End points: TCP:1521

sun002@grid $ srvctl config listener
Name: LISTENER
Network: 1, Owner: oracle
Home: <CRS home>
End points: TCP:1521



sun002@grid $ srvctl status listener
Listener LISTENER is enabled

Listener LISTENER is running on node(s): sun001, sun002


# Database parameter settings :  local_listener / remote_listener




The LOCAL_LISTENER parameter should be set to the node-VIP.  

The  REMOTE_LISTENER parameter should be set to the SCAN:port
   

IP-SCAN1, IP-SCAN2, IP-SCAN3 are SCAN  IP addresses of SCAN NAME
IP_VIP   are VIP IP address of NODE 1 and NODE 2

Node 1 : 
in local_listener HOST=VIP IP address of node 1

Node 2: 
in local_listener HOST=VIP IP address of node2

remote_listener remans same on both

sys@DEMO> show parameter list

NAME                            VALUE
------------------------------- ------------------------------
listener_networks            
local_listener                   (ADDRESS=(PROTOCOL=TCP)(HOST=<IP-VIP)(PORT=1521))
                                
remote_listener        (ADDRESS_LIST=
                                (ADDRESS=(PROTOCOL=TCPS)(HOST=<IP-SCAN1>)(PORT=1521))
                                (ADDRESS=(PROTOCOL=TCPS)(HOST=<IP-SCAN2>)(PORT=1521))
                                (ADDRESS=(PROTOCOL=TCPS)(HOST=<IP-SCAN3>)(PORT=1521)))
                             
 # the end