[UNIX, Linux, Windows, IBM i]

Configuring Oracle

Oracle support and configuration information.

Complete the following steps:
  1. Check environment variable settings.
  2. Create the Oracle switch load file.
  3. Add resource manager configuration information.
  4. Change the Oracle configuration parameters, if necessary.
For a current list of levels of Oracle supported by IBM® MQ, see System Requirements for IBM MQ.

Checking the Oracle environment variable settings

Ensure that your Oracle environment variables are set for queue manager processes as well as in your application processes. In particular, always set the following environment variables before starting the queue manager:
ORACLE_HOME
The Oracle home directory. For example, on UNIX and Linux® systems, use:

export ORACLE_HOME=/opt/oracle/product/8.1.6
On Windows systems, use:

set ORACLE_HOME=c:\oracle\ora81
ORACLE_SID
The Oracle SID being used. If you are using Net8 for client/server connectivity, you might not have to set this environment variable. Consult your Oracle documentation.
The subsequent example is an example of setting this environment variable, on UNIX and Linux systems:

export ORACLE_SID=sid1
The equivalent on Windows systems is:

set ORACLE_SID=sid1
Note: The PATH environment variable must be set to include the binaries directory (for example ORACLE_INSTALL_DIR/VERSION/32BIT_NAME/bin or ORACLE_INSTALL_DIR/VERSION/64BIT_NAME/bin), otherwise you might see a message stating that oraclient libraries are missing from the machine.

If you run queue managers on Windows 64 bit systems, then only 64 bit Oracle clients must be installed. The switch load file, loaded by 64 bit queue managers, must access the Oracle 64 bit client libraries.

Creating the Oracle switch load file

To create the Oracle switch load file, use the sample file xaswit.mak, which IBM MQ provides to build the switch load files for various database products. On Windows systems, you can find xaswit.mak in the directory C:\Program Files\IBM\MQ\tools\c\samples\xatm. To create the Oracle switch load file with Microsoft Visual C++, use: nmake /f xaswit.mak oraswit.dll
Note: These switch load files can be used only with C applications. For Java applications, see JTA/JDBC coordination using IBM MQ classes for Java.

The generated switch file is placed in MQ_INSTALLATION_PATH\exits. MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.

You can find xaswit.mak in the directory MQ_INSTALLATION_PATH/samp/xatm. MQ_INSTALLATION_PATH represents the high-level directory in which IBM MQ is installed.

Edit xaswit.mak to uncomment the lines appropriate to the version of Oracle you are using. Then execute the makefile using the command:

make -f xaswit.mak oraswit
The contents of MQ_INSTALLATION_PATH/samp/xatm are read-only when IBM MQ is installed, so to edit xaswit.mak, copy all the files out of samp/xatm to another directory, modify xaswit.mak, and then run make -f xaswit.makoraswit from that directory.

The generated 32 bit switch load file is placed in /var/mqm/exits.

The generated 64 bit switch load file is placed in /var/mqm/exits64.

Adding resource manager configuration information for Oracle

You must modify the configuration information for the queue manager to declare Oracle as a participant in global units of work. Modifying the configuration information for the queue manager in this way is described in more detail in Adding configuration information to the queue manager.
  • On Windows and Linux (x86 and x86-64 platforms) systems, use the IBM MQ Explorer. Specify the details of the switch load file in the queue manager properties panel, under XA resource manager.
  • On all other systems specify the details of the switch load file in the XAResourceManager stanza in the qm.ini file of the queue manager.
Figure 1 is a UNIX and Linux systems sample showing an XAResourceManager entry. You must add a LogDir to the XA open string so that all error and tracing information is logged to the same place.
Figure 1. Sample XAResourceManager entry for Oracle on UNIX and Linux platforms

XAResourceManager:
  Name=myoracle
  SwitchFile=oraswit
  XAOpenString=Oracle_XA+Acc=P/myuser/mypasswd+SesTm=35+LogDir=/tmp+threads=true
  ThreadOfControl=THREAD
Note:
  1. In Figure 1, the xa_open string has been used with four parameters. Additional parameters can be included as described in Oracle's documentation.
  2. When using the IBM MQ parameter ThreadOfControl=THREAD you must use the Oracle parameter +threads=true in the XAResourceManager stanza.

See the Oracle8 Server Application Developer's Guide for more information about the xa_open string.

Changing Oracle configuration parameters

For each Oracle database that the queue manager is coordinating, you must review your maximum sessions and set database privileges. To do so, complete these steps:
Review your maximum sessions
You might have to review your LICENSE_MAX_SESSIONS and PROCESSES settings to take into account the additional connections required by processes belonging to the queue manager. See Installing and configuring the database product for more details.
Set database privileges
The Oracle user name specified in the xa_open string must have privileges to access the DBA_PENDING_TRANSACTIONS view, as described in the Oracle documentation.
The necessary privilege can be given using the following example command:

grant select on DBA_PENDING_TRANSACTIONS to myuser;