Tuesday, April 17, 2012

Add SCAN LISTENER in 11g Release 2

I have built database server with single SCAN LISTENER for some testing purpose. Now I need to add other 2 SCAN LISTENER so was trying to do it with the SRVCTL Utility so here are the steps on how to add scan listener after doing entire built of database server with single SCAN LISTENER.

[grid@linux-rac01 grid]$ srvctl config scan

SCAN name: rac-scan, Network: 1/192.168.20.0/255.255.255.0/eth2
SCAN VIP name: scan1, IP: /rac-scan.ingresstest.com/192.168.50.102
[grid@linux-rac01 grid]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1525

[grid@linux-rac01 grid]$ ping rac-scan.ingresstest.com
PING rac-scan.ingresstest.com (192.168.50.103) 56(84) bytes of data.
From linux-rac01.ingresstest.com (192.168.20.50) icmp_seq=2 Destination Host Unreachable
From linux-rac01.ingresstest.com (192.168.20.50) icmp_seq=3 Destination Host Unreachable
From linux-rac01.ingresstest.com (192.168.20.50) icmp_seq=4 Destination Host Unreachable
— rac-scan.ingresstest.com ping statistics —
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5000ms, pipe 3


[grid@linux-rac01 grid]$ ping rac-scan
PING rac-scan.ingresstest.com (192.168.50.104) 56(84) bytes of data.
From linux-rac01.ingresstest.com (192.168.20.50) icmp_seq=2 Destination Host Unreachable
From linux-rac01.ingresstest.com (192.168.20.50) icmp_seq=3 Destination Host Unreachable
From linux-rac01.ingresstest.com (192.168.20.50) icmp_seq=4 Destination Host Unreachable
 — rac-scan.ingresstest.com ping statistics —
11 packets transmitted, 0 received, +6 errors, 100% packet loss, time 10000ms, pipe 3


[grid@linux-rac01 grid]$ ping rac-scan
PING rac-scan.ingresstest.com (192.168.50.102) 56(84) bytes of data.
64 bytes from rac-scan.ingresstest.com (192.168.50.102): icmp_seq=1 ttl=64 time=0.039 ms
64 bytes from rac-scan.ingresstest.com (192.168.50.102): icmp_seq=2 ttl=64 time=0.054 ms
64 bytes from rac-scan.ingresstest.com (192.168.50.102): icmp_seq=3 ttl=64 time=0.049 ms
64 bytes from rac-scan.ingresstest.com (192.168.50.102): icmp_seq=4 ttl=64 time=0.063 ms


— rac-scan.ingresstest.com ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3001ms
rtt min/avg/max/mdev = 0.039/0.051/0.063/0.010 ms


[grid@linux-rac01 grid]$ host rac-scan
rac-scan.ingresstest.com has address 192.168.50.104
rac-scan.ingresstest.com has address 192.168.50.103
rac-scan.ingresstest.com has address 192.168.50.102


[grid@linux-rac01 grid]$ nslookup rac-scan
Server: 192.168.21.3
Address: 192.168.21.3#53
Name: rac-scan.ingresstest.com
Address: 192.168.50.104
Name: rac-scan.ingresstest.com
Address: 192.168.50.102
Name: rac-scan.ingresstest.com
Address: 192.168.50.103


[grid@linux-rac01 grid]$
[root@linux-rac01 grid]# host rac-scan
rac-scan.ingresstest.com has address 192.168.50.104
rac-scan.ingresstest.com has address 192.168.50.103
rac-scan.ingresstest.com has address 192.168.50.102



 
Now if you see rac-scan is configured in DNS Server and helps in resolving 3 IP addresses given below with rac-scan.ingresstest.com.
 

192.168.50.104
192.168.50.103
192.168.50.102


Below is the snapshot of the tnsnames.ora file :



ORCL =
DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan.ingresstest.com)(PORT = 1525))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.ingresstest.com)
)
)


Above log represents that we have currently 1 scan listener and helps users request to connect database but only if the scan name is resolved to the working IP address.
 
rac-scan resolves either to 192.168.50.103 or 192.168.50.104

SQL> conn scott/tiger@orcl
Connection failed.
ERROR: ORA-12543: TNS:destination host unreachable


Connection established.rac-scan resolves to 192.168.50.102.

SQL>conn scott/tiger@orcl
connected
SQL>




So we are now going to add another 2 scan lister which will omit the above problem when it resolves with ip 103 and 104.

[grid@linux-rac01 grid]$ srvctl stop scan_listener

[grid@linux-rac01 grid]$ srvctl stop scan
[grid@linux-rac01 grid]$ srvctl config scan
SCAN name: rac-scan, Network: 1/192.168.20.0/255.255.255.0/eth2
SCAN VIP name: scan1, IP: /rac-scan.ingresstest.com/192.168.50.102
[grid@linux-rac01 grid]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1525
[grid@linux-rac01 grid]$ which srvctl
/u01/home/11.2.0/grid/bin/srvctl

[root@linux-rac01 root]# /u01/home/11.2.0/grid/bin/srvctl modify scan -n rac-scan

NOTE: If the above step doesn't and resolves all the IP address try using full name. Make sure that if you are using full qualified name then the same needs to be modified in TNSNAMES.ORA FILE as well on APPLICATION SERVER.


[root@linux-rac01 root]# /u01/home/11.2.0/grid/bin/srvctl config scan
SCAN name: rac-scan, Network: 1/192.168.20.0/255.255.255.0/eth2
SCAN VIP name: scan1, IP: /rac-scan.ingresstest.com/192.168.50.103
SCAN VIP name: scan2, IP: /rac-scan.ingresstest.com/192.168.50.104
SCAN VIP name: scan3, IP: /rac-scan.ingresstest.com/192.168.50.102


[root@linux-rac01 root]# /u01/home/11.2.0/grid/bin/srvctl modify scan_listener -u


[root@linux-rac01 root]# /u01/home/11.2.0/grid/bin/srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1525
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1525
SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1525

[root@linux-rac01 root]# /u01/home/11.2.0/grid/bin/srvctl start scan_listener

[root@linux-rac01 root]# /u01/home/11.2.0/grid/bin/srvctl config scan
SCAN name: rac-scan, Network: 1/192.168.20.0/255.255.255.0/eth2
SCAN VIP name: scan1, IP: /rac-scan.ingresstest.com/192.168.50.103
SCAN VIP name: scan2, IP: /rac-scan.ingresstest.com/192.168.50.104
SCAN VIP name: scan3, IP: /rac-scan.ingresstest.com/192.168.50.102

Once it is done you can check the status with SRVCTL command.


Check the Status of SCAN and SCAN_LISTENER:
 
[grid@linux-rac01 ~]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node linux-rac01
SCAN VIP scan2 is enabled
SCAN VIP scan2 is running on node linux-rac02
SCAN VIP scan3 is enabled
SCAN VIP scan3 is running on node linux-rac02


[grid@linux-rac01 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node linux-rac01
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node linux-rac02
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node linux-rac02


Once the SCAN LISTENER is configured you can use tsnping and see if there is any database listening to that port.
 
Please let us know your feedback and comments.

No comments:

Post a Comment