3

I want to wrtite DockerFile (from oracle-xe-11g) with copying and runing sql script.

How to correctly write a command to login sqlplus and execute sql file

written docker file

FROM sath89/oracle-xe-11g
USER root
RUN mkdir - p /home/test
RUN chown -R oracle:root /home/test
USER oracle
COPY ora.schema.sql /home/test
RUN ???????

written SQL script

CREATE USER test IDENTIFIED BY test1;
GRANT CREATE ANY SEQUENCE     TO test;
....

1 Answer 1

1

The easiest way would be adding your sql file to the /docker-entrypoint-initdb.d/ folder in the Dockerfile like this:

ADD host/path/to/your/sql/your_sql_file.sql /docker-entrypoint-initdb.d/

You don't really need anything else for this to work, the sql file will be automatically executed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.