How Cache Works in an Oracle RAC Environment
Oracle RAC enables multiple Oracle Database 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 file systems. Oracle RAC handles read/write consistency and load balancing while providing high availability.
Fast Application Notification (FAN) is an Oracle RAC feature that is integrated with Oracle Call Interface (OCI) in Oracle Database. 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.
To facilitate cache operations, TimesTen uses OCI integrated with FAN to receive notification of Oracle Database events. With FAN, TimesTen detects connection failures within a minute. Without FAN, it can take several minutes for TimesTen to receive notification of an Oracle Database failure. Without FAN, TimesTen detects a connection failure the next time the connection is used or when a TCP/IP timeout occurs. TimesTen can recover quickly from Oracle Database failures without user intervention.
TimesTen 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.
Note:
You can configure how long TAF retries when establishing a connection with the
AgentFailoverTimeout
parameter. For
details, see Setting Up Cache in an Oracle RAC Environment.
OCI applications can use one of the following types of Oracle Net failover functionality:
-
None
: No failover functionality is used. This can also be 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 cache operations depend on the actions of TAF and how TAF is
configured. By default, TAF and FAN callbacks are installed if you are using
cache in an Oracle RAC environment. If you do not want TAF and FAN
capabilities, set the RACCallback
connection attribute to
0.
Table 9-1 shows the behaviors of cache operations in an Oracle RAC environment with different TAF failover types.
Table 9-1 Behavior of 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. |