Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
40
Добавлен:
16.04.2013
Размер:
4.96 Mб
Скачать

Changes to Oracle XA Support

Installation

No scripts need be executed to use XA. It is necessary, however, to run the xaview.sql script to run Release 7.3 applications with Oracle Database

version 8.X. Grant the SELECT privilege on SYS.DBA_PENDING_TRANSACTIONS to all users that connect to Oracle Database through the XA interface.

Library Compatibility

The XA library supplied with Oracle Database Release 7.3 can be used with Oracle Database Release 8.0 or later. You must use the Release 7.2 XA library with Oracle Database Release 7.2. You can use the 8.0 library with Oracle Database Release 7.3. There is only one case of backward compatibility: an XA application that uses Release 8.0 OCI works with Oracle Database Release 7.3, but only if you use sqlld2 and obtain an lda_def before executing SQL statements. Client applications must remember to convert the Version 7 LDA to a service handle using OCILdaToSvcCtx() after completing the OCI calls.

Oracle Database version 8.X does not support 7.1.6 XA calls (although it does support 7.3 XA calls). Thus, 7.1.6 XA calls need to relink Tuxedo applications with XA libraries of Oracle Database version 8.X.

Link Order for Libraries

When building a TP-monitor XA application, ensure that the TP-monitors libraries (that define the symbols ax_reg and ax_unreg) are placed in the link line before Oracle Database's client shared library. If your platform does not support shared libraries or if your linker is not sensitive to ordering of libraries in the link line, use Oracle Database's non-shared client library. These link restrictions are applicable only when using XA's dynamic registration (Oracle XA switch xaoswd).

Changes to Oracle XA Support

XA Changes from Release 8.0 to Release 8.1

There are no changes for Release 8.1.

XA Changes from Release 7.3 to Release 8.0

The following changes have been made:

Session Caching Is No Longer Needed

Dynamic Registration Is Supported

16-32 Oracle Database Application Developer's Guide - Fundamentals

Changes to Oracle XA Support

Loosely Coupled Transaction Branches Are Supported

SQLLIB Is Not Needed for OCI Applications

No Installation Script Is Needed to Run XA

XA Library Use with Oracle Real Application Clusters Option on All Platforms

Transaction Recovery for Oracle Real Application Clusters Has Been Improved

Both Global and Local Transactions Are Possible

The xa_open String Has Been Modified

Session Caching Is No Longer Needed

Session caching is unnecessary with the new OCI. Therefore, the old xa_open string parameter, SesCacheSz, has been eliminated. Consequently, you can also reduce the sessions init.ora parameter. Instead, set the transactions init.ora parameter to the expected number of concurrent global transactions. Because sessions are not migrated when global transactions are resumed, applications must not refer to any session state beyond the scope of a service.

For information on how to organize your application into services, refer to the documentation provided with the transaction processing monitor. In particular, savepoints and cursor fetch state are cancelled when a transaction is suspended. This means that a savepoint taken by the application in a service is invalid in another service, even though the two services may belong to the same global transaction.

Dynamic Registration Is Supported

Dynamic registration can be used if both the XA application and Oracle Database are Version 8.

See Also: "Extensions to the XA Interface" on page 16-7

Loosely Coupled Transaction Branches Are Supported

The database server for Oracle Database version 8 and later supports both loosely and tightly coupled transaction branches in a single Oracle Database instance. The server for Oracle Database version 7 supported only tightly coupled transaction branches in a single instance, and loosely coupled transaction branches in different instances.

Using Oracle XA with Transaction Monitors 16-33

Changes to Oracle XA Support

SQLLIB Is Not Needed for OCI Applications

OCI applications used to require the use of SQLLIB. This means that OCI programmers had to buy SQLLIB, even if they had no desire to develop Pro* applications. This is no longer the case.

No Installation Script Is Needed to Run XA

The SQL script XAVIEW.SQL is not needed to run XA applications in Oracle Database Version 8. It is, however, still necessary for Version 7.3 applications.

See Also: "Responsibilities of the DBA or System Administrator" on page 16-8

XA Library Use with Oracle Real Application Clusters Option on All Platforms

It was not possible with Version 7 to use the Oracle XA library together with the Oracle Real Application Clusters option on certain platforms. (Only if the platform's implementation of the distributed lock manager supported transaction-based rather than process-based locking would the two work together.) This limitation is no longer the case; if you can run the Oracle Real Application Clusters option, then you can run the Oracle XA library.

Transaction Recovery for Oracle Real Application Clusters Has Been Improved

All transactions can be recovered from any instance of Oracle Real Application Clusters. Use the xa_recover call to provide a snapshot of the pending transactions.

Both Global and Local Transactions Are Possible

It is possible to have both global and local transactions within the same XA connection. Local transactions are transactions that are completely coordinated by Oracle Database. For example, the following update belongs to a local transaction.

CONNECT scott/tiger;

UPDATE Emp_tab SET Sal = Sal + 1; /* begin local transaction*/

COMMIT;

/* commit local transaction*/

Global transactions, on the other hand, are coordinated by an external transaction manager such as a transaction processing monitor. In these transactions, Oracle Database acts as a subordinate and processes the XA commands issued by the transaction manager. The following update belongs to a global transaction.

xa_open(oracle_xa+acc=p/SCOTT/TIGER+sestm=10", 1, TMNOFLAGS);

16-34 Oracle Database Application Developer's Guide - Fundamentals

 

Changes to Oracle XA Support

 

 

 

/* Transaction manager opens */

 

/* connection to Oracle Database */

tpbegin();

/* begin global transaction, the transaction*/

 

/* manager issues XA commands to Oracle Database */

 

/* to start a global transaction */

UPDATE Emp_tab SET Sal = Sal + 1;

 

/* Update is performed in the */

 

/* global transaction*/

tpcommit();

/* commit global transaction, */

 

/* the transaction manager issues XA commands*/

/* to Oracle Database to commit */ /* the global transaction */

The database server for Oracle Database version 7 forbids a local transaction from being started in an XA connection. The following update would return an ORA-2041 error code.

xa_open("oracle_xa+acc=p/SCOTT/TIGER+sestm=10" , 1, TMNOFLAGS);

/* Transaction manager opens */ /*connection to Oracle Database */

UPDATE Emp_tab SET Sal = Sal + 1; /* Oracle Databse version 7 returns error */

Oracle Database version 8.X and later allows local transactions to be started in an XA connection. The only restriction is that the local transaction must be committed or rolled back before starting a global transaction in the connection.

The xa_open String Has Been Modified

Two new parameters have been added. They are:

Loose_Coupling

This parameter has a Boolean value and should be set to false when connected to Oracle Database version 7. If set to true, then global transaction branches are loosely coupled; in other words, locks are not shared between branches.

SesWt

This parameter value indicates the time-out limit when waiting for a transaction branch that is being used by another session. If Oracle Database cannot switch to the transaction branch within SesWt seconds, then XA_RETRY is returned.

Two parameters have been made obsolete and should only be used when connected to Oracle Database Release 7.3.

GPWD

Using Oracle XA with Transaction Monitors 16-35

Changes to Oracle XA Support

The group password is not used by Oracle Database version 8.X or later. A session that is logged in with the same user name as the session that created a transaction branch is allowed to switch to the transaction branch.

SesCacheSz

This parameter is not used by Oracle Database version 8.X or later because session caching has been eliminated.

16-36 Oracle Database Application Developer's Guide - Fundamentals

Соседние файлы в папке Oracle 10g