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. Ram policy setting is explained below.
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 that the TimesTen main daemon process manages all databases under the same TimesTen installation, be sure to disconnect from all databases before running the above command.
If the main daemon process is stopped while there are active agent processes, connections and transactions, the database is invalidated and will require a recovery procedure upon restart. Recovery of a failed database involves getting data from the checkpoint file and the transaction logs. Restarting a database that requires recovery takes longer time than restarting from a graceful shutdown.
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 time 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.
- The InUse policy is the default 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 when the database needs to be loaded.
- The InUse with RamGrace policy is useful for applications with frequent periods of "idle" time where 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.
- The Manual 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.
- The Always 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.
Home | Site Map | Contact Us | Copyright © 2011 |