Manage the TimesTen Databases
The Operator strives to keep your active standby pair of databases running once they are deployed. Kubernetes manages the lifecycle of the Pods. It recreates the Pods if they fail. It also recreates the Pods on available Kubernetes cluster nodes, if the nodes on which the Pods are running fail. The Operator monitors TimesTen running in the Pods, and initiates the appropriate operations to keep the pair of databases operational. These operations are done automatically by the Operator, and should require minimal human intervention.
These sections discuss the manual operations you can perform:
Manually Invoke TimesTen Utilities
You can use the kubectl
exec
-it
command to manually invoke TimesTen utilities on your TimesTen instances. This command invokes shells in the Pods and enables you to control the running of TimesTen in the Pods.
TimesTen runs in the tt
container, as the timesten
user.
Note:
The Operator is still querying the status of the Pod, and the status of TimesTen within the Pod. If you invoke a command that disrupts the functioning of either the Pod or TimesTen, the Operator may act to try to fix what you did.
This example shows how to use the kubectl
exec
-it
command to invoke the shell within the sample-0
Pod that contains the TimesTen database. Then, you can run the ttIsql
utility.
% kubectl exec -it sample-0 -c tt -- /bin/bash % ttIsql sample Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=sample"; Connection successful: DSN=sample;UID=timesten;DataStore=/tt/home/timesten/datastore/sample; DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8;PermSize=200; DDLReplicationLevel=3; (Default setting AutoCommit=1)
Modify TimesTen Connection Attributes
TimesTen uses connection attributes to define the attributes of a database. There are three types of connection attributes:
-
Data store attributes: Define the characteristics of a database that can only be changed by destroying and recreating the database.
-
First connection attributes: Define the characteristics of a database that can be changed by unloading and reloading the database into memory.
-
General connection attributes: Control how applications access the database. These attributes persist for the duration of the connection.
For more information on TimesTen connection attributes, see List of Connection Attributes in the Oracle TimesTen In-Memory Database Reference and Connection Attributes for Data Manager DSNs or Server DSNs in the Oracle TimesTen In-Memory Database Operations Guide.
In a Kubernetes environment:
-
You can only modify data store attributes by deleting the TimesTenClassic object and the PersistentVolumeClaims associated with the TimesTenClassic object. Doing so results in the deletion of the TimesTen databases. See Delete an Active Standby Pair of TimesTen Databases and Clean Up for information on the deletion process.
-
You can modify first connection and general connection attributes without deleting the TimesTenClassic object (which deletes the databases) and the PersistentVolumeClaims associated with the TimesTenClassic object. Note that there are TimesTen restrictions when modifying some of the first connection attributes.
To modify first or general connection attributes:
-
You must first edit the
db.ini
file. Complete the procedure in the Manually Edit the db.ini File section. This section must be completed first.
Then, take these steps:
-
If you are modifying first connection attributes, follow the procedure in the Modify First Connection Attributes section.
-
If you are modifying general connection attributes, follow the procedure in the Modify General Connection Attributes section.
Manually Edit the db.ini File
Complete this section if you are modifying first or general connection attributes or both. This section must be completed before proceeding to the Modify First Connection Attributes or the Modify General Connection Attributes sections.
To modify first or general connection attribute requires a change in the sys.odbc.ini
file.
If you have already created your active standby pair of TimesTen databases by creating a TimesTenClassic object, and you now want to change one or more first or general connection attributes in your sys.odbc.ini
file, you must change the db.ini
file.
The details as to how you should modify your db.ini
file depends on the facility originally used to contain the db.ini
file. (Possible facilities include ConfigMaps, Secrets, or init containers. See Populate the /ttconfig Directory for details.)
In this example, the ConfigMap facility was originally used to contain the db.ini
file and to populate the /ttconfig
directory of the TimesTen containers. The example modifies the sample
ConfigMap.
The steps are:
You have successfully changed the sample
ConfigMap. If you are modifying first connection attributes, proceed to the Modify First Connection Attributes section. If you are modifying only general connection attributes, proceed to the Modify General Connection Attributes section.
Modify First Connection Attributes
If you have not modified the db.ini
file, proceed to the Manually Edit the db.ini File section. You must now delete the standby Pod and then delete the active Pod. When you delete a Pod that contains a container running TimesTen, the Operator creates a new Pod to replace the deleted Pod. This new Pod contains a new sys.odbc.ini
file which is created from the contents of the db.ini
file located in the /ttconfig
directory.
Perform these steps to delete the standby Pod.
You have successfully modified the PermSize
and the TempSize
first connection attributes.
Modify General Connection Attributes
If you have not modified the db.ini
file, proceed to the Manually Edit the db.ini File section. You can either directly modify the sys.odbc.ini
file for the active TimesTen database and the sys.odbc.ini
file for the standby TimesTen database or you can follow the steps in the Modify First Connection Attributes section. The first approach (modifying the sys.odbc.ini
file directly) is less disruptive.
This section discusses the procedure for directly modifying the sys.odbc.ini
files.
The sys.odbc.ini
file is located in the TimesTen container of the Pod containing the active TimesTen database and in the TimesTen container of the Pod containing the standby TimesTen database. After you complete the modifications to the sys.odbc.ini
files, subsequent applications can connect to the database using these general connection attributes.
This example illustrates how to edit the sys.odbc.in
i files.
-
Use the
kubectl
exec
-it
command to invoke a shell in the active Pod. (In this example,sample-0
is the active Pod.)% kubectl exec -it sample-0 -c tt -- /bin/bash Last login: Fri Apr 08 22:43:26 UTC 2023 on pts/8
-
Verify the current directory (
/tt/home/timesten
).% pwd /tt/home/timesten
-
Navigate to the directory where the
sys.odbc.ini
file is located. Thesys.odbc.ini
file is located in the/tt/home/timesten/instances/instance1/conf
directory. Therefore, navigate to theinstances/instance1/conf
directory.% cd instances/instance1/conf
-
Edit the
sys.odbc.ini
file, adding, modifying, or deleting the general connection attributes for your DSN. (sample
, in this example.)Note:
Ensure that you only make modifications to the TimesTen general connection attributes. Data store attributes and first connection attributes cannot be modified by directly editing the
sys
.
odbc
.
ini
file.This example modifies the
sample
DSN, adding theConnectionCharacterSet
general connection attribute and setting its value equal toAL32UTF8
(represented in bold).vi sys.odbc.ini [ODBC Data Sources] sample=TimesTen 22.1 Driver tt=TimesTen 22.1 Driver [sample] Datastore=/tt/home/timesten/datastore/sample PermSize=200 DatabaseCharacterSet=AL32UTF8 ConnectionCharacterSet=AL32UTF8 DDLReplicationLevel=3 AutoCreate=0 ForceDisconnectEnabled=1 ...
-
Use the
ttIsql
utility to connect to thesample
database and verify the value of theConnectionCharacterSet
attribute isAL32UTF8
(represented in bold).% ttIsql sample Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=sample"; Connection successful: DSN=sample;UID=timesten;DataStore=/tt/home/timesten/datastore/sample; DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=AL32UTF8; AutoCreate=0;PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1; (Default setting AutoCommit=1)
You have successfully modified the sys.odbc.ini
file located in the TimesTen container of the active Pod (in this example, sample-0
). Use the same procedure to modify the sys.odbc.ini
file located in the TimesTen container of the standby Pod (in this example, sample-1
).
For example:
You have successfully modified the sys.odbc.ini
file located in the TimesTen container of the active Pod (sample-0
) and the sys.odbc.ini
file located in the TimesTen container of the standby Pod (sample-1
). The ConnectionCharacterSet
general connection attribute has also been modified.
Revert to Manual Control
If you want to manually operate your active standby pair, you can delete the timesten-operator
Deployment. The Operator stops, and does not restart. This affects all of the TimesTenClassic objects that are running in your Kubernetes cluster. If you do not want the Operator to stop managing all of the TimesTenClassic objects, you can suspend the management of individual TimesTenClassic objects. See "Suspend Management of a TimesTenClassic Object" for information.
The TimesTenClassic object, representing the active standby pair of TimesTen databases, remains in Kubernetes, as do the other Kubernetes objects associated with them. You can use the kubectl
exec
-it
command to invoke shells in the Pods, and then you can control Timesten that is running in those Pods.
If one or both Pods in your active standby pair fails, Kubernetes creates new ones to replace them. This is due to the StatefulSet object that the Operator had previously created in Kubernetes. However, since the Operator is not running the new Pods, it cannot automatically start TimesTen. In this case, your active standby pair cannot be configured or started. You are responsible for the operation of TimesTen in the Pods.
If you want the Operator to take control again, you must redeploy the Operator. Once the Operator is redeployed, the Operator automatically identifies the TimesTenClassic objects in your Kubernetes cluster, and will attempt to manage them again.
This example shows you how to manually control TimesTen.
Delete an Active Standby Pair of TimesTen Databases
If you delete the TimesTenClassic object that represents the active standby pair of TimesTen databases, Kubernetes automatically deletes all the Kubernetes objects and the resources it is using. The StatefulSet, the Service, and the Pods, that are associated with the pair are all deleted from Kubernetes. However, the PersistentVolumeClaims (that contain the TimesTen databases) are not deleted. You must manually delete the PersistentVolumeClaims (PVCs) after you delete the TimesTenClassic object. After you manually delete the PVCs, the PersistentVolumes, holding the databases, are recycled by Kubernetes. (You may be able to control this using the Kubernetes volume retention policy, but this is not controlled by the Operator.)
As an example, use the kubectl
delete
command to delete the PVCs for the sample
databases.
% kubectl delete pvc tt-persistent-sample-0 persistentvolumeclaim "tt-persistent-sample-0" deleted % kubectl delete pvc tt-persistent-sample-1 persistentvolumeclaim "tt-persistent-sample-1" deleted