In this short tutorial I will give you the answer to the question: why Oracle database is slow in docker? Recently, when I needed a testing environment, where one of the elements was the Oracle DB, I encountered a problem that caused me a lot of nerves. (Docker Oracle Database Unhealthy)
When I started the Oracle 11g Express Edition (XE) database in a container and tried to create a Kafka Connect connector for this database, it turned out that the connection configuration validator could be said to have crashed (I thought at the beginning), but it just turned out waited a long time for a response from the Oracle DB. The validation should last a maximum of a second, and in this case the response was after a few minutes. (why Oracle database is slow in docker?)
Because I’m not an Oracle expert, I started looking for help on the internet. I came across a comment where someone wrote that after running the container two SQL commands should be executed and everything will work as it should. These are the commands:
ALTER SYSTEM SET FILESYSTEMIO_OPTIONS=DIRECTIO SCOPE=SPFILE; ALTER SYSTEM SET DISK_ASYNCH_IO=FALSE SCOPE=SPFILE;
Below I present a ready YAML script, where the above configuration can be kept in the init.sql file in the “config” folder that will be executed during container launch. (why Oracle database is slow in docker?)
pawel@pawel:~/Desktop/Blog/oracle-db$ find . ./config ./config/init.sql ./docker-compose.yml
Contents of the docker-compose.yml file:
version: '2.1' services: oracle-db: hostname: oracle-db container_name: oracle-db image: wnameless/oracle-xe-11g-r2 volumes: - ./config:/docker-entrypoint-initdb.d ports: - "1521:1521" - "15080:8080"
We create and launch containers.
pawel@pawel:~/Desktop/Blog/oracle-db$ docker-compose up -d Creating network "oracle-db_default" with the default driver Creating oracle-db ... done
Then we check the logs from the “oracle-db” container. We see two entries in the logs: “System altered.”, Which correspond just to our two commands, which we have in the init.sql file in the “config” directory. (why Oracle database is slow in docker?)
pawel@pawel:~/Desktop/Blog/oracle-db$ docker logs -f oracle-db Starting Oracle Net Listener. Starting Oracle 11g Express Edition instance. /usr/sbin/startup.sh: running /docker-entrypoint-initdb.d/init.sql SQL*Plus: Release 18.104.22.168.0 Production on Sat Nov 30 14:20:01 2019 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle 11g Express Edition Release 22.214.171.124.0 - 64bit Production System altered. System altered. SQL> Disconnected from Oracle 11g Express Edition Release 126.96.36.199.0 - 64bit Production
Could You Please Share This Post? I appreciate It And Thank YOU! :) Have A Nice Day!
YOU MIGHT ALSO LIKE
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?