Verify Dynamic Load with a Dynamic Read-Only Cache Group

The following shows how changes are automatically updated to the read-only cache group.

On the Oracle database:

  1. Use SQL*Plus as the Oracle database schema user to insert a new row, delete an existing row, update an existing row in the Oracle database customers table, and commit the changes.
    SQL> INSERT INTO customers VALUES (342, "West", "Jane Stone");
    1 row created.
    SQL> DELETE FROM customers WHERE cust_num=122;
    1 row deleted.
    SQL> UPDATE customers SET region="East" WHERE cust_num=663; 
    1 row updated.
    SQL> COMMIT;
    Commit complete.

On the TimesTen database:

Since the dynamic read-only cache group was created specifying autorefresh with the default interval of 5 minutes, the sales.customers cache table in the customer_orders cache group is automatically refreshed after 5 minutes with the committed changes on the cached Oracle Database sales.customers table.

  1. As the TimesTen cache administration user, use the ttIsql utility to connect to the TimesTen database.

    % ttIsql "DSN=cache1;UID=cacheadmin;PwdWallet=/wallets/cacheadminwallet"
  2. Use the ttIsql cachegroups command to view the definition of the customer_orders cache group:

    Command> cachegroups;
    Cache Group CACHEADMIN.CUSTOMER_ORDERS:
    
      Cache Group Type: Read Only (Dynamic)
      Autorefresh: Yes
      Autorefresh Mode: Incremental
      Autorefresh State: Paused
      Autorefresh Interval: 5 Minutes
      Autorefresh Status: ok
      Aging: LRU on
    
      Root Table: SALES.CUSTOMERS
      Table Type: Read Only
    
      Child Table: SALES.ORDERS  
      Table Type: Read Only
    
    1 cache group found.
    

    The TimesTen mechanism that captures data changes that occur in the Oracle database and uses those changes to refresh the cached data is called autorefresh. Note that, in the output above, the state of this mechanism is currently Paused for the cache group that you just created.

    Autorefresh State: Paused 

    By default, all read-only cache groups defined with incremental autorefresh start as paused. Perform a dynamic load request or run a LOAD CACHE GROUP statement for the first load of the read-only cache group.

    A dynamic load request or a LOAD CACHE GROUP populates the cache tables appropriately (since initially, the cache tables are empty) and changes the autorefresh state from PAUSED to ON.

  3. This example performs a dynamic load request with a qualified SQL query for customer number 342 from the sales.customers cache table. This triggers a dynamic load of that cache instance with the committed changes on the cached Oracle database table:

    Command> SELECT * FROM sales.customers WHERE cust_num=342;
    < 342, West, Jane Stone >
    1 row found.

    Note:

    All changes are automatically refreshed at the autorefresh interval time.

Since this is a quick guide on how to create a dynamic read-only cache group, see Cache Concepts and Dynamic Cache Groups in the Oracle TimesTen In-Memory Database Cache Guide for a more thorough understanding of the concepts behind and the options for a dynamic read-only cache group.