Managing the Cache Agent

The cache agent process performs cache operations (such as autorefresh and loading a cache group), as well as manages Oracle Database objects used to enforce the predefined behaviors of particular cache group types.

You can check the status of the cache agent. See Checking the Status of Cache and Replication Agents.

Starting the Cache Agent

The cache agent is a TimesTen daemon process that manages many of the cache-related functions for a TimesTen database. You can manually start the cache agent.

Start the cache agent with the following:

  • In TimesTen Scaleout, use the ttGridAdmin dbCacheStart command to start the cache agent on all instances in the grid. See Start a Cache Agent for TimesTen Scaleout in the Oracle TimesTen In-Memory Database Scaleout User's Guide.

  • In TimesTen Classic, call the ttCacheStart built-in procedure as the TimesTen cache administration user:

    Command> call ttCacheStart;

    You can also start the cache agent from a command line by running a ttAdmin -cacheStart utility command as a TimesTen external user with the CACHE_MANAGER privilege:

    % ttAdmin -cacheStart cache1

Stopping the Cache Agent

You can manually stop the cache agent.

Stop the cache agent by performing the following:

  • In TimesTen Scaleout, use ttGridAdmin dbCacheStop command to stop the cache agent on all instances within the grid. See Stopping the Cache Agents for TimesTen Scaleout in the Oracle TimesTen In-Memory Database Scaleout User's Guide.

  • In TimesTen Classic, call the ttCacheStop built-in procedure as the TimesTen cache administration user:

    Command> call ttCacheStop;

    You can also stop the cache agent from a command line by running a ttAdmin -cacheStop utility command as a TimesTen external user with the CACHE_MANAGER privilege:

    % ttAdmin -cacheStop cache1

    Do not stop the cache agent immediately after you have dropped or altered a cache group with autorefresh. Instead, wait for at least two minutes to allow the cache agent to clean up Oracle Database objects such as change log tables and triggers that were created and used to manage the cache group.

    The ttCacheStop built-in procedure has an optional parameter and the ttAdmin -cacheStop utility command has an option -stopTimeout that specifies how long the TimesTen main daemon process waits for the cache agent to stop. If the cache agent does not stop within the specified timeout period, the TimesTen daemon stops the cache agent. The default cache agent stop timeout is 100 seconds. A value of 0 specifies to wait indefinitely.

Note:

The TimesTen X/Open XA and Java Transaction API (JTA) implementations do not work with cache. The start of any XA or JTA transaction fails if the cache agent is running.

Set a Cache Agent Start Policy in TimesTen Classic

A cache agent start policy determines how and when the cache agent process starts on a TimesTen Classic database.

Note:

In TimesTen Scaleout, the grid manages the cache agent start policy.

The cache agent start policy can be set to:

  • manual

  • always

  • norestart

The default start policy is manual, which means the cache agent must be started manually by calling the ttCacheStart built-in procedure or running a ttAdmin -cacheStart utility command. To manually stop a running cache agent process, call the ttCacheStop built-in procedure or run a ttAdmin -cacheStop utility command.

When the start policy is set to always, the cache agent starts automatically when the TimesTen main daemon process starts. With the always start policy, the cache agent cannot be stopped when the main daemon is running unless the start policy is first changed to either manual or norestart. Then issue a manual stop by calling the ttCacheStop built-in procedure or running a ttAdmin -cacheStop utility command.

With the manual and always start policies, the cache agent automatically restarts when the database recovers after a failure such as a database invalidation.

Setting the cache agent start policy to norestart means the cache agent must be started manually by calling the ttCacheStart built-in procedure or running a ttAdmin -cacheStart utility command, and stopped manually by calling the ttCacheStop built-in procedure or running a ttAdmin -cacheStop utility command.

With the norestart start policy, the cache agent does not automatically restart when the database recovers after a failure such as a database invalidation. You must restart the cache agent manually by calling the ttCacheStart built-in procedure or running a ttAdmin -cacheStart utility command.

Note:

See ttAdmin, ttCachePolicySet, ttCacheStart and ttCacheStop in the Oracle TimesTen In-Memory Database Reference.

You can set the cache agent start policy in TimesTen Classic by calling the ttCachePolicySet built-in procedure as the TimesTen cache administration user:

Command> call ttCachePolicySet('always');

It can also be set from a command line by running a ttAdmin -cachePolicy utility command as a TimesTen external user with the CACHE_MANAGER privilege:

% ttAdmin -cachePolicy norestart cache1