Perform RAM Operations
Options
ttAdmin
has these options to set the RAM policy, start the database and stop the database:
Option | Description |
---|---|
|
An ODBC connection string that specifies a database location, driver, and optionally other connection attribute settings. |
|
An ODBC data source name of the database to be administered. |
|
If set to If set to |
|
Only effective if |
|
Valid only when |
|
Defines the policy used to determine when the database is loaded into system RAM.
This is the recommended RAM policy because it avoids unnecessary database loading or unloading.
This feature enables you to perform a fast patch upgrade, as you can detach from the shared memory segment instead of unloading the database. Then after the upgrade, you can attach to this shared memory segment avoiding loading the database. The RAM policy enduring also enables you to use the-shmFree option.
|
|
Performs a clean shutdown of the database by disconnecting the subdaemon and destroying the shared memory segment. The checkpoint file written to disk allows you to reload the database using the The |
|
Enables you to reattach to a preserved shared memory segment while starting the database. The prerequisites are setting the RAM policy to enduring and having the shared memory segment previously detached with the |
|
Enables you to stop the database by detaching (instead of destroying) the shared memory segment. Before disconnecting from the shared memory segment, you can specify the subdaemon to perform a static checkpoint with the To use |
|
The -shmDetach option but decide you do not want to re-attach the segment, you can free the segment by using the -shmFree option. After doing so, you can still load the database from the checkpoint files using the -ramLoad option.
|
Note:
RAM policy enduring is helpful to perform fast patch upgrades, because you do not need to unload and reload the data which can be time-consuming. The-ramPolicy enduring
enables you:
- Use
-shmDetach
to preserve the shared memory segment while stopping the database. - Perform the fast upgrade.
- Use
-shmAttach
to attach to the preserved memory segment while starting the database.
Examples
To manually control whether database1
is loaded into RAM and to load it now, use the following:
% ttAdmin -ramPolicy manual -ramLoad database1
The database1
database is typically always resident in RAM. However, it is not being used at a given time and should be loaded only when applications are connected to it. To change the RAM policy:
ttAdmin -ramPolicy inUse database1
To set the RAM policy of database1
to enduring:
$ ttAdmin -ramPolicy enduring database1 RAM Residence Policy : enduring 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
Now assume database1
is not always in use. Permanently loading it into RAM would unnecessarily use memory. This database is idle for long periods, but when it is in use multiple users connect to it in rapid succession. To improve performance, it may be best to keep the database in RAM when applications are connected to it and to keep it in RAM for 5 minutes (300 seconds) after the last user disconnects. With this RAM policy, the database remains in RAM if applications are connected to the database. To set this policy:
% ttAdmin -ramPolicy inUse -ramGrace 300 History
Some performance-sensitive applications use a database referred to by DSN database1
. So that applications do not have to wait for the database to be loaded from disk into RAM, this database must always remain in RAM. To accomplish this:
% ttAdmin -ramPolicy always database1
To display a summary of the policy settings for the database1
DSN:
% ttAdmin -query database1 RAM Residence Policy : inUse Replication Agent Policy : manual Replication Manually Started : False Cache Agent Policy : manual Cache Agent Manually Started : False Database State : Open
Notes
If you need to destroy a database, use the ttDestroy
utility. If the database has a preserved shared memory segment (because it was detached with the -shmDetach
utility) you must use the ttDestroy -force
option. For more information on destroying a database, see ttDestroy.
Setting the RAM policy to inUse for production systems with large databases is not recommended as the database may unload or reload unexpectedly which can result in long delays and excessive overhead.
RAM policy always
conflicts with forced disconnect granularity unload
, described in Force Disconnect. Using both simultaneously results in an error and the disconnect request being ignored.
The always RAM policy should be used with caution. When failures occur, it may not be beneficial to have your database automatically reload. In addition, it may affect system startup performance if all databases load at the same time when your system boots.
If the shared memory segment is destroyed manually (for example by using ipcrm
), -shmFree
returns an error indicating that the shared memory segment is missing; however, the -shmFree
command updates the database's DBI file and main daemon bookkeeping. The database can then be successfully loaded with -ramLoad
, and the database RAM policy can be changed to another policy besides enduring by using ttAdmin -ramPolicy
.
If you try to load a database using -ramLoad
while a previously detached shared memory segment exists for that database, then the command returns an error and fails. You must either attach the segment with -shmAttach
(instead of -ramLoad
) or destroy it using -shmFree,
and then reload the database using the -ramLoad
option.