Building Oracle 23ai Free on ARM64

Earlier this week, Oracle quietly released the RPM packages for Oracle 23ai Free Edition for ARM64 systems. This release is very interesting for developers using Macs with ARM processors as it allows them to create Oracle 23ai containers for their development and engineering environments. In this blog post, I’ll walk you through the steps of creating a Docker image for Oracle 23ai Free Edition on ARM64, customising the build process and dealing with common errors along the way.

New RPMs for Oracle Enterprise Linux 8 on ARM64

Oracle has introduced several RPM packages for ARM64, including:

  • oracle-database-preinstall-23ai-1.0-2.el8.aarch64.rpm
  • oracle-database-free-23ai-1.0-1.el8.aarch64.rpm
  • A client zip file: LINUX.ARM64_235000_client_home.zip

These packages are designed for Oracle Enterprise Linux 8 on ARM (aarch64) systems and can be downloaded from the official Oracle Database Free page

While these RPMs can be directly installed on an ARM-based Oracle Linux 8 system, my particular use case required creating a Docker image to streamline the development process.

Installation Options: Direct or Docker

For those who prefer to work directly on Oracle Linux 8 ARM64 systems, the RPMs can be installed using standard package management tools like dnf. However, since I often work on ARM-based MacBook Pros, I have opted to create a Docker image for better portability and easier management. This method allows me to run Oracle 23ai in isolated environments without changing my base system.

Using the Official Docker Build Script

I have my own build scripts for Oracle databases on github oehrlis/docker. However, these scripts are primarily intended for regular Oracle installations with the official Oracle Enterprise Edition releases, with options to include Release Updates (RUs) and Release Update Revisions (RURs). They offer flexibility and are typically used for full Oracle database installations, not for RPM-based installations like Oracle 23ai Free Edition. Since I didn’t want to switch my scripts to RPM packages first, I used the official Docker build scripts from Oracle available on GitHub oracle/docker-images. These scripts are maintained by Oracle and give container build files for various Oracle Database versions, including the Free Edition.

I attempted to build the image using the Containerfile.free Dockerfile, passing the URL for the ARM64 RPM package as a build parameter. Here’s the docker build command I used:

docker build -t oracle/database:23.5.0-free \
-f Containerfile.free \
--no-cache --build-arg \
INSTALL_FILE_1="https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23ai-1.0-1.el8.aarch64.rpm" .

The build process ran successfully, and I create the image. However, when I tried to run the container, I encountered issues, which I’ll cover in the next section.

Error During Container Run

After successfully building the Docker image, I attempted to run the container using the next command:

docker run --name 23aiFree \
-p 2521:1521 \
-e ORACLE_PWD=Welcome1 \
-e ORACLE_CHARACTERSET=AL32UTF8 \
-e ENABLE_ARCHIVELOG=true \
-e ENABLE_FORCE_LOGGING=true  \
-v ${DOCKER_VOLUME_BASE}/data:/opt/oracle/oradata \
oracle/database:23.5.0-free

Unfortunately, the container not create the database, displaying the error messages below:

Copying database files
8% complete
[WARNING] ORA-00443: background process "OFSD" did not start

9% complete
[FATAL] ORA-01034: The Oracle instance is not available for use.
Start the instance.

29% complete
100% complete
[FATAL] ORA-01034: The Oracle instance is not available for use.
Start the instance.

7% complete
0% complete
Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log"
for further details.

When examining the alert log and trace files, I found that certain required packets were missing. For example, you can find this error:

kgslaInitCtx: skgdllOpen /opt/oracle/product/23ai/dbhomeFree/lib/libora_netlib.so
OS error: 79 Error message: Cannot access a needed shared library
OtherInfo: libgfortran.so.5: cannot open shared object file:
No such file or director

Fixing the Missing Packages Issue

I first try to manually fix the missing lib’s, but finally I dot change the setupLinuxEnv.sh script to include the necessary packages. Here’s what I changed:

Original script setupLinuxEnv.sh :

dnf install -y oraclelinux-developer-release-el8 && \
dnf -y install oracle-database-preinstall-23ai openssl hostname file expect

Updated script setupLinuxEnv.sh :

dnf install -y oraclelinux-developer-release-el8 && \
dnf -y install libgfortran && \
dnf -y install oracle-database-preinstall-23ai openssl hostname file expect

By adding the required libraries like libgfortran, I managed to successfully build and run the Docker image. Running the container with the same docker run command as before worked without issues.

Simplifying the Build Process with buildContainerImage.sh

To simplify the image creation process, Oracle provides a script called buildContainerImage.sh. This script automates many of the creation steps and simplifies the creation of container images.

But, when I tried to use this script with Oracle 23.5.0 Free Edition on ARM64, I encountered an error stating that only Oracle 19c Enterprise Edition was supported:

Currently only 19c Enterprise Edition is supported on
the ARM64 platform.

Tweaking the Build Script for Oracle 23ai Free

To work around this limitation, I had to change the buildContainerImage.sh script to include support for Oracle 23ai Free Edition. The original script only checked for Oracle 19c Enterprise Edition, so I updated the version check to allow Oracle 23.5.0 Free Edition.

Here is the relevant change:

Original:

if { [ "${VERSION}" == "19.3.0" ] && [ "${ENTERPRISE}" -eq 1 ]; }; then
  BUILD_OPTS=("--build-arg" "INSTALL_FILE_1=LINUX.ARM64_1919000_db_home.zip" "${BUILD_OPTS[@]}")
else
  echo "Currently only 19c enterprise edition is supported on ARM64 platform.";
  exit 1;
fi;

Updated:

if { [ "${VERSION}" == "19.3.0" ] && [ "${ENTERPRISE}" -eq 1 ]; }; then
  BUILD_OPTS=("--build-arg" "INSTALL_FILE_1=LINUX.ARM64_1919000_db_home.zip" "${BUILD_OPTS[@]}")
elif { [ "${VERSION}" == "23.5.0" ] && [ "${FREE}" -eq 1 ]; }; then
  BUILD_OPTS=("--build-arg" "INSTALL_FILE_1=https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23ai-1.0-1.el8.aarch64.rpm" "${BUILD_OPTS[@]}")
else
  echo "Currently only 19c enterprise edition or 23ai free edition is supported on ARM64 platform.";
  exit 1;
fi;

With this change I was capable of creating the image with the script buildContainerImage.sh.

Simplifying Docker Container Use with Docker Compose

To further simplify the use of the Docker container, I have created a docker-compose.yml file. This file makes it easier to manage the container and set up its environment without having to execute lengthy docker-run commands every time.

Here is the docker-compose.yml file I created:

services:
  23aifree:
    image: ${DOCKER_USER}/${DOCKER_REPO}:23.5.0-free
    container_name: 23aifree
    hostname: 23aifree
    restart: unless-stopped
    volumes:
      - ${DOCKER_VOLUME_BASE}/data:/opt/oracle/oradata
      - ${DOCKER_VOLUME_BASE}/config/startup:/opt/oracle/scripts/startup
      - ${DOCKER_VOLUME_BASE}/config/setup:/opt/oracle/scripts/setup
    ports:
      - 2521:1521
    environment:
      ORACLE_CHARACTERSET: AL32UTF8
      ENABLE_ARCHIVELOG: true
      ENABLE_FORCE_LOGGING: true

Explanation of the docker-compose.yml File:

  • Image: The image parameter specifies the Docker image to use. In this case, it uses the custom image built earlier (oracle/database:23.5.0-free).
  • Volumes: The volumes section mounts host directories to specific paths within the container:
  • /opt/oracle/oradata is where the database data will be stored.
  • /opt/oracle/scripts/startup is where you can place scripts to be executed on container startup.
  • /opt/oracle/scripts/setup is for setup scripts that run during container creation.
  • Ports: This section exposes port 2521 on the host, mapping it to port 1521 inside the container (the default Oracle listener port).
  • Environment Variables:
  • ORACLE_CHARACTERSET=AL32UTF8 sets the character set for the database.
  • ENABLE_ARCHIVELOG=true enables archive logging.
  • ENABLE_FORCE_LOGGING=true ensures that all operations are logged, useful for recovery scenarios.

More information on GitHub oracle/docker-images

Running the Container with Docker Compose

Once the docker-compose.yml file is created, starting the Oracle container is as simple as running the

docker-compose up -d

This command starts the container in the background using the configuration defined in the docker-compose.yml file. Docker Compose makes managing the Oracle container much easier, especially when it comes to startup configurations and persistence across system restarts.

To access the container, you can either use sqlplus, SQL Developer or the command line to work with the container or database as usual. As we have not specified a password in the Docker Compose File, we have to set it explicitly in any case. After that, nothing stands in our way of using the new ARM-based Oracle 23ai container on a Mac Book Pro.

docker exec 23aifree /opt/oracle/setPassword.sh <PASSWORD>

Conclusion

In this blog post, I showed how to quickly build and run an Oracle 23ai Free Edition container on ARM64 using Docker and Docker Compose. We went through the entire process, from downloading the RPM packages and using the official build scripts, to handling bugs and missing packages, to customising the build process with docker-compose.

While this guide provides a solution to get Oracle 23ai Free running on ARM64 systems out of the box, it is important to note that Oracle plans to adapt its build scripts in the GitHub repository oracle/docker-images to officially support Oracle 23ai on ARM64. This means that in the future you can use the official scripts directly without the need for manual changes.

This guide is intended to help Oracle DBAs and developers who want to run Oracle 23ai Free on ARM64 platforms, especially on MacBook Pros. If you are working with similar configurations or have any questions, please feel free to contact me or browse my Docker resources on GitHub oehrlis/docker.

Just One more Thing…
… the ARM64 packages also run on a Raspberry Pi 5 with enough memory. I will test this as soon as I get my hands on a Pi5.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.