docker-images
docker-images copied to clipboard
Oracle DBCA fails in new Kubernetes environment
After successfully deploying my container in OpenShift 3.11 and k3s rancher, a new deployment in a newly created OpenShift 4.8 environment failed during the database creation, shortly after the RMAN restore from backup step. After research, I found that although I had specified 8G of RAM for the container memory resource, the DBCA had calculated an sga target of 19G, so the kernel was sending a SIGKILL to my java process running dbca. It appears that the memory query is getting the size of the host vice the container, hence the larger memory calculation. In prior deployments, the number of cores was less than 8, and the logic in createDB.sh was different. In this new environment, the number of cores was 16. The workaround I used was to define the INIT_SGA_SIZE and INIT_PGA_SIZE environment variables explicitly.
@jameshcovington Can you please attach the command you are running along with container logs for further investigation ??
@jameshcovington Can you please attach how you are specifying 8 GB memory to the container ??
specified in the deployConfig, here is a snippet:
spec:
containers:
- name: oracle
image: "oracle:latest"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 1521
protocol: TCP
- containerPort: 5500
protocol: TCP
command: ["/bin/bash"]
args: ["-c", "set -x; /opt/oracle/runOracle.sh"]
resources:
limits:
memory: 8Gi
requests:
memory: 8Gi
@jameshcovington As I can see in the OpenShift documentation, these resource limits do not restrict the memory allocated to the container. If the node has more memory available, the container will use that. Please see section 14.4..4 of the page.
It states the following:
By default, a container is able to consume as much memory on the node as possible. In order to improve placement of pods in the cluster, specify the amount of memory required for a container to run. The scheduler will then take available node memory capacity into account prior to binding your pod to a node. A container is still able to consume as much memory on the node as possible even when specifying a request.
This is the reason that DBCA is calculating larger memory. You can disable this behaviour in the following two ways:
- Using
INIT_SGA_SIZE
andINIT_PGA_SIZE
env vars, - Using
AUTO_MEM_CALCULATION
env var after setting it tofalse
.
The advantage of the first method is that you can customize the total DB memory (SGA mem + PGA mem). But, in the second case total database memory will be fixed to 2GB only.
You can also use quotas to limit the container memory in the OpenShift environment.
Hope this helps ! Please let us know in case you face any further issues. If the issue is resolved please close the issue. Thanks.