Con­fig­ur­ing Ora­cle Weblogic GridLink Data­source

This Ora­cle Weblogic GridLink Data Source is an advanced high-​availability solu­tion which is specif­i­cally designed for Ora­cle RAC (Real Appli­ca­tion Cluster).

In the ear­lier recipe we have learnt about the multi Weblogic Data Source option, which has the advan­tage to be a DB ven­dor agnos­tic solu­tion; that being said, a multi Data Source has some lim­i­ta­tions too.

1. First: the con­fig­u­ra­tion is com­plex. An Ora­cle RAC multi Data Source requires n+1 JDBC mod­ules, where n is the num­ber of nodes in the cluster.

2. Sec­ond: the con­fig­u­ra­tion itself is sta­tic and requires admin­is­tra­tive inter­ven­tion to add or remove Data Sources, when changes are made to the RAC clus­ter topology.

3. As far as it con­cerns HA, a multi Data Source uses con­nec­tion polling as mech­a­nism to deter­mine the via­bil­ity of indi­vid­ual JDBC con­nec­tions. Although effec­tive, per­form­ing SQL oper­a­tions on indi­vid­ual con­nec­tions comes at the expense of addi­tional run­time over­head, and poten­tially delayed detec­tion of RAC node failures.

A GridLink on the other hand offers the fol­low­ing benefits:

  • Load bal­anc­ing: A GridLink Data Source uses the advanced Ora­cle Fast Appli­ca­tion Noti­fi­ca­tion (FAN) events to dis­trib­ute con­nec­tion requests across RAC instances.
  • Fast Con­nec­tion failover: A GridLink Data Source uses Ora­cle Fast Con­nec­tion Failover (FCC) to quickly detect data­base fail­ures ensur­ing all con­nec­tions remain valid.
  • XA affin­ity: this is a per­for­mance fea­ture that ensures that all data­base oper­a­tions per­formed on a RAC clus­ter, within the con­text of a global trans­ac­tion, are directed to the same RAC instance. Affin­ity will be estab­lished based on the global trans­ac­tion id, instead of by indi­vid­ual Data Source, to ensure that con­nec­tions obtained from dif­fer­ent Data Sources that are con­fig­ured for the same RAC clus­ter are all asso­ci­ated with the same RAC instance.

Con­fig­ur­ing a Ora­cle Weblogic GridLink does not require to con­fig­ure indi­vid­ual Data Sources for each clus­ter node. In the GridLink con­fig­u­ra­tion screen, you can enter all the RAC node details at once. Tar­get­ing and test­ing can be done via the WebLogic con­sole, just like for the generic Data Source.

In order to con­fig­ure a GridLink Data Source, from the left handed tree expand the Ser­vices node and click on Data Sources. Next to the New, but­ton press the “∨” but­ton to reveal the three menu options and select GridLink Data Source as depicted by the fol­low­ing picture:

oracle weblogic book oracle weblogic books

In the next screen, enter the GridLink Data Source details:

oracle weblogic book oracle weblogic books

If you have selected an XA com­pat­i­ble dri­ver, the next screen will inform you that the Data Source will sup­port global trans­ac­tions and the 2PC pro­to­col. Oth­er­wise, this screen will ask you which option to use for han­dling transactions.

oracle weblogic book oracle weblogic books

Click Next. In the fol­low­ing screen, select the option “Enter com­plete JDBC URL” as we are going to pro­vide the com­plete JDBC URL of the RAC:

oracle weblogic book oracle weblogic books

Click Next. In the fol­low­ing screen you have to enter the com­plete JDBC URL along with the data­base user­name and pass­word and the pro­to­col used for com­mu­ni­ca­tion (default TCP):

The JDBC URL uses Ora­cle Sin­gle Client Access Name (SCAN) addresses to spec­ify the host and port for both the TNS lis­tener and the ONS lis­tener in a sin­gle row. A GridLink Data Source con­tain­ing SCAN addresses does not need to change if you add or remove Ora­cle RAC nodes.

oracle weblogic book oracle weblogic books

The for­mat of the JDBC URL is the following

jdbc:oracle:thin:@{scan-listener-host}:{scan-listener-port}/{service-name}

In our exam­ple, we are con­nect­ing to a ser­vice name “rac_​srv” hosted on “dbhost” so our JDBC URL is:

jdbc:oracle:thin:@dbhost:1521/rac_srv

One way to deter­mine the SCAN host/​port is by con­nect­ing to any of the RAC instances in the clus­ter and from SQL-​plus issue the fol­low­ing command:

SQL> show parameter remote_listener

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

Com­plete the above form by enter­ing the user­name and pass­word for the data­base con­nec­tions and click Next. In the fol­low­ing screen click the Test All Lis­ten­ers but­ton to ver­ify that the con­fig­u­ra­tion entered is valid.

oracle weblogic book oracle weblogic books

If the con­fig­u­ra­tion is valid, a green “suc­cess” mes­sage is dis­played. If a red “fail­ure” mes­sage dis­plays instead, use the Back but­ton to fix the prob­lems with the con­fig­u­ra­tion. Once the test suc­ceeds, click Next.

As next step, you have to enter the ONS client con­fig­u­ra­tion. This step allows the data source to sub­scribe to and process Ora­cle FAN events; this is essen­tial to dis­trib­ute con­nec­tion requests across RAC instances.

As you can see from the fol­low­ing pic­ture, we have entered as ONS host and port the fol­low­ing pairs:

rac​n​ode1​.exam​ple​.com:6200
rac​n​ode2​.exam​ple​.com:6200

oracle weblogic book oracle weblogic books

In order to be able to fill the ONS Client Con­fig­u­ra­tion screen, you will need to know your Ora­cle Noti­fi­ca­tion Ser­vice (ONS) hosts and ports. ONS con­fig­u­ra­tion is con­trolled by the ONS con­fig­u­ra­tion file, ons.config, located in $ORACLE_​HOME/​opmn/​conf. This file tells the ONS dae­mon how it should behave. Con­fig­u­ra­tion infor­ma­tion within ons.config is defined as sim­ple name and value pairs. Here’s an exam­ple of an ons.config file:

localport=6100

remoteport=6200

nodes=racnode1.example.com:6200,racnode2.example.com:6200

With this infor­ma­tion at your hands, in the ONS Client Con­fig­u­ra­tion screen select “FAN Enabled”. On the same screen, enter each ONS host and port and click on the Add but­ton. Use the DNS name of each host, fol­lowed by a colon, and then the ONS port number

On the next screen, click the Test All ONS Nodes button.

oracle weblogic book oracle weblogic books

You should see a green “suc­cess” mes­sage for each ONS Node. If not, click the Back but­ton, fix the con­fig­u­ra­tion, and try again. When you are suc­cess­ful, click Next and select the tar­get server or servers for the Weblogic GridLink Data Source and click Finish.