Oracle® In-Memory Database Cache User's Guide 11g Release 2 (11.2.2) Part Number E21634-05 |
|
|
PDF · Mobi · ePub |
This chapter describes how to use Oracle In-Memory Database Cache (IMDB Cache) in an Oracle Real Application Clusters (Oracle RAC) environment. It includes the following topics:
Oracle RAC enables multiple Oracle instances to access one Oracle database with shared resources, including all data files, control files, PFILEs and redo log files that reside on cluster-aware shared disks. Oracle RAC handles read/write consistency and load balancing while providing high availability.
Fast Application Notification (FAN) is an Oracle RAC feature that was integrated with Oracle Call Interface (OCI) in Oracle Database 10g Release 2. FAN publishes information about changes in the cluster to applications that subscribe to FAN events. FAN prevents unnecessary operations such as the following:
Attempts to connect when services are down
Attempts to finish processing a transaction when the server is down
Waiting for TCP/IP timeouts
See Oracle Real Application Clusters Administration and Deployment Guide for more information about Oracle RAC and FAN.
IMDB Cache uses OCI integrated with FAN to receive notification of Oracle events. With FAN, IMDB Cache detects connection failures within a minute. Without FAN, it can take several minutes for IMDB Cache to receive notification of an Oracle failure. Without FAN, IMDB Cache detects a connection failure the next time the connection is used or when a TCP/IP timeout occurs. IMDB Cache can recover quickly from Oracle failures without user intervention.
IMDB Cache also uses Transparent Application Failover (TAF), which is a feature of Oracle Net Services that enables you to specify how you want applications to reconnect after a failure. See Oracle Database Net Services Administrator's Guide for more information about TAF. TAF attempts to reconnect to the Oracle database for four minutes. If this is not successful, the cache agent restarts and attempts to reconnect with the Oracle database every minute.
OCI applications can use one of the following types of Oracle Net failover functionality:
None
: No failover functionality is used. This can also be explicitly specified to prevent failover from happening. This is the default failover functionality.
Session
: If an application's connection is lost, a new connection is automatically created for the application. This type of failover does not attempt to recover selects.
Select
: This type of failover enables applications that began fetching rows from a cursor before failover to continue fetching rows after failover.
The behavior of IMDB Cache depends on the actions of TAF and how TAF is configured. By default, TAF and FAN callbacks are installed if you are using IMDB Cache in an Oracle RAC environment. If you do not want TAF and FAN capabilities, set the RACCallback
connection attribute to 0.
Table 10-1 shows the behaviors of IMDB Cache operations in an Oracle RAC environment with different TAF failover types.
Table 10-1 Behavior of IMDB Cache operations in an Oracle RAC environment
Operation | TAF Failover Type | Behavior After a Failed Connection on the Oracle Database |
---|---|---|
Autorefresh |
None |
The cache agent automatically stops, restarts and waits until a connection can be established on the Oracle database. This behavior is the same as in a non-Oracle RAC environment. No user intervention is needed. |
Autorefresh |
|
One of the following occurs:
|
Autorefresh |
|
One of the following occurs:
|
AWT |
None |
The receiver thread of the replication agent for the AWT cache group exits. A new thread is spawned and tries to connect to the Oracle database. No user intervention is needed. |
AWT |
|
One of the following occurs:
In all cases, no user intervention is needed. |
SWT, propagate, flush, and passthrough |
None |
The application is notified of the connection loss. The cache agent disconnects from the Oracle database and the current transaction is rolled back. All modified session attributes are lost. During the next passthrough operation, the cache agent tries to reconnect to the Oracle database. This behavior is the same as in a non-Oracle RAC environment. No user intervention is needed. |
SWT, propagate, flush and passthrough SWT, propagate and flush |
|
One of the following occurs:
|
Passthrough |
|
The connection to the Oracle database is recovered. If there were DML or lock operations on the lost connection, an error is returned and the user must roll back the transaction before continuing. Otherwise, the user can continue without rolling back. |
Load and refresh |
None |
The application receives a loss of connection error. |
Load and refresh |
|
One of the following occurs:
|
Load and refresh |
|
One of the following occurs:
Note: An error is less likely to be returned than if the TAF failover type is Session. |
IMDB Cache support of Oracle RAC has the following restrictions:
IMDB Cache behavior is limited to Oracle RAC, FAN and TAF capabilities. For example, if all nodes for a service fail, the service is not restarted. IMDB Cache waits for the user to restart the service.
TAF does not recover ALTER SESSION
operations. The user is responsible for restoring changed session attributes after a failover.
IMDB Cache uses OCI integrated with FAN. This interface automatically spawns a thread to wait for an Oracle event. This is the only IMDB Cache feature that spawns a thread in a TimesTen direct link application. Adapt your application to account for this thread creation. If you do not want the extra thread, set the RACCallback
connection attribute to 0 so that TAF and FAN are not used.
Install Oracle RAC and IMDB Cache. Ensure that the cache administration user has the SELECT ANY DICTIONARY
privilege.
There are two TimesTen environment variables that control TAF timeouts:
TT_ORA_FAILOVER_TIMEOUT
: TAF timeout, in minutes, for the application. Applies to SWT cache groups, user managed cache groups that use the PROPAGATE
cache table attribute, and the use of the passthrough feature. The default is 5 minutes.
TT_AGENT_ORA_FAILOVER_TIMEOUT
: TAF timeout, in minutes, for the replication agent. Applies to AWT cache groups. The default is 5 minutes.
Make sure that the TimesTen daemon and cache agent are started. The following Oracle components should also be started:
Oracle instances
Oracle listeners
Oracle service that will be used for Oracle In-Memory Database Cache
Then perform the following tasks:
Verify that the RACCallback
connection attribute is set to 1 (default).
Use the DBMS_SERVICE.MODIFY_SERVICE
function or Oracle Enterprise Manager to enable publishing of FAN events. This changes the value in the AQ_HA_NOTIFICATIONS
column of the Oracle ALL_SERVICES
view to YES
.
See Oracle Database PL/SQL Packages and Types Reference for more information about the DBMS_SERVICE
Oracle PL/SQL package.
Enable TAF on the Oracle service used for IMDB Cache with one of the following methods:
Create a service for TimesTen in the Oracle tnsnames.ora
file with the following settings:
LOAD_BALANCE=ON
(optional)
FAILOVER_MODE=(TYPE=SELECT)
or FAILOVER_MODE=(TYPE=SESSION)
Use the DBMS_SERVICE.MODIFY_SERVICE
function to set the TAF failover type.
See Oracle Database Net Services Administrator's Guide for more information about enabling TAF.
If you have a TimesTen direct link application, link it with a thread library so that it will receive FAN notifications. FAN spawns a thread to monitor for failures.