1

For a college project, I have to set up a RAC Instance and an application, I already managed to configure my RAC lab by using virtual machines by using this video guide, now I just need to program an application to connect to my RAC instance but... I'm not sure how to do it! I suppose I have to connect to the SCAN network? But I had configured it as a private network in each machine's network adapter... I didn't configure DNS (I was stuck for 4 days and the video guide didn't actually show how to configure it), so now I'm stuck trying to connect to this database from DBeaver before I program my node app.

Here's some information regarding my lab.

I have two instances: node1 and node. enter image description here

Service status:

$ /crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online

Scan config?

$ ./srvctl config scan
SCAN name: node-scan, Network: 1
Subnet IPv4: 192.168.24.0/255.255.255.0/enp0s3, static
Subnet IPv6: 
SCAN 1 IPv4 VIP: 192.168.24.41
SCAN VIP is enabled.
SCAN 2 IPv4 VIP: 192.168.24.42
SCAN VIP is enabled.
SCAN 3 IPv4 VIP: 192.168.24.43
SCAN VIP is enabled.

Scan listener

$ ./srvctl config scan_listener
SCAN Listeners for network 1:
Registration invited nodes: 
Registration invited subnets: 
Endpoints: TCP:1521
SCAN Listener LISTENER_SCAN1 exists
SCAN Listener is enabled.
SCAN Listener LISTENER_SCAN2 exists
SCAN Listener is enabled.
SCAN Listener LISTENER_SCAN3 exists
SCAN Listener is enabled.

Since there is no DNS I had to configure /etc/host like so for both nodes.

# Default

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
# Public
192.168.24.1 node1.localdomain node1
192.168.24.2 node2.localdomain node2
# Private
192.168.10.1 node-priv.localdomain node1-priv
192.168.10.2 node2-priv.localdomain node2-priv
# Virtual
192.168.24.31 node1-vip.localdomain node1-vip
192.168.24.32 node2-vip.localdomain node2-vip
# SCAN
192.168.24.41 node-scan.localdomain node-scan
192.168.24.42 node-scan.localdomain node-scan
192.168.24.43 node-scan.localdomain node-scan
1
  • I created another VM which is able to connect to a node scan ip addres
    – Jeremy
    Commented Nov 29, 2021 at 5:18

2 Answers 2

1

If you have a DNS then the idea is to configure three IP address in round robin system on the DNS server. If Oracle client wants to connect by using the scan DNS name he will get a list of the three IPs in a random order , He will try them one by one until he succeeded. This makes the SCAN listener high available, if one scan listener process is down, two others may be still available. The cluster takes care that no all listener run on one node only. After the client reached a SCAN listener this listener will forward it to the vip-listener of one of the cluster nodes.

I you have not DNS you have a lot of possibilities:

if possible, you can define the fail_over/load_balance features that would be usually by the DNS server on the client side:

sales.example.com =(DESCRIPTION=
(ADDRESS_LIST= (LOAD_BALANCE=on)(FAILOVER=ON)
(ADDRESS=(PROTOCOL=tcp)(HOST=133.22.67.192)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=133.22.67.193)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=133.22.67.194)(PORT=1521)))
 (CONNECT_DATA=(SERVICE_NAME= salesservice.example.com)))

Here the IP addresses are the SCAN listener addresses. This example is from the Oracle Whitepaper Oracle Single Client Access Name (SCAN), June 2013, page 12p. This paper I already cited in this answer that maybe also helpful to you.

But you can also only to connect to one SCAN IP address, e.g. 133.22.67.192. Of course you cannot connect if this IP is down.

sales.example.com =(DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=133.22.67.192)(PORT=1521))
    (CONNECT_DATA=(SERVICE_NAME= salesservice.example.com)))

You also can connect directly to a node VIP, but then you have no load balancing nor a failover if the server is down, e.g.

sales.example.com =(DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=133.22.67.111)(PORT=1521))
    (CONNECT_DATA=(SERVICE_NAME= salesservice.example.com)))

You can avoid the SCAN listener and still have a load balancing and a fail over if you use

sales.example.com =(DESCRIPTION=
    (ADDRESS_LIST= (LOAD_BALANCE=on)(FAILOVER=ON)
    (ADDRESS=(PROTOCOL=tcp)(HOST=133.22.67.111)(PORT=1521))
    (ADDRESS=(PROTOCOL=tcp)(HOST=133.22.67.112)(PORT=1521)))
     (CONNECT_DATA=(SERVICE_NAME= salesservice.example.com)))

For each of these configurations there are situation where they make sense.

1
  • In my case, the scan listener is on a private network adapter on my VM, how could I access this network from my host machine (with my application)?
    – Jeremy
    Commented Nov 26, 2021 at 21:49
1

IMHO you will need DNS.

  • Oracle client first performs DNS lookup for SCAN address. It will get all 3 IPs in random order. It will pick 1st one. (PS: since some version Oracle client does not use OS provided resolver, but rather uses embedded reselver).

  • Then Oracle client connects to one of SCAN listeners running on that 1st IP.

  • Scan listener responds with redirect message, pointing onto one VIP listener. Usually it redirects you to least loaded node. AFAIK in this case the redirect message does not contain VIP but hostname of VIP.

  • Then Oracle client resolves this VIP name via DNS, and connects to VIP listener and performs authentication.

PS: Try to enter all IPs into /etc/hosts on client machine. Maybe it will work. Two node cluster has 7 IPs, rather put them all into /etc/hosts on the client (and also on both DB nodes).

1
  • All the IPs are configured in /etc/hosts there are entries for the scan, priv and vip addresses
    – Jeremy
    Commented Nov 26, 2021 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.