Configure Active Standby Pair for the Cache Database
After creating an initial cache database, you can then define the configuration of the active standby pair and assign the current database as the active database.
This tutorial, will make use of the pre-defined DSN cachedb1_1121 shipped with TimesTen 11.2.1. The hostnames of the two machines in the examples are stacb12 and stach17. cachedb1_1121 is the active cache database on stacb12, and cachedb2_1121 on stach17 is the standby cache database.
3. Detach database from the cache grid
a. |
Log in to ttIsql as the user cacheadm, passing in the TimesTen and Oracle user passwords for cacheadm. |
|
|
|
connect "dsn=cachedb1_1121;uid=cacheadm;pwd=cacheadm;oraclepwd=cacheadm"; |
|
|
b. |
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; |
|
|
c. |
Use the procedure ttGridNodeStatus to verify that cachedb1 is no longer attached to a cache grid. |
|
|
|
call ttgridnodestatus; |
|
|
|
|
4. Start the cache agent
a. |
Use the built-in procedure ttCacheStart to start the cache agent if not already started. |
|
|
|
call ttcachestart; |
5. Set autorefresh state to paused
a. |
If there are any autorefresh cache groups, their autorefresh state must be temporarily set to paused before an active standby pair can be defined. Use the SQL ALTER CACHE GROUP statement to change the autorefresh state.
|
|
alter cache group ro set autorefresh state paused; |
|
|
b. |
The ttIsql command cachegroups can be used to return the properties of a cache group.
|
|
cachegroups ro; |
|
|
|
|
6. Stop the replication agent
a. |
Replication agent is responsible for replicating data between TimesTen databases. It must be stopped prior to defining an active standby pair configuration. Use the built-in procedure ttRepStop to temporary stop the replication agent if not already stopped. |
|
|
|
call ttrepstop; |
7. Define the active standby pair
a. |
Define the active standby pair schema by using the CREATE ACTIVE STANDBY PAIR statement, by default it uses asynchronous replication. |
|
|
|
create active standby pair cachedb1_1121 on "stacb12", cachedb2_1121 on "stach17"; |
|
|
|
Note: The data store names cachedb1_1121 and cachedb2_1121 used in the CREATE ACTIVE STANDBY PAIR statement are not DSNs, these are the filenames defined in the data store path attribute. The hostnames used in defining the active standby pair should match the values returned by the OS hostname command on the respective servers |
|
|
b. |
The ttIsql command repschemes can be used to verify the current replication scheme deployed in the database. |
|
|
|
repschemes; |
|
|
|
|
8. Start the replication agent
a. |
The replication agent process is responsible for replicating data between TimesTen databases. It must be running on both databases in an active standby pair. Use the built-in procedure ttRepStart to start the replication agent. |
|
|
|
call ttrepstart; |
9. Set the replication state to Active
a. |
Use the built-in procedure ttRepStateSet to designate the current database (cachedb1_1121) as the active cache database in the active standby pair.
|
|
call ttrepstateset ('active'); |
|
|
b. |
The built-in procedure ttRepStateGet returns the current replication state of the database. |
|
|
|
call ttrepstateget; |
|
|
|
|
After setting up an active cache database and defining the active standby pair configuration, you can now go and create the standby database