You are currently viewing [SOLVED] Why Oracle database is slow in docker – 1  not obvious reason?
Photo by Fernando Maté on Unsplash
Could You Please Share This Post? I Appreciate It And Thank YOU! :) Have A Nice Day!
4.9
(726)

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)

Problem -> Why Oracle database is slow in docker?

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?)

Solution

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;

Docker-Compose

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 11.2.0.2.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 11.2.0.2.0 - 64bit Production


System altered.


System altered.

SQL> Disconnected from Oracle 11g Express Edition Release 11.2.0.2.0 - 64bit Production
Could You Please Share This Post? 
I appreciate It And Thank YOU! :)
Have A Nice Day!

BigData-ETL: image 7YOU MIGHT ALSO LIKE

How useful was this post?

Click on a star to rate it!

Average rating 4.9 / 5. Vote count: 726

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?