Managing WebLogic Platform Database Resources
The Oracle Real Application Clusters (RAC) feature is a software option you can add to an Oracle 9i or 10g database to enable multiple database instances to access the same database (storage) simultaneously via cluster technology. The benefits of using Oracle RAC are:
BEA supports Oracle9i and 10g Real Application Clusters (RAC) for use with WebLogic Platform 8.1 SP5. A WebLogic Platform domain configured with Oracle9i or 10g RAC supports the use of WebLogic JDBC MultiPools and global (XA) transactions with connection pool failover and load balancing.
To use WebLogic Platform with Oracle RAC (9i or 10g), you must meet specific configuration requirements for both systems. The configuration requirements for WebLogic Platform are provided in this section. The configuration requirements for Oracle RAC include clustering software and a shared storage solution. To find out how to set up hardware and software required for an environment that supports Oracle RAC, see "Using WebLogic Server with Oracle RAC" in Programming WebLogic JDBC:
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/jdbc/oracle_rac.html
The following configuration options are provided:
WebLogic Platform 8.1 SP5 supports the use of JDBC MultiPools with an Oracle RAC database. A MultiPool is a group of connection pools, but to an application, the characteristics of a MultiPool appear identical to those of a single basic connection pool. Each connection pool in a MultiPool is assigned to a different instance of the same database. If an application cannot obtain a connection from a particular connection pool because database connectivity from the pool is down, WebLogic Platform attempts to obtain a connection from the next connection pool in the MultiPool. Optionally, a MultiPool can be configured to provide load balancing, too.
Depending on whether a MultiPool is configured for load balancing or failover, it may have the attributes defined in the following table.
To connect WebLogic Platform to multiple Oracle RAC nodes using MultiPools, you must:
A detailed version of this procedure is available in Setting Up MultiPools with Global Transactions.
Note: WebLogic Platform does not support the use of MultiPools with JMS JDBC Stores. If your application makes use of JMS JDBC Stores, you must configure your JMS JDBC Store to use Oracle RAC with connect-time failover. See Using Connect-Time Failover.
If MultiPools cannot be used in your application (for example, when you use a JMS JDBC Store, which does not support the use of MultiPools) and if load balancing is not required, you can configure your connection pools to use connect-time (driver-level) failover. If, under such circumstances, a RAC instance becomes unavailable, you can use the connect-time failover feature of the Oracle Thin driver to handle connection failover. In such a configuration, whenever WebLogic Platform tests a connection and the connection fails, the driver replaces the failed connection with a new one. Then the driver determines which RAC instance to use, based on instance availability.
To connect WebLogic Platform to multiple Oracle RAC nodes using connection pools configured for connect-time failover, configure a JDBC connection pool for each RAC instance in your RAC cluster with the Oracle Thin driver. A detailed version of this procedure is available in Using Connect-Time Failover.
WebLogic Platform supports global (XA) transactions and the two-phase commit protocol for enterprise applications. A global transaction updates multiple resources, such as databases, in a coordinated manner.
The two-phase commit protocol is a method of coordinating a single transaction across two or more resources. It guarantees data integrity by ensuring that transactional updates are either committed in all of the participating resources, or fully rolled back out of all resources. When updates are rolled back, the state of the relevant resources reverts to the state in which those resources were running before the transaction. In other words, either all the participating resources are updated, or none of them are updated.
In contrast, a local (non-XA) transaction is one that is committed to a single resource.
Note: WebLogic Platform 8.1 SP5 is certified to support Multipools with XA only on Oracle RAC.
This section provides information about the following topics:
WebLogic Platform gives you a choice of several methods for configuring Oracle RAC to use global transactions. Table 3-2 summarizes the methods for which instructions are provided later in this chapter.
|
|
WLST Offline script—If you already have a platform domain set up with XA resources, you can use a WLST Offline script to RAC-enable that domain. For information about configuring an XA domain, see the XA guidelines in Creating XA Domains Using Configuration Templates in Creating WebLogic Configurations Using the Configuration Wizard. For information about updating a domain to use Oracle RAC, see Updating an Existing XA Domain to Use Oracle RAC. |
In addition, you may configure these components through other tools, such as the Administration Console, the weblogic.Admin
command-line utility, or a JMX program. Instructions for these methods are not provided here.
WebLogic Platform gives you the option of configuring Oracle RAC to use global transactions by defining and configuring the following WebLogic JDBC components:
portalPool1
, portalPool2
, cgPool1
, cgPool2
, bpmArchPool1
, bpmArchPool2
cgJMSPool-nonXA
portalMultiPool
, cgMultiPool
, bpmArchMultiPool
portalFrameworkPool
, cgDataSource
, bpmArchDataSource
p13n_trackingDataSource
, p13nDataSource
, cgDataSource-nonXA
cgJMSStore
The following procedure describes the configuration parameters you must define in order to connect WebLogic Platform to multiple Oracle RAC nodes using MultiPools with global transactions:
dbname1
, dbname2
, dbhost1
, dbhost2
, user_name
, and user_password
are appropriate for your Oracle database setup, ask your database administrator to supply them. Table 3-3 shows some sample values. Here dbname1
and dbhost1
represent the name of instance 1 of the database and the name of its host machine, respectively. dbname2
and dbhost2
represent the name of instance 2 of the database and the name of its host machine.
The following rules apply to the XA connection pools within a MultiPool:
For each connection pool within a MultiPool, the following attributes must be set:
DriverName="oracle.jdbc.xa.client.OracleXADataSource"
URL="jdbc:oracle:thin:@dbhost1:1521:dbname1"
KeepXAConnTillTxComplete="true"
XARetryDurationSeconds="300"
Specifies the maximum amount of time in which the WebLogic Platform transaction manager can retry XA recover, commit, and rollback calls.
CountOfTestFailuresTillFlush="1"
CountOfRefreshFailuresTillDisable= "1"
Specifies the number of test failures allowed before WebLogic Platform disables the connection pool to minimize the delay in handling the connection request caused by a database failure.
TestConnectionsOnReserve="true"
TestTableName="
name_of_small_table
"
The following code provides an example of how two connection pools, a MultiPool, and an associated data source are configured in a config.xml
file:
<JDBCConnectionPool
CapacityIncrement="1"
CountOfRefreshFailuresTillDisable= "1"
CountOfTestFailuresTillFlush="1"
DriverName="oracle.jdbc.xa.client.OracleXADataSource"
InitialCapacity="5"
KeepXAConnTillTxComplete="true"
MaxCapacity="100"
Name="cgPool1"
PasswordEncrypted="{3DES}lBifoTsg8fc="
Properties="user=user_name"
RefreshMinutes="1"
SupportsLocalTransaction="true"
Targets="cgServer"
TestConnectionsOnReserve="true"
TestTableName="dual"
URL="jdbc:oracle:thin:@dbhost1:1521:dbname1"
XARetryDurationSeconds="300"
XASetTransactionTimeout="true"
XATransactionTimeout="302"/>
<JDBCConnectionPool
CapacityIncrement="1"
CountOfRefreshFailuresTillDisable= "1"
CountOfTestFailuresTillFlush="1"
DriverName="oracle.jdbc.xa.client.OracleXADataSource"
InitialCapacity="5"
KeepXAConnTillTxComplete="true"
MaxCapacity="100"
Name="cgPool2"
PasswordEncrypted="{3DES}lBifoTsg8fc="
Properties="user=user_name"
RefreshMinutes="1"
SupportsLocalTransaction="true"
Targets="cgServer"
TestConnectionsOnReserve="true"
TestTableName="dual"
URL="jdbc:oracle:thin:@dbhost2:1521:dbname2"
XARetryDurationSeconds="300"
XASetTransactionTimeout="true"
XATransactionTimeout="302"/>
<JDBCMultiPool
Name="cgMultiPool"
PoolList="cgPool1,cgPool2"
#The following attribute is valid only for high availability.
FailoverRequestIfBusy="true"
HealthCheckFrequencySeconds="300"
Targets="cgServer"
AlgorithmType="High-Availability
"/>
<JDBCTxDataSource
JNDIName="cgDataSource"
Name="cgDataSource"
EnableTwoPhaseCommit="true"
PoolName="cgMultiPool"
Targets="cgServer"/>
Note: Line breaks are included only for readability.
If MultiPools cannot be used in your application (for example, when you use a JMS JDBC Store, which does not support the use of MultiPools) and if load balancing is not required, you can configure your connection pools to use connect-time failover.
Note: Connection pools cannot be configured with connect-time load balancing in Release 8.1 SP5.
To connect WebLogic Platform to multiple Oracle RAC nodes using connection pools configured for connect-time failover, set up a JDBC connection pool with the Oracle Thin driver for each RAC instance in your RAC cluster. Then configure each connection pool to use connect-time failover, as described in the sections that follow.
When connections are created in the connection pool, the Oracle Thin driver determines which Oracle RAC instance to use. When an application needs a connection, it looks up a data source on the JNDI tree and requests a connection from the data source. In response, the underlying connection pool delivers one of the available connections from the pool.
The following sections describe a configuration in which Oracle RAC's connect-time failover feature is used to handle connection failures. Keep in mind that in some situations, the connect-time failover feature is slow; the amount of time allowed for failover can be equivalent to the amount of time allowed for a TCP time-out. Depending on your environment, this time period may be as long as several minutes.
To use this configuration, create JDBC connection pools in your WebLogic domain with the following attributes:
DriverName="oracle.jdbc.OracleDriver"
URL="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost1)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost2)(PORT=1521))
(FAILOVER=on)(LOAD_BALANCE=off))(CONNECT_DATA=(SERVER=DEDICATED)
(SERVICE_NAME=dbservice)))"
CountOfTestFailuresTillFlush="1"
TestConnectionsOnReserve="true"
TestTableName="
name_of_small_table
"
<JDBCConnectionPool Name="cgJMSPool-nonXA"
Targets="cgServer"
DriverName="oracle.jdbc.OracleDriver"
URL="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost1)(PORT=1521))
(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost2)(PORT=1521))
(FAILOVER=on)(LOAD_BALANCE=off))(CONNECT_DATA=(SERVER=DEDICATED)
(SERVICE_NAME=dbservice)))"
InitialCapacity="10"
MaxCapacity="100"
CapacityIncrement="1"
Password="user_password"
Properties="user=user_name"
PreparedStatementCacheSize="15"
ConnLeakProfilingEnabled="true"
TestTableName="dual"
TestConnectionsOnReserve="true"
CountOfTestFailuresTillFlush="1" />
<JDBCDataSource Name="cgDataSource-nonXA"
Targets="cgServer"
JNDIName="cgDataSource-nonXA"
PoolName="cgJMSPool-nonXA" />
Note: Line breaks are included only for readability.
To configure a WebLogic Platform domain that includes Oracle RAC, BEA recommends using the WebLogic Server Scripting Tool (WLST) Offline. (The Configuration Wizard GUI does not completely support the configuration of domains that include Oracle RAC.) WLST Offline is a command-line scripting interface for configuring a domain. It consists of two components:
To access WLST Offline, along with usage instructions and examples, go to:
https://codesamples.projects.dev2dev.bea.com/servlets/Scarab?id=97
The configuration options available in the WLST script are shown in Table 3-6.
To configure your WebLogic Platform domain by using WLST Offline, complete the following procedure:
rac10g_sample_script.py
. This script is available at http://download.oracle.com/docs/cd/E13196_01/platform/docs81/db_mgmt/scripts/rac10g_sample_script.py
.Note: This script is also available in Appendix A, WebLogic Server Scripting Tool (WLST) Offline File
weblogic
.
You can also use the WLST Offline script described in the previous section to create a domain for a component of WebLogic Platform, such as WebLogic Portal, as long as you:
platform.jar
. For example, to create a domain for WebLogic Portal, specify the wlp.jar
template.http://download.oracle.com/docs/cd/E13196_01/platform/docs81/confgwiz/examples.html#creating_XA_domains
This procedure is designed to help you upgrade an existing basic (that is, non-Oracle RAC) XA Platform domain created with the Configuration Wizard. To upgrade an existing domain so it can accommodate Oracle RAC, BEA recommends that you run a script created with a tool called WebLogic Server Scripting Tool (WLST) Offline.
Note: The Configuration Wizard GUI cannot be used for this type of upgrade because it does not completely support the configuration of domains that include Oracle RAC.
WLST Offline is a command-line scripting interface for configuring a domain. It consists of two components:
To access WLST Offline, along with usage instructions and examples, go to:
https://codesamples.projects.dev2dev.bea.com/servlets/Scarab?id=97
The configuration options available in the WLST script are shown in Table 3-7.
To configure your WebLogic Platform domain by using WLST Offline, complete the following procedure:
update_rac10g_sample_script.py
. This script is available at http://download.oracle.com/docs/cd/E13196_01/platform/docs81/db_mgmt/scripts/update_rac10g_sample_script.py
.Note: This script is also available in WebLogic Server Scripting Tool (WLST) Offline Update File.
For information about known limitations on the use of Oracle RAC with WebLogic Platform, see "Using WebLogic Server with Oracle RAC" in Programming WebLogic JDBC:
http://download.oracle.com/docs/cd/E13222_01/wls/docs81/jdbc/oracle_rac.html