Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORACLE_PDB being overwritten for 23ai Free #2853

Open
cmdkeen opened this issue Aug 27, 2024 · 4 comments
Open

ORACLE_PDB being overwritten for 23ai Free #2853

cmdkeen opened this issue Aug 27, 2024 · 4 comments
Assignees
Labels

Comments

@cmdkeen
Copy link

cmdkeen commented Aug 27, 2024

Hi,

I'm running into a problem trying to customise the PDB being created in the 23ai Free image. The documentation says the ORACLE_PDB environment variable can be used to customise this, but when set it is ignored and FREEPDB1 created. I think this is due to this block overwriting any passed value. Line 214 later on handles the default value, so could the export below could potentially be removed?

# Sanitizing env for FREE
if [ "${ORACLE_SID}" = "FREE" ]; then
   export ORACLE_PDB="FREEPDB1"
   unset DG_OBSERVER_ONLY CLONE_DB STANDBY_DB
fi
@oraclesean
Copy link
Contributor

The CDB and PDB names for the 23ai Free Edition are fixed in the RPM and can't be customized when starting the container. You could work around this (if you really wanted to) by editing /etc/init.d/oracle-free-23ai and changing the fixed values for SID and PDB. You'd need to perform this operation during image creation since the file is owned by root and can't be edited from the container (which would be running as the oracle user). You could accomplish this by adding something like this to the image build, which will update the file to read the SID/PDB from the environment:

sed -i -e 's/^export ORACLE_SID=FREE$/export ORACLE_SID=\$ORACLE_SID/' -e 's/^export PDB_NAME=FREEPDB1$/export PDB_NAME=\$PDB_NAME/' oracle-free-23c

This section of my repo does something similar and might work to give you an idea of how to accomplish this:
https://github.com/oraclesean/cloud-native-oracle/blob/c7b6143586d1dae957e3018733c28409014488bc/manageOracle.sh#L429C1-L474C7
In this example, it's updating directories like ORACLE_HOME and ORACLE_BASE that are fixed in the 11g/19c RPM.

Optionally, you could docker exec -u root -it <CONTAINER_NAME> bash (or perhaps run the above sed command directly as root) and edit the file, then recreate the database after container startup.

Disclaimer: I didn't test this, so no guarantees, and IDK if this violates any license agreements. YMMV, caveat emptor, proceed at your own risk, etc. 😄

@cmdkeen
Copy link
Author

cmdkeen commented Aug 27, 2024

Thanks Sean - that seems to not line up with the container docs and what I'm seeing in the shell script for it. On the docs on the Oracle registry under "Custom Configurations" it describes this as possible.

The container entry script does have the potential to call the script to create a PDB, it's just in the linked section above the documented environment variable is being ignored. If the docs are wrong that's understandable but it would be useful to update them.

@oraclesean
Copy link
Contributor

The documentation applies to the non-23ai Free builds and probably hasn't been updated to reflect this. The code block you see is the workaround for the fixed SID/PDB names. If I recall correctly, I believe there's something similar for 11g XE and 18c XE.

@oraclesean
Copy link
Contributor

I updated the documentation to clarify the limitation in the 23ai and 11g/18c XE sections, added a note on defaults to the documentation of the ORACLE_SID and PDB_NAME parameters, and submitted a pull request. The limitation on ORACLE_SID is mentioned here but doesn't cover the PDB_NAME:

**Important Note:**
The ORACLE_SID for Oracle Database 23ai Free is always `FREE` and cannot be changed, hence there is no ORACLE_SID parameter provided for the Free build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants