Creating a Standby Cache Database

After setting up an active master database, you can create the standby database by cloning the active database to the standby server. In order to duplicate the active database, the instance administrator on the standby machine must be identical to the one on the active server.

This tutorial will make use of the predefined DSN cachedb1_1122 shipped with TimesTen 11.2.2. The hostnames of the two machines in the examples are tthost1 and tthost2. cachedb1_1122 is the active cache database on tthost1, and cachedb2_1122 on tthost2 is the standby cache database.

10. Duplicate the active database to the standby
  1. Log in to server 2 (tthost2) as the instance administrator. Use the ttRepAdmin utility to duplicate the active cache database to the standby database.

    ttrepadmin -duplicate -from cachedb1_1122 -host "tthost1" -uid cacheadm -pwd cacheadm -keepcg -cacheuid cacheadm -cachepwd cacheadm "dsn=cachedb2_1122"

    Note that the -from clause is using the data store name cachedb1_1122 and not the DSN name. -uid and -pwd correspond to the username and password of a user with ADMIN privilege on the active database.


11. Attach the active database to the cache grid
     (required only if global cache groups are present)

This step is necessary only if there are global cache groups in the cache database, or if global cache group operations are required.

  1. Log in to ttIsql and connect to cachedb1_1122 as the user cacheadm, passing in both the TimesTen and Oracle user passwords for cacheadm.

    ttIsql

    connect "dsn=cachedb1_1122;uid=cacheadm;pwd=cacheadm;oraclepwd=cacheadm";


  2. Call the procedure ttGridAttach to add the current cache database to the cache grid.

    call ttgridattach (1,'cachedb1','tthost1',9991,'cachedb2','tthost2',9992);

    Note: cachedb1 and cachedb2 are arbitrary names used to denote the 2 databases involve in the active standby pair. tthost1 is the host name of the machine where the database cachedb1_1122 is located, and tthost2 is the hostname of the machine where the database cachedb2_1122 is located. 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. The first parameter "1" indicates that the current database is the first database in the parameter list.


  3. Use the procedure ttGridNodeStatus to list all attached grid members and verify that cachedb1_1122 has joined the cache grid samplegrid.

    call ttgridnodestatus;


12. Start the replication agent on the standby database
  1. Log in to ttIsql and connect to the standby database (cachedb2_1122) as the user cacheadm, passing in both the TimesTen and Oracle user passwords for cacheadm.

    ttIsql

    connect "dsn=cachedb2_1122;uid=cacheadm;pwd=cacheadm;oraclepwd=cacheadm";


  2. The replication agent on the standby database is responsible for processing the data from the active database. Use the built-in procedure ttRepStart to start the replication agent.

    call ttrepstart;


  3. Wait for cachedb2_1122 to enter the standby state. Use the built-in procedure ttRepStateGet to verify the current replication state of the database.

    call ttrepstateget;


13. Start the cache agent on the standby database
  1. Call the built-in procedure ttCacheStart to start the cache agent on the standby database.

    call ttcachestart;


14. Attach the standby database to the cache grid
     (required only if global cache groups are present)

This step is necessary only if there are global cache groups in the cache database, or if you need to perform global cache grid operations.

  1. Call the procedure ttGridAttach to add the current standby cache database to the cache grid.

    call ttgridattach (2,'cachedb1','tthost1',9991,'cachedb2','tthost2',9992);

    Note: The first parameter "2", indicates that the current database is the second database in the parameter list.


  2. Use the procedure ttGridNodeStatus to list all attached grid members and verify that cachedb2_1122 has joined the cache grid samplegrid.

    call ttgridnodestatus;


15. Preload data into Cache Groups
  1. Log in to ttIsql and connect to cachedb1_1122 as the user cacheadm, passing in both the TimesTen and Oracle user passwords for cacheadm.

    ttIsql

    connect "dsn=cachedb1_1122;uid=cacheadm;pwd=cacheadm;oraclepwd=cacheadm";


  2. Enter the LOAD CACHE GROUP statement below in ttIsql, to populate the read-only cache group cacheadm.ro.

    load cache group ro commit every 256 rows;


  3. Enter the following LOAD CACHE GROUP statement in ttIsql to pre-load a dynamic cache group cacheadm.g_awt, with employees records where their employee_id is greater than 200;

    load cache group g_awt where employees.employee_id > 200 commit every 0 rows;

    Note: For global cache groups, the LOAD CACHE GROUP statement will fail if the cache instances are already present in the cache grid.

    After loading the data, the autorefresh state for read only cache groups will be changed to "ON". Changes to the underlying autorefresh tables in Oracle will be applied to the cache tables once the defined refresh interval has been reached. For asynchronous writethrough cache groups, all updates in the cache database will be propagated to the Oracle database, once the replication agent process is up and running.


The configuration of an active standby pair is completed. Changes to the data in the active cache database will automatically be replicated to the standby cache database.
For more information on Administering an Active Standby Pair with Cache Groups please refer to the documentation here

< Previous 1 2 3