Recently, when I needed a testing environment, where one of the elements was the Oracle database, I encountered a problem that caused me a lot of nerves.
When I started the Oracle 11g Express Edition (XE) database in a docker 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 database. The validation should last a maximum of a second, and in this case the response was after a few minutes.
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.
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.
pawel@pawel:~/Desktop/Blog/oracle-db$ docker logs -f oracle-db Starting Oracle Net Listener. Starting Oracle Database 11g Express Edition instance. /usr/sbin/startup.sh: running /docker-entrypoint-initdb.d/init.sql SQL*Plus: Release 188.8.131.52.0 Production on Sat Nov 30 14:20:01 2019 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Express Edition Release 184.108.40.206.0 - 64bit Production System altered. System altered. SQL> Disconnected from Oracle Database 11g Express Edition Release 220.127.116.11.0 - 64bit Production
If you enjoyed this post please add the comment below or share this post on your Facebook, Twitter, LinkedIn or another social media webpage.
Thanks in advanced!