4 Cache Data from an Oracle Database

TimesTen Application Cache for OKE provides the ability to transfer data between an Oracle database and a TimesTen database in an OKE cluster. You can cache Oracle Database data and reduce the workload on the Oracle database. TimesTen uses cache groups to define the data to be cached from the Oracle database. A cache group can be defined to cache all or just part of a single table or a set of related tables from an Oracle database. TimesTen supports these types of cache groups:
  • Read-only cache group: A read-only cache group enforces a caching behavior that consists of automatically refreshing committed changes on cached tables in the Oracle database to the cache tables in the TimesTen database. This type of cache group is suitable for reference data that is heavily accessed by applications.

  • Asynchronous writethrough (AWT) cache group: An AWT cache group enforces a caching behavior that consists of automatically propagating committed changes on the cache tables in the TimesTen database to the cached tables in the Oracle database in asynchronous fashion. This type of cache group is suitable for high speed data capture and online transaction processing.

While you may have multiple TimesTen databases that synchronize with the same Oracle database, they each operate independently. However, the same table cannot be cached in separate cache groups within the same TimesTen database.

The TimesTen Operator supports cache in the following topologies:

  • Active standby pair replication scheme configuration: The TimesTen Operator configures one TimesTen database as the active database, copies the active database as the standby database, and configures an active standby pair replication scheme between them.

  • Non-replicated configuration: The TimesTen Operator configures one or more TimesTen databases. Each database is independent and has no relationship to each other.

Configuration metadata lets you define the attributes of your TimesTen database and how that database is to interact with other applications and components, including the configuration of cache groups. The TimesTen Operator supports several metadata files that contain the configuration metadata. Each metadata file has a specific name and purpose.

File Name Description

adminUser

Defines a database user in the TimesTen database and assigns ADMIN privileges to it.

db.ini

Defines the connection attributes of the TimesTen database.

cachegroups.sql

Defines the cache groups in the TimesTen database.

cacheUser

Defines the cache administration user for both the Oracle and TimesTen databases.

The TimesTen Operator creates the user in the TimesTen database and grants the appropriate privileges to it.

schema.sql

Defines database objects, such as tables, sequences, and users. For cache operations, it is used to create the schema owners of the tables to be cached from the Oracle database.

sqlnet.ora

Defines how client applications communicate with an Oracle database.

Optional.

tnsnames.ora

Defines the service name that TimesTen uses to connect to the Oracle database.

There are other metadata files available that enable you to configure other attributes and metadata for the TimesTen database, but they are not required for cache operations. See About Configuration Metadata Details in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide.

These metadata files can then be used on one or more Kubernetes facilities—such as a ConfigMap, Secret, or init container—to configure cache operations. The TimesTen Operator creates a projected volume called tt-config. This tt-config volume contains the contents of all the ConfigMaps and Secrets specified in the dbConfigMap and dbSecret fields of your TimesTenClassic object. This volume is mounted as /ttconfig in the TimesTen containers. See Populate the /ttconfig Directory in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide.

The TimesTen Operator uses the TimesTenClassic object type to provide the metadata and attributes to define and create TimesTen Classic databases in the specified namespace of your OKE cluster. The metadata and attributes are applicable to replicated and non-replicated configurations. See About Defining TimesTenClassic Objects and About the TimesTenClassic Object Type in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide.

The following table consists of a typical sequence of tasks to set up TimesTen to cache data from an Oracle database with the TimesTen Operator.

Task Description More Information

Prepare your Oracle database for cache operations

Create a default tablespace and the cache administration user, identify or create the schema owners, and grant the required privileges to the cache administration user.

Set Up the Oracle Database to Cache Data in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide

Created the metadata files and populate the /ttconfig directory.

Create the metadata files with the configuration attributes and metadata for the TimesTen databases and cache groups.

Create a ConfigMap, Secret or init container to incorparate the metadata files into the TimesTen containers.

Create Metadata Files and a Kubernetes Facility in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide

Create a TimesTenClassic object.

Create a TimesTenClassic object to provide the configuration attributes and metadata to define and create the TimesTen databases in your namespace in a replicated or non-replicated configuration. The TimesTenClassic object also creates the cache groups and starts cache operations.

Create a TimesTenClassic Object in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide

Monitor Deployment of a TimesTenClassic Object in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide

Verify TimesTen Cache Configuration in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide

Perform operations on the cache group tables

Update the cached tables in your Oracle database and verify that the updates are reflected in the cache group tables in your TimesTen databases.

Perform Operations On Cache Group Tables in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide

Note:

Some of the examples described in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide assume that you know the name and location of the TimesTen container image. You can retrieve this information from the description of the Pod of the TimesTen Operator in your specified namespace.

$ kubectl get pods -n <namespace>
NAME                            READY   STATUS    RESTARTS   AGE
timesten-operator-<unique-id>   1/1     Running   0          11m

$ kubectl describe pod timesten-operator-<unique-id> -n <namespace> | grep Image:
   Image: container-registry.oracle.com/timesten/timesten:22.1.1.35.0

These examples also assume you know the name of the Secret with the credentials to Oracle Container Registry. Use the Secret specified during that stack configuration. Also, note that the oci-bv storage class is the default for OKE clusters.

For a more in-depth approach of the configuration of cache operations with the TimesTen Operator or full details on the cache capabilities of TimesTen, see Work with TimesTen Cache in Oracle TimesTen In-Memory Database Kubernetes Operator User's Guide or Paths to Explore Cache in TimesTen in Oracle TimesTen In-Memory Database Getting Started with Cache Guide, respectively.