Task 4: Load Initial Data

Load the cache group.

  1. Reconnect as the TimesTen cache administration user. Use the ttIsql cachegroups command to view the definition of the customer_orders cache group:

    % ttIsql "DSN=cache1;UID=cacheadmin;PwdWallet=/wallets/cacheadminwallet"
    Command> cachegroups;
    
    Cache Group CACHEADMIN.CUSTOMER_ORDERS:
    
      Cache Group Type: Read Only
      Autorefresh: Yes
      Autorefresh Mode: Incremental
      Autorefresh State: Paused
      Autorefresh Interval: 5 Minutes
      Autorefresh Status: ok
      Aging: No aging defined
    
      Root Table: SALES.CUSTOMERS
      Table Type: Read Only
    
      Child Table: SALES.ORDERS
      Table Type: Read Only
    
    1 cache group found.

    See ttIsql in the Oracle TimesTen In-Memory Database Reference.

    Note that, in the output above, the state of autorefresh operations are currently Paused for all of the cache groups that you just created.

    Autorefresh State: Paused 

    By default, all read-only cache groups defined with incremental autorefresh start as paused (note that the default interval value is 5 minutes).

  2. Load the cache group with a LOAD CACHE GROUP statement for the first load of the read-only cache group. The LOAD CACHE GROUP populates the cache tables (initially, the cache tables are empty) and changes the autorefresh state from PAUSED to ON.



    The following example performs a LOAD CACHE GROUP statement for the first load of the customer_orders read-only cache group since the cache tables are empty. In this case, the example specifies 3 parallel threads to make the load more efficient and a commit is issued every 256 rows during the load operation.

    LOAD CACHE GROUP customer_orders COMMIT EVERY 256 ROWS PARALLEL 3;
    2 cache instances affected.

    See LOAD CACHE GROUP in the Oracle TimesTen In-Memory Database SQL Reference.

  3. Use the ttIsql cachegroups command again to show that the state for autorefresh state is now On for the customer_orders cache group:

    Command> cachegroups;
    
    Cache Group CACHEADMIN.CUSTOMER_ORDERS:
    
      Cache Group Type: Read Only
      Autorefresh: Yes
      Autorefresh Mode: Incremental
      Autorefresh State: On
      Autorefresh Interval: 5 Minutes
      Autorefresh Status: ok
      Aging: No aging defined
    
      Root Table: SALES.CUSTOMERS
      Table Type: Read Only
    
      Child Table: SALES.ORDERS
      Table Type: Read Only
    
    1 cache group found.
  4. Query the contents of sales.customers cache table.

    Command> SELECT * FROM sales.customers;
    122, West, Jim Johnston
    663, MidWest, Pat Reed
    2 rows found.

Since this is a static read-only cache group with autorefresh, all changes on the Oracle database are automatically refreshed into the cache group at the default interval. Since these are read-only cache tables in TimesTen, any DML statements run against them will fail.