Starting and Stopping a TimesTen Database

The concept of starting and stopping a TimesTen in-memory database is different from that of a disk-based RDBMS. For TimesTen, a database is ready for use by an application after the database is loaded into memory.

Starting TimesTen

Before you can connect to a TimesTen database, the TimesTen main daemon process needs to be started. Use the ttDaemonAdmin utility as shown below:

ttDaemonAdmin -start

Database Loading and Unloading

The very first connection to a TimesTen database triggers the loading of the database to memory. The time it takes to load the database depends on the size of the database and the disk storage speed. The database resides in memory until the last connection disconnects, which automatically unloads the database from memory unless a RAM policy was set to keep the database loaded. The RAM policy setting is explained in the latter part of this section.

TimesTen databases are automatically persisted to disk storage using periodic checkpoints to keep snapshots of the database. Checkpoint files are used to load the database to memory. Before unloading a database, a final checkpoint is performed.

Stopping TimesTen

To gracefully shutdown a TimesTen database, disconnect all applications and agent processes from the database, and then execute the following command:

ttDaemonAdmin -stop

Note:

RAM Policy Setting

TimesTen allows you to specify a RAM policy that determines when the database is loaded and unloaded from main memory. The policy options are:

InUse:
Load the database on first connection and unload on last disconnect. This is the default policy.

Inuse with RamGrace:
Keep the database in memory for a "grace period" after the last disconnect.

Always:
Keep the database in memory at all times and automatically load the database upon restart of the TimesTen daemon process.

Manual:
Load and unload the database manually.

Use the ttAdmin utility to set the RAM policy. Refer to the documentation on Ram Policy for more details.

Choosing the RAM policy for your environment

Depending on your company's operational procedure and application characteristics, you should evaluate which RAM policy option is best for your production environment.

InUse:
This is the default policy setting and is convenient, particularly for development use. A disadvantage of this policy is that the first connection of the application needs to wait for the database to be loaded. If you have a relatively large database and the application does not always have a connection to the database, you may incur unnecessary wait time if the database needs to be loaded.

Inuse with RamGrace:
This policy is useful for applications with frequent periods of "idle" time when there is no connection to the database at all. Setting a "grace period" to keep the database in memory can avoid unnecessary load / unload operations.

Always:
This policy keeps the database in memory whenever the server is up or rebooted, independent of the applications. This policy is useful if you have multiple applications sharing the database.

Manual:
This policy gives the database administrator more control over when the TimesTen database is loaded and unloaded. For enterprise companies where the TimesTen database is managed as part of their operational procedure to support the TimesTen applications, this policy is commonly used in system startup and shutdown procedures.