Transmitting Changes Between the TimesTen and Oracle Databases
Transmitting committed changes between the TimesTen cache tables and the cached Oracle Database tables keeps these tables in the two databases synchronized.
You can transmit changes between TimesTen and Oracle databases manually or automatically.
-
Manually load cache groups: You can manually load cache instances that are not in the TimesTen cache tables from the Oracle database tables using
LOAD CACHE GROUP
statement. This statement only loads committed inserts on the cached Oracle database tables into the TimesTen cache tables. New cache instances are loaded into the cache tables, but cache instances that already exist in the cache tables are not updated or deleted even if the corresponding rows in the cached Oracle database tables have been updated or deleted. A load operation is primarily used to initially populate a cache group. -
Manually refresh cache groups: You can manually refresh cache instances into the TimesTen cache tables from the Oracle database tables using the
REFRESH CACHE GROUP
statement. This statement replaces cache instances in the TimesTen cache tables with the most current data from the cached Oracle database tables including cache instances that are already exist in the cache tables. A refresh operation is primarily used to update the contents of a cache group with committed changes on the cached Oracle database tables after the cache group has been initially populated. -
Manually propagate committed changes: Use a
FLUSH CACHE GROUP
statement to manually propagate committed changes on the TimesTen cache tables to the cached Oracle database tables. -
Dynamically load cache groups: A dynamic cache group is one that is created with the
DYNAMIC
keyword. Data is dynamically loaded on demand into the TimesTen cache tables from the cached Oracle database tables for dynamic cache groups when a qualifyingSELECT
,INSERT
,UPDATE
, orDELETE
statement is issued on one of the cache tables. A cache instance is automatically loaded from the cached Oracle database tables when a qualified statement does not find the data in the cache table, but the data exists in the cached Oracle database table. Typically, data automatically ages out from dynamically loaded cache tables when it is no longer being used. This action is similar to aLOAD CACHE GROUP
statement, but dynamically issued. Dynamic cache groups are only supported in TimesTen Classic.Note:
A static cache group is one that is created without theDYNAMIC
keyword. -
Automatically refresh cache groups: Autorefresh operations automatically replace cache instances in the TimesTen cache tables with the most current data from the cached Oracle database tables including cache instances that already exist in the cache tables. Autorefresh operations update the contents of a cache group with committed changes on the cached Oracle database tables after the cache group has been initially populated. This action is similar to a
REFRESH CACHE GROUP
statement, but automatically performed. Cache instances are automatically refreshed when the cache group is created with theAUTOREFRESH
cache table attribute. TheAUTOREFRESH
cache group attribute can be used in a read-only or a user managed cache group to automatically refresh committed changes on cached Oracle Database tables into the TimesTen cache tables. TheAUTOREFRESH
cache group attribute can be defined on static or dynamic cache groups. -
Automatic propagation of changes to the Oracle database: When you specify the
PROPAGATE
cache table attribute when creating AWT, SWT, or user managed cache groups, then committed changes on cache tables in the TimesTen database are automatically propagated to the cached Oracle Database tables. This action is similar to aFLUSH CACHE GROUP
statement, but automatically performed.
Load, refresh, dynamic load and autorefresh are operations that transmit committed changes on cached tables in the Oracle database to the cache tables in the TimesTen database. Load and refresh are manual operations; dynamic load and autorefresh are automatic operations. Propagate and flush are operations that transmit committed changes on cache tables in the TimesTen database to the cached tables in the Oracle database. Flush is a manual operation and propagate is an automatic operation.
Figure 2-3 Transmitting Committed Changes Between the TimesTen and Oracle Databases
Description of "Figure 2-3 Transmitting Committed Changes Between the TimesTen and Oracle Databases"
The DYNAMIC
keyword designates whether the cache group is a static or
dynamic cache group:
-
Static cache group: Defined when the
DYNAMIC
keyword is not supplied when creating the cache group. In a static cache group, cache instances are loaded manually into the TimesTen cache tables from an Oracle database. Within a static cache group, data is initially loaded into the cache tables from the cached Oracle database tables using aLOAD CACHE GROUP
statement. After which, you can refresh the data with aREFRESH CACHE GROUP
statement or automatically refresh the data if defined to use autorefresh. Once the cache tables are loaded, the user can run queries. A static cache group is appropriate when the set of data to cache is static and can be predetermined before applications begin performing operations on the cache tables. By default, cache groups are static. -
Dynamic cache group: Defined when the cache group is created with the
DYNAMIC
keyword. Within a dynamic cache group, data can be loaded into the cache group from an Oracle database either dynamically on demand or manually withLOAD CACHE GROUP
orREFRESH CACHE GROUP
statements. A manual refresh or an autorefresh operation on a dynamic cache group can result in existing cache instances being updated or deleted, but committed changes on Oracle database data that are not being cached do not result in new cache instances being loaded into its cache tables. A dynamic cache group is appropriate when the set of data you need to cache is small compared to the full size of the data that exists in the tables in the Oracle database.The data should be preloaded from the Oracle database before applications perform operations on the cache tables.
Choose static or dynamic load when deciding how much data you want to cache. Ideally, a manual load is faster. Use dynamic load to automate loading new data or to specify how much data to load into memory.
Any cache group type (read-only, AWT, SWT, user managed) can be defined as a
static cache group. All cache group types except a user managed cache group that uses
both the AUTOREFRESH
cache group attribute and the
PROPAGATE
cache table attribute can be defined as a dynamic cache
group.
See Methods for Transmitting Changes Between TimesTen and Oracle Databases.
See Asynchronous WriteThrough (AWT) Cache Group and Synchronous WriteThrough (SWT) Cache Group.