Loading a Database into Memory for TimesTen

Loading the database into memory for TimesTen can be done automatically when a certain RAM policy is set or manually with the ttAdmin utility.

  1. Before you try to load the database into memory for TimesTen, confirm that the TimesTen daemon is running with the ttStatus utility. The following output shows that the TimesTen daemon is not running.
    % ttStatus
    ttStatus: Could not connect to the TimesTen daemon.
    If the TimesTen daemon is not running, please start it by running "ttDaemonAdmin -start".
  2. Start the TimesTen daemon, if necessary.
    ttDaemonAdmin -start
  3. The RAM policy setting is important as it specifies if, how, and when the database is loaded or unloaded from memory. The default RAM policy for a TimesTen database is inUse.

    You can set the RAM policy before loading the database into memory. See Specifying a RAM Policy.

    The following example sets the RAM policy of a TimesTen database to manual:

    % ttAdmin -ramPolicy manual database1
    
    RAM Residence Policy            : manual
    Manually Loaded In RAM          : False
    Replication Agent Policy        : manual
    Replication Manually Started    : False
    Cache Agent Policy              : manual
    Cache Agent Manually Started    : False
    Database state                  : open
  4. Use the ttAdmin utility to load (or reload) the database into memory, or unload the database from memory.

    If the RAM policy is manual for the database database1, then load the TimesTen database into memory with the ttAdmin -ramLoad utility. The -ramLoad option of the ttAdmin utility can only be used with the manual or enduring RAM policies:

    % ttAdmin -ramLoad database1
    
    RAM Residence Policy            : manual
    Manually Loaded In RAM          : True
    Replication Agent Policy        : manual
    Replication Manually Started    : False
    Cache Agent Policy              : manual
    Cache Agent Manually Started    : False
    Database state                  : open

    If the RAM policy is manual, you can change it to always to specify that the database is always reloaded.

    ttAdmin -ramPolicy always database1

    If the RAM policy is inUse, then you want the grace period to be greater than 0, so that the database will be kept in memory for that time period when idle:

    % ttAdmin -ramPolicy inUse -ramGrace 200 database1
    
    RAM Residence Policy            : inUse plus grace period
    RAM Residence Grace (Secs)      : 200
    Replication Agent Policy        : manual
    Replication Manually Started    : False
    Cache Agent Policy              : manual
    Cache Agent Manually Started    : False
    Database state                  : open

    If the RAM policy is manual for the database database1 and the database was previously closed to incoming connections, then you can both load and open the TimesTen database into memory with the ttAdmin -ramload -open command.

    % ttAdmin -ramLoad -open database1
    
    RAM Residence Policy            : manual
    Manually Loaded In RAM          : True
    Replication Agent Policy        : manual
    Replication Manually Started    : False
    Cache Agent Policy              : manual
    Cache Agent Manually Started    : False
    Database state                  : open
  5. If your database is configured for replication or cache for your database, run the ttAdmin utility to start the replication and cache agents.

    To start the replication agent:

    ttAdmin -repStart database1

    To start the cache agent:

    ttAdmin -cacheStart database1

See ttAdmin and ttDaemonAdmin in the Oracle TimesTen In-Memory Database Reference.