Table of Contents Previous Next PDF


Using Tuxedo with Oracle Real Application Clusters (RAC)

Using Tuxedo with Oracle Real Application Clusters (RAC)
This topic includes the following sections:
Overview
The Oracle Real Application Clusters (RAC) feature supports clustering of machines that utilize replicated Oracle database services accessing the same Oracle database. Oracle RAC provides the ability to concurrently access the same Oracle database from instances physically located on multiple Oracle server machines, and offers the ability to failover unsuccessful database instances to alternate locations.
However, specific support for Oracle RAC is required by the Transaction Monitor in order to take advantage of these replication and failover features in an XA transaction environment or to obtain optimal RAC performance. This is because Oracle 10g does not allow the same database to be accessed from multiple RAC instances within the same XA transaction.
Note:
In addition, Oracle 10gR1 requires Transaction Monitor involvement when prepared transactions failover from one RAC instance to another.
Tuxedo 11g Release 1 (11.1.1.0) provides Transaction Monitor support for Oracle RAC by allowing an administrator to specify lists of groups associated with different RAC instances. This allows Tuxedo to ensure that groups associated with different instances of the same RAC database do not participate in the same transaction. The Tuxedo Oracle RAC support feature also provides a way for Tuxedo transaction manager server (TMS) processes to be notified of RAC failover events which is required when using Oracle 10gR1.
Consequently, this allows the TMS to re-obtain a list of Oracle 10gR1 prepared transactions from Oracle as required for RAC failover recovery.
Note:
When using Oracle 10gR2, administrators should use an Oracle <b>DTP Service</b> to access the Oracle RAC system. This DTP service name should be specified in the OPENINFO string for the associated Tuxedo groups. Oracle 10gR2 verifies the service name, and migrates it to an alternate instance if required.
When using Oracle 11g or later release, the service name is transparently and automatically migrated to an alternate instance, if required, without any specific configuration.
Limitations
Tuxedo 11g Release 1 (11.1.1.0) supports Oracle RAC only when using Oracle 10g or later release, and does not support Oracle RAC when using Oracle 9i.
Note:
For Oracle 10gR2, patch set 10.2.0.2 or above is required due to the bug described at: https://metalink.oracle.com/metalink/plsql/f?p=130:14:3193163745563425327::::p14_database_id.
For Oracle 11g, patch set 11.1.0.6 or above is preferred. Use of Oracle 11g is highly encouraged due to significant RAC improvements.
In some instances, using Oracle RAC with the Dynamic XA switch enabled may generate a core dump and cause a system crash. Please contact Oracle Support directly if you encounter this issue and provide the following information:
Prerequisites
Software Requirements
For specific platform software requirements, refer to the Oracle Tuxedo 11g Release 1 (11.1.1.0) Platform Data Sheets” in Installing the Oracle Tuxedo System.
Configuring Tuxedo for Oracle RAC
Tuxedo support for Oracle RAC requires two steps:
The following command and environment variables are used to exclusively configure Tuxedo for Oracle RAC support:
TUXRACGROUPS (required for Oracle 10gR1 and 10gR2, optional for Oracle 11g)
XARETRYDURATIONSECONDS (required only for Oracle 10gR1)
XARETRYINTERVAL (required only for Oracle 10gR1)
TMS_rac_refresh(1)(required only for Oracle 10gR1)
Configuring Transaction Propagation
Oracle 10gR1 does not allow the same database to be accessed from multiple RAC instances within the same XA transaction. In addition, Oracle 10gR1 requires Transaction Monitor involvement when prepared transactions failover from one RAC instance to another.
Oracle 10gR2 permits different RAC instances to operate on different transaction branches in RAC, but if transaction branches are on different instances, then they are loosely coupled and do not share locks. Also, for optimum commit performance, it is important to use only a single RAC instance within a given XA transaction.
For this reason, it is still important to associate an XA transaction with a single RAC instance in Oracle 10gR2. (For further information on using Oracle XA with RAC, refer to the "Developing Applications with Oracle XA" chapter in the Oracle Database Application Developer's Guide - Fundamentals.
The TUXRACGROUPS environment variable is used to associate Tuxedo groups with specific instances of Oracle RAC configurations so that Tuxedo does not include groups from multiple instances of the same RAC configuration within the same XA transaction.
Note:
When using Oracle 10g or 11g, a single transaction should not span multiple Oracle RAC instances. The groups that participate in a particular transaction are determined at the time the transaction is started. Each transaction is assigned to one particular instance of each RAC configuration such that the groups in each instance of a particular RAC configuration are assigned to an equal number of transactions.
TUXRACGROUPS
The TUXRACGROUPS environment variable specifies the groups that are associated with a particular RAC configuration, and will disallow sending service calls in the same transaction to two or more groups identified as different instances of the same RAC configuration.
WARNING:
If the TUXRACGROUPS environment variable is used, it must be set on all machines in a configuration, and must have the same sets of groups specified in the same order on all machines.
If this restriction is not followed, then inconsistent sets of groups can be included within a transaction. The coordinating group will notice the inconsistency at commit time, roll back the transaction, and send an error message to the userlog.
TUXRACGROUPS Syntax
The TUXRACGROUPS environment variable is used to define Oracle RAC group configurations. Its syntax is as follows:
TUXRACGROUPS="G1,G2,…,Gm;H1,H2,…,Hn[;…]:I1,I2,…,Io;J1,J2,…,Jp[;…][:…]"
Comma (,) separated list
Used to specify groups in the same instance of an Oracle RAC configuration. Multiple groups from a comma separated list can be used together in the same transaction.
Note:
Semicolon (;) separated list
Used to specify sets of groups in different instances of an oracle RAC configuration. Groups from different RAC instances from the same RAC database configuration cannot be used together in the same transaction.
Since the purpose of the TUXRACGROUPS environment variable is to specify groups associated with different instances of the same Oracle RAC configuration, all applications using the TUXRACGROUPS variable should have at least one semicolon in the environment variable value.
Colon (:) separated list
Used to separate information about one Oracle RAC configuration from information about a different Oracle RAC configuration. The colon indicates that multiple Oracle RAC database configurations are totally independent of each other.
Note:
TUXRACGROUPS Examples
This section describes four different examples for defining Oracle RAC group configurations:
Example 1: Simple Configuration
TUXRACGROUPS="G1;G2"
Figure 6‑1 shows a simple Oracle RAC configuration.
In this example, there is one Oracle database, (ORA1), two Oracle RAC instances with 1 group per each instance.
The same transaction request to both GROUP1 and GROUP2 cannot be sent because they access database services through different instances that map to the same Oracle RAC database configuration.
Figure 6‑1 (ORA1) Simple Configuration
Example 2: Oracle RAC Single Instance with Multiple Groups
TUXRACGROUPS="GROUP1;GROUP2:GROUP3;GROUP4,GROUP5"
Figure 6‑2 shows an example of adding multiple groups to a single instance.
In this example, there are two Oracle databases: ORA1 and ORA2. ORA1 offers machine-specific services ORA1SITE1 and ORA1SITE2, and ORA2 offers machine-specific services ORA2SITE1 and ORA2SITE2. The objective is to assign an approximately equal number of transactions and configure the same services to the groups associated with each instance of an Oracle RAC configuration.
The same transaction request to both GROUP1 and GROUP2 cannot be sent because they access database services through different instances that map to the same Oracle RAC database configuration. The same applies to GROUP3 and GROUP4 or GROUP3 GROUP5, the same transaction cannot be sent to both these groups.
GROUP4 and GROUP5 both access the same database service of the same Oracle RAC database configuration, so these groups would be permitted together. GROUP1 and GROUP4 would be permitted together, because they access different RAC database configurations. If there is also a GROUP6 in this configuration, it would be permitted with any other group, because GROUP6 is not an Oracle RAC group.
Note:
Figure 6‑2 (ORA2) Single Oracle RAC Instance with Multiple Groups
The *GROUPS and *SERVERS sections of the UBBCONFIG file for this configuration might look as follows in Listing 6‑1:
Listing 6‑1 UBBCONFIG File *GROUPS and *SERVERS Sections Example
*GROUPS
DEFAULT: TMSNAME=TMS_ORA TMSCOUNT=2
GROUP1 LMID=SITE1 GRPNO=1
OPENINFO="ORACLE_XA:Oracle_XA+Acc=P/scott/tiger+SqlNet=ORA1SITE1+SesTm=100+LogDir=.+MaxCur=5"
GROUP2 LMID=SITE2 GRPNO=2
OPENINFO="ORACLE_XA:Oracle_XA+Acc=P/scott/tiger+SqlNet=ORA1SITE2+SesTm=100+LogDir=.+MaxCur=5"
GROUP3 LMID=SITE1 GRPNO=3
OPENINFO="ORACLE_XA:Oracle_XA+Acc=P/scott/tiger+SqlNet=ORA2SITE1+SesTm=100+LogDir=.+MaxCur=5"
GROUP4 LMID=SITE2 GRPNO=4
OPENINFO="ORACLE_XA:Oracle_XA+Acc=P/scott/tiger+SqlNet=ORA2SITE2+SesTm=100+LogDir=.+MaxCur=5"
GROUP5 LMID=SITE2 GRPNO=5
OPENINFO="ORACLE_XA:Oracle_XA+Acc=P/scott/tiger+SqlNet=ORA2SITE2+SesTm=100+LogDir=.+MaxCur=5"
GROUP6 LMID=SITE1 GRPNO=6 TMSNAME=TMS_QM
OPENINFO="TUXEDO/QM:/home/myapplication/QUE:QSPACE"
*SERVERS
DEFAULT: RESTART=Y MAXGEN=5 REPLYQ=Y CLOPT="-A"
EMPLOYEE_SVR SRVGRP=GROUP1 SRVID=1
EMPLOYEE_SVR SRVGRP=GROUP2 SRVID=2
BANKING_SVR SRVGRP=GROUP3 SRVID=3
BANKING_SVR SRVGRP=GROUP4 SRVID=4
BANKING_SVR SRVGRP=GROUP5 SRVID=5
 
Note:
GROUP4 and GROUP5 have the same OPENINFO strings, because they both use the same database service from the same database.
The specification of the OPENINFO string for Oracle groups in the *GROUPS section is the same as when using Oracle without RAC. For information on how to specify an OPENINFO string for an Oracle group, refer to the Developing Applications with Oracle XA chapter in the Oracle Database Application Developer's Guide - Fundamentals.
Example 3: Multiple Oracle RAC Instances with Multiple Groups
TUXRACGROUPS="GROUP11,GROUP12,GROUP13;GROUP21,GROUP22:GROUP3;GROUP4, GROUP5"
Figure 6‑3 shows an example of adding multiple groups to multiple instances.
This example is similar to the previous example — except that GROUP11, GROUP12, and GROUP13 are all associated with the first RAC instance of the first RAC configuration, and GROUP21 and GROUP22 are both associated with the second RAC instance.
If the first service call in a transaction in this configuration goes to GROUP12, then it would be possible to send other service calls in this transaction to GROUP11, GROUP12, or GROUP13, but not to GROUP21 or GROUP22.
If a transactional service call is made to a service that is not advertised in any permitted groups but is available in one or more prohibited groups, the result is:
tperrno is set to TPENOENT
tperrordetail is set to the new value TPED_GROUP_FORBIDDEN
Figure 6‑3 Multiple Oracle RAC Instances with Multiple Groups
For each RAC configuration defined as part of the TUXRACGROUPS environment variable, Tuxedo determines which RAC group(s) in that configuration participate in a particular transaction when that transaction is started.
Transaction Creation Behavior Using TUXRACGROUPS
Transactions are a pinned to Oracle RAC instances for as long as they exist. This is true independently, whether the call flow for such a transaction ever reaches a Tuxedo service associated with Oracle RAC or not.
There are two ways that transactions can be created:
Transactions created in a group listed inside TUXRACGROUPS are pinned to the Oracle RAC instance configured via TUXRACGROUPS.
Transactions created in groups not listed inside TUXRACGROUPS are pinned to one of the available Oracle RAC instances in a load-balancing-like algorithm.
Data Dependent Routing Using TUXRACGROUPS
Data dependent routing has been extended to support Oracle RAC configurations. It is possible to define multiple groups for the same routing range in the UBBCONFIG *ROUTING section. Listing 6‑2 shows an example of different Tuxedo groups with the same range of values.
Listing 6‑2 Tuxedo Groups with Same Range Values
RANGES="1-5:GROUP1A, 1-5:GROUP1B, 6-10:GROUP2B, 6-10:GROUP2A, *:*"
 
In this example, GROUP1A and GROUP1B are responsible for the same data range and GROUP2A and GROUP2B are responsible for the same data range. Tuxedo routes the service request to the group associated with the Oracle RAC instance that the transaction belongs to.
Data dependent routing for transactional services offered in RAC groups achieves the desired result only if:
Since all but one of the instances in a RAC configuration are disallowed in a particular transaction, each data value must be specified for a service in each RAC instance. Otherwise, that data value will not be processed by any service in the RAC configuration for some transactions.
If all data values are processed by the same set of service instances, then there is no need to use data dependent routing.
Multiple RANGES entries for each routing value must be created for each RAC instance offering the service.
If a routing was not configured for a special RAC instance a service calls for a transaction pinned to that Oracle RAC Instance will fail with tperrno set to TPENOENT and tperror detail set to TPED_GROUP_FORBIDDEN.
When transactional routing occurs, any groups that are not permitted for the current transaction are ignored. The routing decision only considers:
If routing is performed for a non-transactional request, all groups can participate. The service is routed to the first group matching the data value listed in the UBBCONFIG file *ROUTING section RANGES field. All non-transactional requests for a special range of values are handled by one Oracle RAC instance only.
If routing is performed for a mixture of transactional and non-transactional requests, some applications may not require non-transactional request load balancing. You can vary the RAC instances listed first in your application for different data values so that non-transactional requests are balanced accordingly among services offered by different RAC instances.
There is no way to enforce load balancing between all groups associated with the same routing range for non-transactional requests. If you want to enforce one-by-one load balancing, try the following:
Calling an intermediate AUTOTRAN service (in the UBBCONFIG file *SERVICES section) to enforce that each service call is associated with a transaction.
Figure 6‑4 shows an example of routing transactional and non-transactional requests in an Oracle RAC configuration.
Figure 6‑4 Routing Transactional/Non-Transactional Requests
 
The configuration shown in the example consists of 2 Oracle RAC instances. If 1,000 transactions are created in a group not listed in TUXRACGROUPS, around 500 transactions will be pinned to Oracle RAC instance 1 and can only access GROUP1A and GROUP2A. The other 500 transactions will be pinned to Oracle RAC instance 2 and can only access GROUP1B and GROUP2B.
Listing 6‑3 shows an example of how the *SERVICES and *ROUTING sections of the UBBCONFIG file for this configuration might look:
Listing 6‑3 UBBCONFIG File *SERVICES and *ROUTING Sections Example
*SERVICES
DEPOSIT SRVGRP=GROUP1A ROUTING=MYROUTE
DEPOSIT SRVGRP=GROUP2A ROUTING=MYROUTE
DEPOSIT SRVGRP=GROUP1B ROUTING=MYROUTE
DEPOSIT SRVGRP=GROUP2B ROUTING=MYROUTE
*ROUTING
MYROUTE FIELD=”BRANCH_ID”
RANGES=”1-5:GROUP1A, 1-5:GROUP1B, 6-10:GROUP2B, 6-10:GROUP2A, *:*”
BUFTYPE=”FML32”
 
GROUP1A and GROUP2A belong to Oracle RAC instance 1. GROUP1B and GROUP2B belong to Oracle RAC instance 2. Requests with a BRANCH_ID 1 through 5 must be handled by GROUP1A or GROUP1B. Requests with a BRANCH_ID 6 through 10 must be handled by GROUP2A or GROUP2B.
For transactional requests, all transactions pinned to Oracle RAC instance 1; branches 1-5 map to GROUP1A and branches 6-10 map to GROUP2A. The other half is assigned to Oracle RAC instance 2; branches 1-5 map to GROUP1B and branches 6-10 map to GROUP2B.
For non-transactional requests, branches 1-5 map to GROUP1A, and branches 6-10 map to GROUP2B. These are the first groups specified that match the respective routing ranges. Requests with an invalid BRANCH_ID are mapped to any permitted group.
Note:
Assigning Transactions to Special Oracle RAC Instances
You may want to split your environment into multiple machines. For example, you may want a Tuxedo domain with some machines only accessing Oracle RAC instance 1 and other machines only accessing Oracle RAC instance 2 in order to enforce regional independency if Tuxedo installations and Oracle RAC installations are distributed over different buildings. The environment may be configured so that as few as possible calls should be sent outside of a building.
Figure 6‑5 shows an example with, machine 1 serving GROUP1A and GROUP2A; machine 2 serving GROUP1B and GROUP2B. In addition, calls might be made and transactions might be created from a Tuxedo /Domain Gateway, for Tuxedo /WS clients, Tuxedo Native Clients, Tuxedo /Q, or any server linked with another Resource Manager such as MQ Series.
Whenever a request is sent, the transaction should be pinned to the local machine and avoid hopping between different machines as much as possible.
Figure 6‑5 Assigning Transactions to Special Oracle RAC Instances
Listing 6‑4 shows a UBBCONFIG file example with two physical machines, TUXM1 and TUXM2, running Tuxedo. Both machines have two groups connecting to an Oracle RAC. Groups GROUP1A and GROUP2A are running on machine TUXM1 connecting to RAC instance 1. Groups GROUP1B and GROUP2B are running on machine TUXM2 connecting to RAC instance 2.
Listing 6‑4 UBBCONFIG File Example
*MACHINES
DEFAULT:
APPDIR="/path/to/appdir"
ENVFILE="/path/to/oracle.env"
TUXDIR="/path/to/tuxdir"
TUXCONFIG="/path/to/tuxconfig"
TLOGDEVICE="/path/to/TLOG"

"machine1" LMID=TUXM1

"machine2" LMID=TUXM2

*GROUPS
ADMGRPA LMID=TUXM1 GRPNO=10 OPENINFO=NONE
ADMGRPB LMID=TUXM2 GRPNO=20 OPENINFO=NONE

GROUP1A LMID=TUXM1 GRPNO=101 TMSNAME=TMS_ORA
OPENINFO="Oracle_XA:Oracle_XA+ACC=P/user/password+Sqlnet=ORA1SITE1+SesTm=100+LogDir=.+MaxCur=5"
GROUP1B LMID=TUXM2 GRPNO=102 TMSNAME=TMS_ORA
OPENINFO="Oracle_XA:Oracle_XA+ACC=P/user/password+Sqlnet=ORA1SITE2+SesTm=100+LogDir=.+MaxCur=5"

GROUP2A LMID=TUXM1 GRPNO=201 TMSNAME=TMS_ORA
OPENINFO="Oracle_XA:Oracle_XA+ACC=P/user/password+Sqlnet=ORA1SITE1+SesTm=100+LogDir=.+MaxCur=5"
GROUP2B LMID=TUXM2 GRPNO=202 TMSNAME=TMS_ORA
OPENINFO="Oracle_XA:Oracle_XA+ACC=P/user/password+Sqlnet=ORA1SITE2+SesTm=100+LogDir=.+MaxCur=5"

GROUP_TDOM_A LMID=TUXM1 GRPNO=301
GROUP_TDOM_B LMID=TUXM2 GRPNO=302

GROUP_CLIENT_A LMID=TUXM1 GRPNO=401 TMSNAME=TMS
GROUP_CLIENT_B LMID=TUXM2 GRPNO=402 TMSNAME=TMS

*SERVERS
DEFAULT: RESTART=Y MAXGEN=5 REPLYQ=Y CLOPT="-A"

TMSYSEVT SRVGRP="ADMGRPA" SRVID=10
TMUSREVT SRVGRP="ADMGRPA" SRVID=20

TMSYSEVT SRVGRP="ADMGRPB" SRVID=10 CLOPT="-A -- -S "
TMUSREVT SRVGRP="ADMGRPB" SRVID=20 CLOPT="-A -- -S "

EMPLOYEE_SVR SRVGRP=GROUP1A SRVID=1
EMPLOYEE_SVR SRVGRP=GROUP1B SRVID=2
BANKING_SVR SRVGRP=GROUP2A SRVID=3
BANKING_SVR SRVGRP=GROUP2B SRVID=4

DMADM SRVGRP="GROUP_TDOM_A" SRVID=100
GWADM SRVGRP="GROUP_TDOM_A" SRVID=110
GWTDOMAIN SRVGRP="GROUP_TDOM_A" SRVID=111 REPLYQ=Y RQADDR="GWGRP_M1"
GWADM SRVGRP="GROUP_TDOM_B" SRVID=110
GWTDOMAIN SRVGRP="GROUP_TDOM_B" SRVID=111 REPLYQ=Y RQADDR="GWGRP_M2"
 
Additionally, there is a group for administrative services, as well as one group for Tuxedo /Domain gateways and one group for native Tuxedo clients on both machines. All transactions are created by GWTDOMAIN and native clients. Even if GWTDOMAIN and the native Tuxedo clients never connect to an Oracle RAC directly, they must be included in TUXRACGROUPS as shown in Listing 6‑5 to ensure that the opened transactions belong to the correct RAC instance and are handled locally.
Note:
Native clients must set tpinfo->grpname to the local group to ensure the right behavior. For more information, see Avoiding Transactions Created by Tuxedo Native Clients Being Sent to a Remote Machine on page 6‑19.
Listing 6‑5 TUXGROUPS
TUXRACGROUPS="GROUP_TDOM_A,GROUP_CLIENT_A,GROUP1A,GROUP2A;GROUP_TDOM_B,
GROUP_CLIENT_B,GROUP1B,GROUP2B"
 
TUXRAGROUPS Transaction Use Cases
Dealing with Service Calls that are Made Outside of Transactions
As long as no transaction is involved, Tuxedo will try to handle as many requests as possible on the local machine as long as the load allows and requests will only go to remote machines if no local services are idle according to the load balancing algorithm. Summarized this means one does not have to care about requests sent to remote machines if all services are available on all machines.
What an administrator always has to ensure is that he includes all service groups into the TUXRACGROUPS environment variable that are accessed during the call flow and that are candidates for opening a new transaction even if they are not linked with the Oracle RM and/or are not physically associated with any Oracle RAC instance. The environment variable TUXRACGROUPS does not have any impact for non-transactional service calls.
Avoiding Transactions Created by a Group Handling an External Resource Manager Being Sent to a Remote Machine
If you have a Tuxedo server built with another RM such as MQSeries or another database, you can force newly started transactions to be pinned to your local machine by including this group into the TUXRACGROUPS environment variable as well.
Listing 6‑6 MQSeries Example
TUXRACGROUPS="MQSGROUPA,GROUP1A,GROUP2A;MQSGROUPB,GROUP1B,GROUP2B"
 
In this example MQSGROUPA, GROUP1A and GROUP2A are located on machine 1 and MQSGROUPB, GROUP1B and GROUP2B are located on machine 2.
If a server inside group MQSGROUPA creates a transaction, all Tuxedo service calls for services under groups GROUP1A, GROUP2A, GROUP1B and GROUP2B will only go to GROUP1A and GROUP2A. GROUP1B and GROUP2B are ignored as they belong to RAC instance 2 and the transaction was already created for RAC instance 1 via group MQSGROUPA.
Avoiding Transactions Created by GWTDOMAIN Being Sent to a Remote Machine?
Create on local Tuxedo /Domain Gateway on each machine. Set the TUXRACGROUPS environment variable as shown in Listing 6‑7.
Listing 6‑7 GWTDOMAIN Example
TUXRACGROUPS="GWTGROUPA,GROUP1A,GROUP2A;GWTGROUPB,GROUP1B,GROUP2B"
 
In this example GWTGROUPA, GROUP1A and GROUP2A are located on machine 1 and GWTGROUPB, GROUP1B and GROUP2B are located on machine 2.
If GWTDOMAIN on machine 1 creates a new transaction because it receives an external request, all Tuxedo service calls for services under groups GROUP1A, GROUP2A, GROUP1B and GROUP2B will only go to GROUP1A and GROUP2A. GROUP1B and GROUP2B are ignored as they belong to RAC instance 2 and the transaction was already created for RAC instance 1 via group GWTGROUPA.
Avoiding Transactions created by TMQFORWARD Being Sent to a Remote Machine
Create a local Tuxedo /Q configuration on each machine. Set your TUXRACGROUPS environment variable as shown in Listing 6‑8.
Listing 6‑8 TMQFORWARD Example
TUXRACGROUPS="QUEUEGROUPA,GROUP1A,GROUP2A;QUEUEGROUPB,GROUP1B,GROUP2B"
 
In this example QUEUEGROUPA, GROUP1A and GROUP2A are located on machine 1 and QUEUEGROUPB, GROUP1B and GROUP2B are located on machine 2.
If TMQFORWARD on machine 1 transactionally forwards a new message to such an Oracle service, all Tuxedo service calls for services under groups GROUP1A, GROUP2A, GROUP1B and GROUP2B will only go to GROUP1A and GROUP2A. GROUP1B and GROUP2B are ignored as they belong to RAC instance 2 and the transaction was already created for RAC instance 1 via group QUEUEGROUPA.
Avoiding Transactions Created by Tuxedo Native Clients Being Sent to a Remote Machine
You can also bind native clients to a special server group. You just have to build the client using the command buildclient -r <RM_of_the_group> -f <source_file> -o <binary_file> and initiate tpinit() with the group name that you want to use.
For example, you can create two additional groups CLIENTGROUPA and CLIENTGROUPB,and start at least two TMS in each group. Set your TUXRACGROUPS environment variable as shown in Listing 6‑9.
Listing 6‑9 Remote Machine Example
TUXRACGROUPS="CLIENTGROUPA,GROUP1A,GROUP2A;CLIENTGROUPB,GROUP1B,GROUP2B"
 
Whenever you initiate tpinit(TPINIT *tpinfo) with a TPINIT structure where tpinfo->grpname is set to CLIENTGROUPA the client is associated with CLIENTGROUPA. When tpinfo->grpname is set to CLIENTGROUPB, the client is associated with CLIENTGROUPB.
Native clients on machine 1 should always call tpinit() with tpinfo->grpname = CLIENTGROUPA; native clients on machine 2 should always call tpinit() with tpinfo->grpname = CLIENTGROUPB if CLIENTGROUPA is running on machine 1 and CLIENTGROUPB is running on machine 2. When a Tuxedo Native Client calls tpbegin(), the transaction is associated with RAC instance 1 in case of CLIENTGROUPA and with RAC instance 2 in case of CLIENTGROUPB
Avoiding Sending Transactions Created by Tuxedo /WS Clients to Remote Machines
The grpname value must be the NULL string (0-length string) for Workstation clients. You cannot set any group name and you cannot pin /WS clients to special groups. tpbegin() inside the Tuxedo /WS clients is always unspecified and the opened transaction is distributed in equal parts over all RAC instances.
The best practice to use with Tuxedo /WS Clients is to avoid transaction handling on the client side, and start the transaction with the first server that is called by the Tuxedo /WS Client. For example, you can automatically force creating a transaction when setting the AUTOTRAN parameter for the called service in the UBBCONFIG file *SERVICES section.
Configuring Transaction Recovery
TMS_rac_refresh(1), XARETRYDURATIONSECONDS, and XARETRYINTERVAL specifically handle transaction recovery issues.
TMS_rac_refresh(1)is called when an Oracle RAC group fails over to an alternate group. TMS_rac_refresh(1) should not be executed manually from the command line; the proper way to invoke TMS_rac_refresh(1) is to use Oracle Fast Application Notification (FAN).
Note:
The XARETRYDURATIONSECONDS and XARETRYINTERVAL environment variables are used to retry transaction recovery operations (xa_recover()) as required by Oracle RAC.
XARETRYDURATIONSECONDS
Specifies the time interval during which the Tuxedo Transaction Manager Server (TMS) retries xa_recover() operations when TMS_rac_refresh(1) is called. If it is not set or set to 0, then xa_recover() is performed once only.
The default value for XARETRYDURATIONSECONDS is 0.
Note:
For Oracle 10.1, it is recommended that XARETRYDURATIONSECONDS is set to 120.
XARETRYINTERVAL
Specifies the interval in seconds that xa_recover() operations are retried during the XARETRYDURATIONSECONDS interval. The XARETRYINTERVAL value is relevant only if XARETRYDURATIONSECONDS is set to a value greater than 0.
The default value for XARETRYINTERVAL is 30.
Configuring Oracle 10g Fast Application Notification (FAN)
A key process in configuring Tuxedo for Oracle RAC is setting up Oracle FAN to invoke TMS_rac_refresh(1) with the appropriate group parameter on group failover. (More group parameter and group failover information is provided in Configuring Transaction Propagation.)
More information regarding Oracle FAN can be found in the Workload Management with Oracle Real Application Clusters (PDF) White Paper.
Oracle FAN Script Example
Listing 6‑10 is an example of an Oracle FAN script.
Listing 6‑10 Oracle FAN Script Example
//This File should be placed at ORA_CRS_HOME/racg/usrco//
------------------------------calout.sh-------------------------
#! /bin/ksh

#parse the event

AWK=awk
NOTIFY_EVENTTYPE=$1 # Event type is handled differently

for ARGS in $*
do
PROPERTY=`echo $ARGS|$AWK -F"=" '{print $1}'`
VALUE=`echo $ARGS|$AWK -F"=" '{print $2}'`
case ${PROPERTY} in
VERSION|version)NOTIFY_VERSION=$VALUE;;
SERVICE|service)NOTIFY_SERVICE=$VALUE;;
DATABASE|database)NOTIFY_DATABASE=$VALUE;;
INSTANCE|instance)NOTIFY_INSTANCE=$VALUE;;
HOST|host) NOTIFY_HOST=$VALUE ;;
STATUS|status) NOTIFY_STATUS=$VALUE;;
REASON|reason) NOTIFY_REASON=$VALUE;;
CARD|card) NOTIFY_CARDINALITY=$VALUE ;;
TIMESTAMP|timestamp) NOTIFY_LOGDATE=$VALUE;; # catch
event
??:??:??) NOTIFY_LOGTIME=$PROPERTY;; # catch event time
(hh24:mi:ss)
esac
done

#Set the REFRESH_DIR environment variable.
. /home/oracle/callout.env

#Make a log to record events.
FAN_LOGFILE=/home/oracle/app/products/10.1.0.3.0/db_1/calloutlog/`hostname`_upti
me.log
touch ${FAN_LOGFILE}
echo ${1} >>${FAN_LOGFILE}

#invoke the TMS_rac_refresh command.
if [ ${NOTIFY_EVENTTYPE} = "INSTANCE" -a ${NOTIFY_STATUS} = "down" ]
then
${REFRESH_DIR}/rac_refresh >> ${FAN_LOGFILE} 2>&1
fi
-----------------------------callout.sh end-----------------------------
-----------------------------callout.env----------------------------------
#! /bin/ksh
#TUXEDO and Oracle RAC server are not one the same machine.
export REFRESH_DIR=/tmp
-----------------------------callout.env end------------------------------
-----------------------------rac_refresh----------------------------------
#! /bin/ksh
#If TUXEDO and Oracle RAC server on different machine

. /home/oracle/callout.env

rsh -l ${LOGNAME} ${TUX_MASTER_MACHINE} ${REFRESH_DIR}/rac_refresh
>/tmp/run1.log 2>&1

rsh -l ${LOGNAME} ${TUX_NONMASTER_MACHINE}
${REFRESH_DIR}/rac_refresh >/tmp/run1.log 2>&1

#If TUXEDO and Oracle RAC server are on same machine
#set up environment variable
#export APPDIR=/tmp
#export ORACLE_HOME=/home/oracle/Ora10g
#export TUXDIR=/nfs/users/libo/r902/BJ/bld
#export PATH=.:${PATH}:${TUXDIR}/bin
#. $TUXDIR/tux.env
#export TUXCONFIG=${APPDIR} /tuxconfig

#invoke TMS_rac_refresh
#TMS_rac_refresh RACDBGRP1
#TMS_rac_refresh RACDBGRP3
-----------------------------rac_refresh end-----------------------------
 
Configuring Transaction Recovery for Oracle 10gR2
For Oracle 10gR2, it is much simpler to configure transaction recovery. The database services specified in the OPENINFO string for each group associated with Oracle RAC should be declared in Oracle as DTP services.
For example, in Listing 6‑1, GROUP1 accessed Oracle via service ORA1SITE1 and GROUP2 accessed Oracle via service ORA1SITE2. In Oracle 10gR2, service ORA1SITE1 should be declared with DTP=TRUE, with preferred instance SITE1, and with available instance SITE2. Service ORA1SITE2 should be declared with DTP=TRUE, with preferred instance SITE2, and with available instance SITE1. A similar process should be followed for groups GROUP3, GROUP4, and GROUP5.
By declaring different preferred instances, the application will be able to get the benefit of load balancing during normal operation when both instances are available.
The setting of the TUXRACGROUPS environment variable will ensure that different instances of the RAC configuration are not combined in the same transaction in order to obtain optimal performance. If one of the RAC instances goes down, Oracle will transfer the DTP service to the non-preferred instance while maintaining transactional integrity.
When using Oracle 10gR2 DTP services, it is not necessary and is not recommended to configure Oracle FAN, use TMS_rac_refresh(1) or set the XARETRYDURATIONSECONDS or XARETRYINTERVAL environment variables.
Configuring Transaction Recovery for Oracle 11g
For Oracle 11g, no specific configuration is needed; transaction recovery is transparent.
Specifying Environment Variables in the UBBCONFIG File
Although the Tuxedo Oracle RAC environment variables can be initiated at the operating system command line, it is highly recommended that you use the ENVFILE parameter specified in the *MACHINES section of the UBBCONFIG file to initiate these environment variables.
Apply the following syntax considerations when setting the environment variables for Oracle RAC.
When Tuxedo environment variables are set using ENVFILE, which is the preferred method, quotation marks are not permitted around the environment variable value.
If environment variables are set at the command line, quotation marks are required if environment variable values contain characters that could be interpreted as special by the command line interpreter. An example of a special character is a semicolon.
See Also
“Writing Global Transactions” in Programming an Oracle Tuxedo ATMI Application Using C

Copyright © 1994, 2017, Oracle and/or its affiliates. All rights reserved.