Unloading a Database from Memory for TimesTen

In TimesTen, a database remains loaded in shared memory if any applications or TimesTen agents, such as the cache agent or replication agent, are connected to it. In TimesTen, a database may also be kept in shared memory for particular RAM policy setting, even when no applications or agents are connected.

Before unloading the database from memory for TimesTen, you must first close the database, close all active connections to the database and then set the RAM policy of the database to manual or inUse.

Note:

The following steps use examples where database1 is the database that is to be unloaded. It is assumed that it is the active master in a replication scheme and has been configured with cache. Note that a database can have both replication and cache configured, and a RAM policy other than manual.

  1. Close the database to reject any new requests to connect to the database.
    ttAdmin -close database1
  2. Disconnect all applications from the database.

    To close all active connections to the database, run the ttAdmin -disconnect command. See Disconnecting from a Database in this book and ttAdmin in the Oracle TimesTen In-Memory Database Reference.

  3. If the replication agent is running on the database, set the replication state to pause and stop the replication agent. The example sets the replication state from the active master database1 to the standby master standbydb to pause, then stops the replication agent on the active master database1.
    ttRepAdmin -receiver -name database1 -state pause standbydb
    ttAdmin -repStop database1
  4. If the cache agent is running on the database, stop the cache agent.
    ttAdmin -cacheStop database1
  5. Ensure that the RAM policy is set to either manual or inUse. Then unload the database from memory. See Specifying a RAM Policy.

    If the RAM policy is set to always, change it to manual and then unload the database from memory with the ttAdmin -ramPolicy -ramUnload utility options.

    ttAdmin -ramPolicy manual -ramUnload database1

    If the RAM policy is set to manual, unload the database with the ttAdmin -ramUnload utility:

    ttAdmin -ramUnload database1

    If the RAM policy is set to inUse and a grace period is set, set the grace period to 0 or wait for the grace period to elapse. This results in the database being unloaded. TimesTen unloads a database with an inUse RAM policy from memory once you close all active connections.

    ttAdmin -ramGrace 0 database1
  6. Run the ttStatus utility to verify that the database has been unloaded from memory and the database is closed. The database is unloaded if there are no processes. The database is closed when the output shows Closed for user connections.

    See ttStatus in Oracle TimesTen In-Memory Database Reference.

  7. Optionally, stop the TimesTen daemon.
    ttDaemonAdmin -stop

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