Configure In-Memory Database Cache and Clusterware

The following eight steps are required to configure an Active Standby Pair with Oracle Clusterware and Oracle In-Memory Database Cache:

1. Create some cache groups
  In order to set up an active standby pair for a cache database, you need to first create some cache groups in the cache database.
This database must include a user with the ADMIN privilege, and a cache user with some objects to be used for replication.
   

In this example we will use the pre-defined Quick Start DSN cachedb1_1121.

Note. An identical system DSN (cachedb1_1121) must be defined on both the active and the standby host.

   
a. Create the TimesTen Schema and Cache Admin users on Oracle and GRANT the cache admin user rights to the Oracle tables of interest.
   
b. Connect to and/or create the cachedb1_1121 database using ttIsql from host mobile-qa3 as the instance administrator.
   
c. ttCWAdmin supports Read Only, AWT, SWT, dynamic and non-dynamic local and global cache groups.
   
  Create a read only cache group based on the HR Departments table using the following SQL script:
   
  quickstart/sample_scripts/cachegrid/create_local_ro.sql
   
  Create read only cache group
   

2. Detach database from the cache grid

a. This step is required only if the database is currently attached to a cache grid. Use the built-in ttGridDetach to detach it.
 
call ttgriddetach;
   
b. Use the procedure ttGridNodeStatus to verify that cachedb1 is no longer attached to a cache grid.
   
  call ttgridnodestatus;
   
 

3. Register the TimesTen Cluster Information

a. TimesTen cluster information is stored in the Oracle Cluster Registry. As the root user on UNIX or Linux platforms, or as the instance administrator on Windows, register the TimesTen cluster information by executing the ttCWAdmin -ocrConfig command on one of the hosts.
 
ttCWAdmin -ocrConfig

4. Start the Cluster Agent

a. Start the TimesTen cluster agent by executing the ttCWAdmin -init command on one of the hosts. For example on mobile-qa6:
   
ttCWAdmin -init
   
  ttCWAdmin -init
   
  This command starts TimesTen Clusterware agents and TimesTen daemons on all nodes in the cluster and starts monitoring them through Oracle Clusterware.

5. Create the TimesTen cluster.ini config file

a. For a basic active standby pair configuration with local cache groups, only the MasterHosts and CacheConnect attributes are needed.
 
cachedb1_1121 cluster entry
 
The cluster.oracle.ini entry name (eg [cachedb1_1121]) must correspond to the system DSN for the active and standby databases.
 
If you use global cache groups or need to perform global cache grid queries, then the GridPort attribute must also be defined. This attribute lists the port numbers used by the cache grid agents for the active database and the standby database in an active standby pair that is a cache grid member.

e.g. GridPort=9991,9992

The TCP/IP port numbers 9991 and 9992 are arbitrary, but they should not conflict with other TCP ports (e.g. ftp, telnet etc.), specifically the hostname + port combination should be unique.
 
Note When you use the installer or ttmodinstall to add support for Oracle Clusterware, the mandatory MasterHosts attribute will be created in the cluster.oracle.ini file for you. For more complex configurations, you need to add the relevant attributes yourself in the cluster.oracle.ini file on every node in the cluster.

6. Create an Active Standby Pair

a. Drop any existing [SQL] Active Standby Pair for the cachedb1_1121database.
 
DROP ACTIVE STANDBY PAIR;
 
You cannot mix Active Standby Pairs managed by SQL and managed by ttCWAdmin.
An Active Standby Pair for a cache database should be managed by either SQL or by ttCWAdmin, but not by both.
 
b. Create an Active Standby Pair replication scheme by executing the ttCWAdmin -create command on any host. For example on mobile-qa3:
 
ttCWAdmin -create -dsn cachedb1_1121
 
ttCWAdmin create [cache]
 
Based on the cachedb1_1121 entries in the system DSN and the cluster.oracle.ini, this command created the replication scheme for the cachedb1_1121 DB on the mobile-qa3 and mobile-qa6 machines.

7. Start the Active Standby Pair

a. Start the Active Standby Pair replication scheme by executing the ttCWAdmin -start command on any host. For example on mobile-qa6:
 
ttCWAdmin -start -dsn cachedb1_1121
 
ttcwadmin start [cachegroup]
   
This command starts the active standby pair and can be executed from any node in the cluster.

Note
ttCWAdmin -start will automatically start the RepAgent on the standby machine and duplicate the active database onto the standby host.
The time taken to duplicate the active database will be proportional to the size of the active database and the performance of the hardware used.
Once the Active/Standby Pair has be started by ttCWAdmin, committed writes to the active database will be written to its local transaction logs, but they will not get replicated to the standby database until the duplicate operation is complete.

The ttCWAdmin -status -dsn your_DSN command enables you to check the progress of the database duplication.

If you have global cache groups or need to perform global cache grid queries (i.e. GridPort has been defined in cluster.oracle.ini), then ttCWAdmin -start will also attach both the active and the standby database to the cache grid. You can use the built-in procedure ttRepStateGet to determine to current replication and grid state of a database in an active standby pair. If the output from the built-in is <ACTIVE, AVAILABLE> and <STANDBY,AVAILABLE>, then the configuration of the active standby pair is complete.

8. Preload data into cache groups

a. Populate the cache group by loading the rows from Oracle.
 
load cache group ro commit every 256 rows;
 
  Load read only cache group
   
This command must be run on the active node.