GithubHelp home page GithubHelp logo

Comments (3)

AmedeeBulle avatar AmedeeBulle commented on May 31, 2024 1

I went through the same path not so long ago...

If you build the container image yourself (using the Dockerfile from this repo), then it should work as documented.
The first time you start a container, the database will be expanded and the startup script will run.

However, the image on the Oracle Container Registry is slightly different: the database is already expanded in the image which makes that the startup scripts won't run when a container is instantiated.
The benefit of that is that it starts a bit faster at the expense of a larger container image (that is: the OCR image is larger than the one you would build yourself).

WRT your workaround, I would recommend to touch a file in /opt/oracle/oradata/ for persistence.
/opt/oracle/oradata/ is typically a mounted volume, while the Oracle home isn't.

@gvenzl / @IshaanDesai45, if the above is expected behavior, can we update the README on OCR to make it clear that startup scripts aren't run on the pre-built image?

from docker-images.

valtrig avatar valtrig commented on May 31, 2024

For anyone interested, as a workaround, I've actually put my database setup Bash script in /opt/oracle/scripts/startup, which is sourced every time the container starts, as it should, and in order to ensure that the setup actions in the script will execute only the first time the container runs, I just check for the existence of a dummy "database initialised" indicator file that is created by the script in the user's home directory and, if it exists, the script just exits without further actions, as shown below:

#!/usr/bin/env bash

DB_INITIALISED="/opt/oracle/oradata/dbinit"
[ -f ${DB_INITIALISED} ] && exit
touch ${DB_INITIALISED}

# Do actual database setup stuff with sqlplus from this point onwards, e.g. sourcing any additional sql scripts!

from docker-images.

valtrig avatar valtrig commented on May 31, 2024

WRT your workaround, I would recommend to touch a file in /opt/oracle/oradata/ for persistence. /opt/oracle/oradata/ is typically a mounted volume, while the Oracle home isn't.

Indeed, I've updated my comment accordingly, thanks for the tip!

from docker-images.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.