Modify the Number of Replicas in Non-Replicated Environments
There may be situations where you want to increase or decrease the number of databases in your non-replicated environment. For example, you may want to increase the resources during a peak holiday buying season and then reduce the resources later. You can accomplish this by modifying the number of replicas for a TimesTenClassic object.
               
When you increase the number of replicas, Kubernetes provisions TimesTen in the new Pods.
- 
                           
Kubernetes deletes the relevant Pods.
 - 
                           
The TimesTen Operator does not delete the PVCs.
 
Let's walk through an example. In this example, a TimesTenClassic object is deployed in your namespace. The number of replicas is 3. The example shows you how to decrease the number of replicas to 1 and then increase the number of replicas back to 3.
                  
- Confirm there is a TimesTenClassic object deployed in your namespace.
kubectl get ttcThe output is similar to the following:
NAME STATE ACTIVE AGE norepsample AllReplicasReady N/A 17mThe
norepsampleTimesTenClassic object is deployed and is in theAllReplicasReadystate. All replicas are available and running and the databases are functioning properly. - Confirm the number of replicas.
kubectl describe ttc norepsample | grep 'Replicas'The output is similar to the following:
Replicas: 3The number of replicas is
3. - Confirm the number of Pods.
kubectl get podsThe output is similar to the following
NAME READY STATUS RESTARTS AGE norepsample-0 3/3 Running 0 18m norepsample-1 3/3 Running 0 18m norepsample-2 3/3 Running 0 18m ...There are three Pods running, corresponding to the number of replicas. Each replica contains a TimesTen database.
 - Insert data into databases.
- Database running in the 
norepsample-0Pod:kubectl exec -it norepsample-0 -c tt -- /bin/bash [timesten@norepsample-0 ~]$ ttIsql norepsample Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=norepsample"; Connection successful: DSN=norepsample;UID=timesten;DataStore=/tt/home/timesten/datastore/norepsample;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;AutoCreate=0;PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1; (Default setting AutoCommit=1) Command> CREATE TABLE testdata (col1 TT_INTEGER); Command> INSERT INTO testdata values (0); 1 row inserted. Command> SELECT * FROM testdata; < 0 > 1 row found. Command> exit Disconnecting... Done. [timesten@norepsample-0 ~]$ exit exitThere is one row in the
testdatatable and the value forcol1is0. - Database running in the 
norepsample-1Pod:kubectl exec -it norepsample-1 -c tt -- /bin/bash [timesten@norepsample-0 ~]$ ttIsql norepsample Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=norepsample"; Connection successful: DSN=norepsample;UID=timesten;DataStore=/tt/home/timesten/datastore/norepsample;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;AutoCreate=0;PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1; (Default setting AutoCommit=1) Command> CREATE TABLE testdata (col1 TT_INTEGER); Command> INSERT INTO testdata values (1); 1 row inserted. Command> SELECT * FROM testdata; < 1 > 1 row found. Command> exit Disconnecting... Done. [timesten@norepsample-1 ~]$ exit exitThere is one row in the
testdatatable and the value forcol1is1. - Database running in the 
norepsample-2Pod:kubectl exec -it norepsample-2 -c tt -- /bin/bash [timesten@norepsample-0 ~]$ ttIsql norepsample Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=norepsample"; Connection successful: DSN=norepsample;UID=timesten;DataStore=/tt/home/timesten/datastore/norepsample;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;AutoCreate=0;PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1; (Default setting AutoCommit=1) Command> CREATE TABLE testdata (col1 TT_INTEGER); Command> INSERT INTO testdata values (2); 1 row inserted. Command> SELECT * FROM testdata; < 2 > 1 row found. Command> exit Disconnecting... Done. [timesten@norepsample-2 ~]$ exit exitThere is one row in the
testdatatable and the value forcol1is2. 
 - Database running in the 
 - Decrease the number of replicas.
- Edit the 
norepsampleTimesTenClassic object, changingreplicasto1.kubectl edit ttc norepsample # Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: timesten.oracle.com/v4 kind: TimesTenClassic ... spec: ttspec: ... replicas: 1 ... - Save your edit.The output is similar to the following:
timestenclassic.timesten.oracle.com/norepsample edited 
 - Edit the 
 - Verify the TimesTenClassic object is in the 
AllReplicasReadystate.kubectl get ttcThe output is similar to the following:
NAME STATE ACTIVE AGE norepsample AllReplicasReady N/A 63m - Confirm the number of Pods.
kubectl get podsThe output is similar to the following:
NAME READY STATUS RESTARTS AGE norepsample-0 3/3 Running 0 65m ...There is one Pod. One TimesTen database is running in the Pod.
 - Confirm the number of PVCs.
kubectl get pvcThe output is similar to the following:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE tt-persistent-norepsample-0 Bound csi-836f3962-cbfa-4f7d-9271-6393167b00bd 50Gi RWO oci-bv 67m tt-persistent-norepsample-1 Bound csi-b2bfa486-6d09-463f-a8a3-25a760d1449d 50Gi RWO oci-bv 67m tt-persistent-norepsample-2 Bound csi-820a206b-1662-4c24-821c-a947572b618a 50Gi RWO oci-bv 67mThere are three PVCs. When you modify the number of replicas, the TimesTen Operator does not delete the PVCs associated with a TimesTenClassic object.
 - Increase the number of replicas.
- Edit the 
norepsampleTimesTenClassic object, changingreplicasto3.kubectl edit ttc norepsample # Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: timesten.oracle.com/v4 kind: TimesTenClassic ... spec: ttspec: ... replicas: 3 ... - Save your edit.The output is similar to the following:
timestenclassic.timesten.oracle.com/norepsample edited 
 - Edit the 
 - Verify the TimesTenClassic object is in the 
AllReplicasReadystate.kubectl get ttcThe output is similar to the following:
NAME STATE ACTIVE AGE norepsample AllReplicasReady N/A 76m - Confirm the number of Pods.
kubectl get podsThe output is similar to the following:
NAME READY STATUS RESTARTS AGE norepsample-0 3/3 Running 0 77m norepsample-1 3/3 Running 0 4m norepsample-2 3/3 Running 0 4mThere are three Pods. Each Pod is running a TimesTen database.
 - Confirm the number of PVCs.
kubectl get pvcThe output is similar to the following:
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE tt-persistent-norepsample-0 Bound csi-836f3962-cbfa-4f7d-9271-6393167b00bd 50Gi RWO oci-bv 79m tt-persistent-norepsample-1 Bound csi-b2bfa486-6d09-463f-a8a3-25a760d1449d 50Gi RWO oci-bv 79m tt-persistent-norepsample-2 Bound csi-820a206b-1662-4c24-821c-a947572b618a 50Gi RWO oci-bv 79mThere are three PVCs associated with the three TimesTen databases.
 - Verify the data in the databases.
- Database running in the 
norepsample-0Pod:kubectl exec -it norepsample-0 -c tt -- /bin/bash [timesten@norepsample-0 ~]$ ttIsql norepsample Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=norepsample"; Connection successful: DSN=norepsample;UID=timesten;DataStore=/tt/home/timesten/datastore/norepsample;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;AutoCreate=0;PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1; (Default setting AutoCommit=1) Command> tables; TIMESTEN.TESTDATA 1 table found. Command> SELECT * FROM testdata; < 0 > 1 row found.Since this Pod was not deleted when you decreased the number of replicas, the data in the database has not changed.
 - Database running in the 
norepsample-1Pod:kubectl exec -it norepsample-1 -c tt -- /bin/bash [timesten@norepsample-1 ~]$ ttIsql norepsample Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=norepsample"; Connection successful: DSN=norepsample;UID=timesten;DataStore=/tt/home/timesten/datastore/norepsample;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;AutoCreate=0;PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1; (Default setting AutoCommit=1) Command> tables; 0 tables found. Command> exit Disconnecting... Done. [timesten@norepsample-1 ~]$ exit exitThe TimesTen Operator correctly provisions TimesTen in the
norepsample-1Pod and has correctly overwritten the original database. - Database running in the 
norepsample-2Pod:kubectl exec -it norepsample-2 -c tt -- /bin/bash [timesten@norepsample-2 ~]$ ttIsql norepsample Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved. Type ? or "help" for help, type "exit" to quit ttIsql. connect "DSN=norepsample"; Connection successful: DSN=norepsample;UID=timesten;DataStore=/tt/home/timesten/datastore/norepsample;DatabaseCharacterSet=AL32UTF8;ConnectionCharacterSet=US7ASCII;AutoCreate=0;PermSize=200;DDLReplicationLevel=3;ForceDisconnectEnabled=1; (Default setting AutoCommit=1) Command> tables; 0 tables found. Command> exit Disconnecting... Done. [timesten@norepsample-2 ~]$ exit exitThe TimesTen Operator correctly provisions TimesTen in the
norepsample-2Pod and has correctly overwritten the original database. 
 - Database running in the