Oct 9, 2013

SCAN listener in Oracle 11g RAC

-- Checking status/ start/ stop SCAN (Single Client Access Name) listener
-- Applicable to: Above Oracle version 11.2.x.x (11g) RAC (Real Application Cluster)
-- Benefits when SCAN listener is used:

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. You can think of SCAN as a cluster alias for databases in the cluster. The benefit is that the client’s connect information does not need to change if you add or remove nodes or databases in the cluster.
SCAN was first introduced with Oracle Real Application Clusters (RAC) 11g Release 2 and provides additional functionality in Oracle RAC 12c. Having a single name to access the cluster to connect to a database in this cluster allows clients to use EZConnect and the simple JDBC thin URL to access any database running in the cluster, independently of the number of databases or servers running in the cluster and regardless on which server(s) in the cluster the requested database is actually active.

According to reliable sources on the web, SCAN provides a single domain name via DNS), allowing and-users to address a RAC cluster as-if it were a single IP address. SCAN works by replacing a hostname or IP list with virtual IP addresses (VIP).

-- Find scan-IP address
Note : When no DNS configured.
$ cat /etc/hosts
127.0.0.1                   loopback localhost      # loopback (lo0) name/address
10.44.8.8           ecdb1
10.44.8.9           ecdb2
192.168.0.1         ecdb1-priv
192.168.0.2         ecdb2-priv
10.44.8.10          ecdb1-vip
10.44.8.11          ecdb2-vip
10.44.8.7           ecdbscan    # Scan-IP

-- Find node where SCAN listener is running

$ srvctl status SCAN_LISTENER
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node ecdb2

-- Find local listener status

$ srvctl status LISTENER
Listener LISTENER is enabled
Listener LISTENER is running on node(s): ecdb2,ecdb1

-- Confirm SCAN listener is running or not in the listed node and find scan listener name

$ ps -ef|grep tns
  oracle 12058750        1   0 13:34:48      -  0:02 /u01/app/grid/bin/tnslsnr LISTENER -inherit
  oracle 15400962        1   0 13:53:07      -  0:03 /u01/app/grid/bin/tnslsnr LISTENER_SCAN1 -inherit

-- Start/ stop SCAN listener

$srvctl start/stop SCAN_LISTENER

-- Using SQL, find local listener status

SQL> show parameter local_listener;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string       (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)
                (HOST=10.44.8.10)(PORT=1521))))

-- Using SQL, find remote listener status

SQL> show parameter remote_listener;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_listener                      string      ecdbscan:1521


************************************************************************************

$ srvctl config scan

SCAN name: EDDB-SCAN-IP, Network: 1/10.10.8.0/255.255.255.224/en4
SCAN VIP name: scan1, IP: /EDDB-SCAN-IP/10.10.8.13

Note : When DNS configured for three SCAN ips ( Oracle recommended)
$ srvctl config scan
SCAN name: ecdbscan.apollohospitals.com, Network: 1/10.44.8.0/255.255.255.192/en8
SCAN VIP name: scan1, IP: /ecdbscan.apollohospitals.com/10.44.8.5
SCAN VIP name: scan2, IP: /ecdbscan.apollohospitals.com/10.44.8.7
SCAN VIP name: scan3, IP: /ecdbscan.apollohospitals.com/10.44.8.4

$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node ecdb1
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node ecdb2
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node ecdb2

$ cat /etc/hosts

127.0.0.1       loopback localhost      # loopback (lo0) name/address
10.44.8.8       ecdb1
10.44.8.9       ecdb2
192.168.0.2   ecdb2-priv
10.44.8.10     ecdb1-vip
10.44.8.11     ecdb2-vip
10.44.8.12     ecreport
192.168.0.1   ecdb1-priv ecdb1 

SQL> show parameter remote_listener;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_listener                      string      ecdbscan:1521

SQL> show parameter local_listener;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
local_listener                       string       (DESCRIPTION=(ADDRESS_LIST=(A
                                                 DDRESS=(PROTOCOL=TCP)(HOST=10.
                                                 44.8.10)(PORT=1521))))
Hope these commands will help you. Don't forget to post comments.

2 comments:

Translate >>