Problem:
I need to setup the 11GR2 RAC (Real Application Cluster) and I know that in 11GR2 Oracle has introduced new Grid infrasturctre  feature called SCAN which requires DNS server in place before you could setup the Grid Infrastructure.
So what is SCAN and how to setup the DNS server for SCAN.
Solution:
Before I dive deep into DNS server configuration , let me take a moment to explain what is SCAN and why needs DNS server.I will also explain why /etc/hosts can not be used for SCAN.
What is SCAN ?
SCAN : It stands for Single Client Access Name.Single Client Access Name (SCAN) is a new Oracle Real Application Clusters (RAC) 11g Release 2 feature that provides a single name for clients to access Oracle Databases running in a cluster. The benefit is that the client’s connect information does not need to change if you add or remove nodes in the cluster.
Example:
Ezconnet sqlplus system/manager@scan:1521/racdb
JDBC connect jdbc:oracle:thin:@scan:1521/racdb

Why it is very good feature?
In previous Oracle RAC releases you will need to setup the tnsnames.ora in such a way so that it know all the VIP (Virtual IP) address in it so client can connect to Oracle RAC database which are listening on VIP address.
For example,
racdb10g =
  (DESCRIPTION=
    (LOAD_BALANCE=ON)
    (FAILOVER=ON)
    (ADDRESS=(PROTOCOL=TCP)(HOST=node1)(PORT=1521))
    (ADDRESS=(PROTOCOL=TCP)(HOST=node2)(PORT=1521))
    (CONNECT_DATA=
      (SERVICE_NAME=racdb10g)
      (FAILOVER_MODE=
        (TYPE=SELECT)
        (METHOD=BASIC)
        (RETRIES=10)
        (DELAY=15)
      )
    )
  )

So if you add a node to existing cluster or remote a node from the existing cluster you will need to modify the tnsnames.ora file on all the client.This can be pain if you have 1000 client computers using the RAC database ,so Oracle has come up with SCAN which solves this problem.
With SCAN – Your entire cluster will be identified with single common clustered name which you need to use while connecting to cluster so it does not matter whether you add a node or remote a node from cluster.You do not need to modify client’s tnsnames.ora
For example:
racdb10g =
  (DESCRIPTION=
    (LOAD_BALANCE=ON)
    (FAILOVER=ON)
    (ADDRESS=(PROTOCOL=TCP)(HOST=scan)(PORT=1521))
    (CONNECT_DATA=
      (SERVICE_NAME=racdb10g)
      (FAILOVER_MODE=
        (TYPE=SELECT)
        (METHOD=BASIC)
        (RETRIES=10)
        (DELAY=15)
      )
    )
  )

SCAN also provides the connect time load balancing so it forwards the request to least loaded node in the cluster which completely transparent to client.
What happens behind the scene ?
When client wants a connection database unlike the previous releases the client will use SCAN as specified in tnsnames.ora.The DNS server will return three IP addresses for the SCAN and the client will try to connect to each IP address given by DNS server until the connection is not made.
So with 11GR2 the Client will initiate the connection to SCAN listener which will forward the connection request to least loaded the node within the cluster.
The flow will be,
Client Connection Request –> SCAN listener –> Node listener (Running on Virtual IP)
Why SCAN needs DNS ?
You must have DNS server setup if you want to use SCAN.The reason is, if you use /etc/hosts file for the SCAN than all the requests for the SCAN will be forwarded to first SCAN node specified in /etc/hosts because /etc/hosts file does not have capability of round robin name resolution but If you use the DNS server than SCAN can take the advantage of DNS’s round robin name resolution feature.
Enough talk about the SCAN background.Let me show you the DNS server configuration now.
For my test 11.2.0.1 RAC setup , I am using the openfiler as a shared storage.The openfiler is nothing but modified linux only so you have a capability of using it as a DNS server which can be used by the RAC clients.
FYI, SCAN configuration is not supported with /etc/hosts file.its only supported with one SCAN IP Address specified in /etc/hosts file if you have upgrading from previous release.Please note only and only IP Address in /etc/hosts.
Please follow the following steps to setup Open Filer as a DNS server as well.

  • Install Bind DNS Server package on  OpenFiler
[root@openfiler ~]# conary update bind:runtime
Including extra troves to resolve dependencies:
    bind:config=9.4_ESV_R4_P1-0.1-1 bind:lib=9.4_ESV_R4_P1-0.1-1 info-named:user=1-2-0.1
Applying update job 1 of 2:
    Install info-named(:user)=1-2-0.1
Applying update job 2 of 2:
    Install bind(:config :lib :runtime)=9.4_ESV_R4_P1-0.1-1


  • DNS Server configuration.

/etc/named.conf should look like,
options {
 directory "/etc";
 pid-file "/var/run/named/named.pid";
};

zone "example.com" {
     type master;
     file "/etc/example.com.hosts";
};

zone "0.168.192.in-addr.arpa" {
     type master;
     file "/etc/192.168.0.rev";
};

zone "10.10.10.in-addr.arpa" {
     type master;
     file "/etc/10.10.10.rev";
};


  • /etc/example.com.hosts should have following entries,
$ttl 38400
example.com.    IN      SOA     node1. admin.example.com. (
       1316874398
       10800
       3600
       604800
       38400 )
example.com.    IN      NS      openfiler.

openfiler.example.com.  IN      A       192.168.0.45

node1.example.com.      IN      A       192.168.0.110
node2.example.com.      IN      A       192.168.0.120

node1-vip.example.com.  IN      A       192.168.0.111
node2-vip.example.com.  IN      A       192.168.0.121

node1-priv.example.com. IN      A       10.10.10.110
node2-priv.example.com. IN      A       10.10.10.120

scan.example.com.       IN      A       192.168.0.140
scan.example.com.       IN      A       192.168.0.150
scan.example.com.       IN      A       192.168.0.160


  • /etc/192.168.1.rev should have following entries,
$ttl 38400
0.168.192.in-addr.arpa. IN SOA openfiler. admin.example.com. (
        1316875143
        10800
        3600
        604800
        38400
            )
0.168.192.in-addr.arpa. IN NS openfiler.

45.0.168.192.in-addr.arpa.  IN PTR openfiler.

110.0.168.192.in-addr.arpa.  IN PTR node1.
120.0.168.192.in-addr.arpa.  IN PTR node2.

111.0.168.192.in-addr.arpa.  IN PTR node1-vip.
121.0.168.192.in-addr.arpa.  IN PTR node2-vip.

140.0.168.192.in-addr.arpa.  IN PTR scan.
150.0.168.192.in-addr.arpa.  IN PTR scan.
150.0.168.192.in-addr.arpa.  IN PTR scan.


  • /etc/10.10.10.rev  should have following entries,
$ttl 38400
10.10.10.in-addr.arpa. IN SOA openfiler. admin.example.com. (
        1316875143
        10800
        3600
        604800
        38400
        )
10.10.10.in-addr.arpa. IN NS openfiler.

110.10.10.10.in-addr.arpa.      IN      PTR     node1-priv.
120.10.10.10.in-addr.arpa.      IN      PTR     node2-priv.


  • Start the DNS Server.
/etc/init.d/named start


  • Test the DNS Server.
[oracle@node1] nslookup scan
Server:         192.168.0.110
Address:        192.168.0.45#53
Non-authoritative answer:
Name:   scan.example.com
Address: 192.168.0.140
Name:   scan.example.com
Address: 192.168.0.150
Name:   scan.example.com
Address: 192.168.0.160
Check the log if the name resolution does not work.

/var/log/messages

























2 Responses
  1. jake george Says:

    Oracle Real Application Cluster [10g/11 g R2 RAC]
    www.21cssindia.com/courses_view.html?id=1‎
    Oracle-Application Online Training, Oracle-Application training, Oracle-Application course contents, Oracle-Application , call us: +919000444287 ...


  2. Thanks for sharing such a great information..Its really nice and informative.

    Oracle Training in Chennai


Post a Comment

Powered by Blogger.