-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Description
@oraclesean
I tried similar steps to modify this with 23ai image. I faced error while creating database. Can you please help.
Steps followed:
1)create directory as FREE_Database.dbc under dockerfiles/23.9.0
New FREE_Database.dbc contain compatibility as 19.0.0
2) Modify ENV section of Containerfile.free file by adding line TEMPLATE_FILE="FREE_Database.dbc" \ after CONFIG_TCPS_FILE="configTcps.sh"
ENV ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree
ORACLE_SID=FREE
INSTALL_FILE_1=$INSTALL_FILE_1
RUN_FILE="runOracle.sh"
PWD_FILE="setPassword.sh"
CREATE_DB_FILE="createDB.sh"
USER_SCRIPTS_FILE="runUserScripts.sh"
CONF_FILE="oracle-free-23ai.conf"
CHECK_SPACE_FILE="checkSpace.sh"
CHECK_DB_FILE="checkDBStatus.sh"
SETUP_LINUX_FILE="setupLinuxEnv.sh"
DECRYPT_PWD_FILE="decryptPassword.sh"
CONFIG_TCPS_FILE="configTcps.sh"
TEMPLATE_FILE="FREE_Database.dbc"
INSTALL_DIR="$HOME/install"
ORACLE_DOCKER_INSTALL="true"
CHECKPOINT_FILE_EXTN=".created"
3) In Containerfile.free file modify Copy Binaries section by adding $TEMPLATE_FILE
COPY $CHECK_SPACE_FILE $CONF_FILE $SETUP_LINUX_FILE $RUN_FILE $PWD_FILE $CHECK_DB_FILE $CREATE_DB_FILE $USER_SCRIPTS_FILE $CONFIG_TCPS_FILE $TEMPLATE_FILE $DECRYPT_PWD_FILE $INSTALL_DIR/
4) In Containerfile.freefile modify RUN command section (add below 2 lines after mv "$CONF_FILE" /etc/sysconfig/ && )
mv $TEMPLATE_FILE $ORACLE_HOME/assistants/dbca/templates/ &&
chown oracle:oinstall $ORACLE_HOME/assistants/dbca/templates/$TEMPLATE_FILE &&
When I try to create db it failed with
[WARNING] ORA-00201: control file version 23.6.0.0.0 incompatible with ORACLE version 19.0.0.0.0
ORA-00202: control file: '/opt/oracle/cfgtoollogs/dbca/dbca_work_2025-08-20_11-33-39PM_126/tempControl.ctl'
@hohwille so happy that worked for you and glad I could help speed up your troubleshooting effort!
rpm-based installations work a bit differently than those in a normal container environment because they run asrootthrough an init process, rather than as theoracleuser. That means they also bypass some of the automation and customization present in images for "regular" editions. If you only needed to change theaudit*parameters, you could edit the contents of$ORACLE_HOME/assistants/dbca/templates/XE_Database.dbcand add/modify lines there.Changing
compatiblecan't be done that way. When the DBCA runs, it's not really creating a new database; rather, it restores a database from theXE_Seed_Database.[ctl|dfb](controlfile + database) files in that sametemplatesdirectory. The template control file is generated from a 21c database. You can't make it "less" compatible than the current version.The post you mentioned talks about creating a fresh database from scratch, but Connor only showed how to do that through the GUI installer. I figured out how to get this working through a
-silentinstall. Here's the quick, dirty method:
- Create a file in the
dockerfiles/21.3.0directory calledXE_Database.dbc. I included the parameters you wanted to set in theinitParamssection. I also updated thecontrol_filesparameter to generate a single control file rather than putting one copy under theoradatavolume and another in a container directory. (Normally, you'd multiplex the control files under different directories. For this purpose, it's not beneficial and would prevent you from using the contents of theoradatadirectory as a gold image.):<DatabaseTemplate name="XE Database" description=" " version="21.0.0.0.0"> <CommonAttributes> <option name="OMS" value="true" includeInPDBs="true"/> <option name="JSERVER" value="true" includeInPDBs="true"/> <option name="SPATIAL" value="true" includeInPDBs="true"/> <option name="IMEDIA" value="true" includeInPDBs="true"/> <option name="ORACLE_TEXT" value="true" includeInPDBs="true"> <tablespace id="SYSAUX"/> </option> <option name="SAMPLE_SCHEMA" value="false" includeInPDBs="false"/> <option name="CWMLITE" value="true" includeInPDBs="true"> <tablespace id="SYSAUX"/> </option> <option name="DV" value="true" includeInPDBs="true"/> </CommonAttributes> <Variables/> <CustomScripts Execute="false"/> <InitParamAttributes> <InitParams> <initParam name="audit_file_dest" value="{ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump"/> <initParam name="audit_sys_operations" value="false"/> <initParam name="audit_trail" value="none"/> <initParam name="compatible" value="19.0.0"/> <initParam name="control_files" value="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl"/> <initParam name="db_block_size" value="8" unit="KB"/> <initParam name="db_name" value=""/> <initParam name="diagnostic_dest" value="{ORACLE_BASE}"/> <initParam name="dispatchers" value="(PROTOCOL=TCP) (SERVICE={SID}XDB)"/> <initParam name="open_cursors" value="300"/> <initParam name="pga_aggregate_target" value="512" unit="MB"/> <initParam name="remote_login_passwordfile" value="EXCLUSIVE"/> <initParam name="sga_target" value="1536" unit="MB"/> <initParam name="undo_tablespace" value="UNDO"/> </InitParams> <MiscParams> <databaseType>MULTIPURPOSE</databaseType> <maxUserConn>20</maxUserConn> <percentageMemTOSGA>0</percentageMemTOSGA> <customSGA>false</customSGA> <dataVaultEnabled>false</dataVaultEnabled> <archiveLogMode>false</archiveLogMode> <initParamFileName>{ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/pfile/init.ora</initParamFileName> </MiscParams> <SPfile useSPFile="true">{ORACLE_HOME}/dbs/spfile{SID}.ora</SPfile> </InitParamAttributes> <StorageAttributes> <ControlfileAttributes id="Controlfile"> <maxDatafiles>100</maxDatafiles> <maxLogfiles>16</maxLogfiles> <maxLogMembers>3</maxLogMembers> <maxLogHistory>1</maxLogHistory> <maxInstances>8</maxInstances> <image name="control01.ctl" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/> <image name="control02.ctl" filepath="{ORACLE_BASE}/oradata/fast_recovery_area/{DB_UNIQUE_NAME}/"/> </ControlfileAttributes> <DatafileAttributes id="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/sysaux01.dbf"> <tablespace>SYSAUX</tablespace> <temporary>false</temporary> <online>true</online> <status>0</status> <size unit="MB">460</size> <reuse>true</reuse> <autoExtend>true</autoExtend> <increment unit="KB">10240</increment> <maxSize unit="MB">-1</maxSize> </DatafileAttributes> <DatafileAttributes id="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/system01.dbf"> <tablespace>SYSTEM</tablespace> <temporary>false</temporary> <online>true</online> <status>0</status> <size unit="MB">700</size> <reuse>true</reuse> <autoExtend>true</autoExtend> <increment unit="KB">10240</increment> <maxSize unit="MB">-1</maxSize> </DatafileAttributes> <DatafileAttributes id="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/undotbs01.dbf"> <tablespace>UNDO</tablespace> <temporary>false</temporary> <online>true</online> <status>0</status> <size unit="MB">25</size> <reuse>true</reuse> <autoExtend>true</autoExtend> <increment unit="KB">5120</increment> <maxSize unit="MB">-1</maxSize> </DatafileAttributes> <DatafileAttributes id="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/users01.dbf"> <tablespace>USERS</tablespace> <temporary>false</temporary> <online>true</online> <status>0</status> <size unit="MB">5</size> <reuse>true</reuse> <autoExtend>true</autoExtend> <increment unit="KB">1280</increment> <maxSize unit="MB">-1</maxSize> </DatafileAttributes> <DatafileAttributes id="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/temp01.dbf"> <tablespace>TEMP</tablespace> <temporary>false</temporary> <online>true</online> <status>0</status> <size unit="MB">20</size> <reuse>true</reuse> <autoExtend>true</autoExtend> <increment unit="KB">640</increment> <maxSize unit="MB">-1</maxSize> </DatafileAttributes> <TablespaceAttributes id="SYSAUX"> <online>true</online> <offlineMode>1</offlineMode> <readOnly>false</readOnly> <temporary>false</temporary> <defaultTemp>false</defaultTemp> <undo>false</undo> <local>true</local> <blockSize>-1</blockSize> <allocation>1</allocation> <uniAllocSize unit="KB">-1</uniAllocSize> <initSize unit="KB">64</initSize> <increment unit="KB">64</increment> <incrementPercent>50</incrementPercent> <minExtends>1</minExtends> <maxExtends>4096</maxExtends> <minExtendsSize unit="KB">64</minExtendsSize> <logging>true</logging> <recoverable>false</recoverable> <maxFreeSpace>0</maxFreeSpace> <bigfile>false</bigfile> <datafilesList> <TablespaceDatafileAttributes id="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/sysaux01.dbf"/> </datafilesList> </TablespaceAttributes> <TablespaceAttributes id="SYSTEM"> <online>true</online> <offlineMode>1</offlineMode> <readOnly>false</readOnly> <temporary>false</temporary> <defaultTemp>false</defaultTemp> <undo>false</undo> <local>true</local> <blockSize>-1</blockSize> <allocation>3</allocation> <uniAllocSize unit="KB">-1</uniAllocSize> <initSize unit="KB">64</initSize> <increment unit="KB">64</increment> <incrementPercent>50</incrementPercent> <minExtends>1</minExtends> <maxExtends>-1</maxExtends> <minExtendsSize unit="KB">64</minExtendsSize> <logging>true</logging> <recoverable>false</recoverable> <maxFreeSpace>0</maxFreeSpace> <bigfile>false</bigfile> <datafilesList> <TablespaceDatafileAttributes id="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/system01.dbf"/> </datafilesList> </TablespaceAttributes> <TablespaceAttributes id="UNDO"> <online>true</online> <offlineMode>1</offlineMode> <readOnly>false</readOnly> <temporary>false</temporary> <defaultTemp>false</defaultTemp> <undo>true</undo> <local>true</local> <blockSize>-1</blockSize> <allocation>1</allocation> <uniAllocSize unit="KB">-1</uniAllocSize> <initSize unit="KB">512</initSize> <increment unit="KB">512</increment> <incrementPercent>50</incrementPercent> <minExtends>8</minExtends> <maxExtends>4096</maxExtends> <minExtendsSize unit="KB">512</minExtendsSize> <logging>true</logging> <recoverable>false</recoverable> <maxFreeSpace>0</maxFreeSpace> <bigfile>false</bigfile> <datafilesList> <TablespaceDatafileAttributes id="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/undotbs01.dbf"/> </datafilesList> </TablespaceAttributes> <TablespaceAttributes id="USERS"> <online>true</online> <offlineMode>1</offlineMode> <readOnly>false</readOnly> <temporary>false</temporary> <defaultTemp>false</defaultTemp> <undo>false</undo> <local>true</local> <blockSize>-1</blockSize> <allocation>1</allocation> <uniAllocSize unit="KB">-1</uniAllocSize> <initSize unit="KB">128</initSize> <increment unit="KB">128</increment> <incrementPercent>0</incrementPercent> <minExtends>1</minExtends> <maxExtends>4096</maxExtends> <minExtendsSize unit="KB">128</minExtendsSize> <logging>true</logging> <recoverable>false</recoverable> <maxFreeSpace>0</maxFreeSpace> <bigfile>false</bigfile> <datafilesList> <TablespaceDatafileAttributes id="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/users01.dbf"/> </datafilesList> </TablespaceAttributes> <TablespaceAttributes id="TEMP"> <online>true</online> <offlineMode>1</offlineMode> <readOnly>false</readOnly> <temporary>true</temporary> <defaultTemp>true</defaultTemp> <undo>false</undo> <local>true</local> <blockSize>-1</blockSize> <allocation>1</allocation> <uniAllocSize unit="KB">-1</uniAllocSize> <initSize unit="KB">64</initSize> <increment unit="KB">64</increment> <incrementPercent>0</incrementPercent> <minExtends>1</minExtends> <maxExtends>0</maxExtends> <minExtendsSize unit="KB">64</minExtendsSize> <logging>true</logging> <recoverable>false</recoverable> <maxFreeSpace>0</maxFreeSpace> <bigfile>false</bigfile> <datafilesList> <TablespaceDatafileAttributes id="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/temp01.dbf"/> </datafilesList> </TablespaceAttributes> <RedoLogGroupAttributes id="1"> <reuse>false</reuse> <fileSize unit="KB">204800</fileSize> <Thread>1</Thread> <member ordinal="0" memberName="redo01.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/> </RedoLogGroupAttributes> <RedoLogGroupAttributes id="2"> <reuse>false</reuse> <fileSize unit="KB">204800</fileSize> <Thread>1</Thread> <member ordinal="0" memberName="redo02.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/> </RedoLogGroupAttributes> <RedoLogGroupAttributes id="3"> <reuse>false</reuse> <fileSize unit="KB">204800</fileSize> <Thread>1</Thread> <member ordinal="0" memberName="redo03.log" filepath="{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/"/> </RedoLogGroupAttributes> </StorageAttributes> </DatabaseTemplate>
- In Dockerfile.xe, update the
ENVcommand to include the name of the template:ENV ORACLE_BASE=/opt/oracle \ ORACLE_HOME=/opt/oracle/product/21c/dbhomeXE \ ORACLE_BASE_HOME=/opt/oracle/homes/OraDBHome21cXE \ ORACLE_SID=XE \ INSTALL_FILE_1="https://download.oracle.com/otn-pub/otn_software/db-express/oracle-database-xe-21c-1.0-1.ol7.x86_64.rpm" \ RUN_FILE="runOracle.sh" \ PWD_FILE="setPassword.sh" \ CREATE_DB_FILE="createDB.sh" \ USER_SCRIPTS_FILE="runUserScripts.sh" \ CONF_FILE="oracle-xe-21c.conf" \ CHECK_SPACE_FILE="checkSpace.sh" \ CHECK_DB_FILE="checkDBStatus.sh" \ SETUP_LINUX_FILE="setupLinuxEnv.sh" \ CONFIG_TCPS_FILE="configTcps.sh" \ TEMPLATE_FILE="XE_Database.dbc" \ INSTALL_DIR="$HOME/install" \ ORACLE_DOCKER_INSTALL="true" \ CHECKPOINT_FILE_EXTN=".created"
- In Dockerfile.xe, add that file to the
COPYcommand that's placing files in the$INSTALL_DIR:COPY $CHECK_SPACE_FILE $CONF_FILE $SETUP_LINUX_FILE $RUN_FILE $PWD_FILE $CHECK_DB_FILE $CREATE_DB_FILE $USER_SCRIPTS_FILE $CONFIG_TCPS_FILE $TEMPLATE_FILE $INSTALL_DIR/
- In Dockerfile.xe, update the
RUNcommand to read:RUN cd $INSTALL_DIR && \ mkdir -p $ORACLE_BASE && \ mv $RUN_FILE $PWD_FILE $CHECK_DB_FILE $CREATE_DB_FILE $USER_SCRIPTS_FILE $CONFIG_TCPS_FILE $ORACLE_BASE/ && \ chmod ug+x *.sh && \ sync && \ ./$CHECK_SPACE_FILE && \ yum -y install expect && \ ./$SETUP_LINUX_FILE && \ chown -R oracle:oinstall $ORACLE_BASE /home/oracle && \ sed -i -r 's/(^session\s+include\s+system-auth)/# \1/' /etc/pam.d/su && \ unbuffer yum -y install $INSTALL_FILE_1 && \ yum -y remove expect && \ rm -rf /var/cache/yum && \ rm -rf /var/tmp/yum-* && \ mv $CONF_FILE /etc/sysconfig/ && \ mv $TEMPLATE_FILE $ORACLE_HOME/assistants/dbca/templates/ && \ chown oracle:install $ORACLE_HOME/assistants/dbca/templates/$TEMPLATE_FILE && \ cd $HOME && \ rm -rf $INSTALL_DIR && \ $ORACLE_BASE/oraInventory/orainstRoot.sh && \ $ORACLE_HOME/root.sh && \ echo 'export ORACLE_SID=XE' > .bashrcThen, rebuild the image and then run it normally. The downside of this is that you're no longer using the pre-built seed database files, so database creation takes a longer. If you don't need to change
compatible, you can get away with modifying theinitParamssection of the defaultXE_Database.dbctemplate.I realize this doesn't lend the same flexibility as passing an environment variable, but I sense this is more of a specific/one-off need than something you're mobilizing to a build pipeline. LMK if that's not the case and I'll pull together something more flexible for you.
Originally posted by @oraclesean in #2722