Oracle on ARM, Mac M1/M2 Docker images
On June 8 Oracle announce Oracle Database for Arm Architectures in the Cloud & On-Premises which means that Oracle RDBMS 19c not only will runs on great server processors such as Ampere/Graviton it also run on Mac with M1/M2 processor without Docker emulation.
This post is about how to make a Mac M1/M2 Docker image ready for running Oracle RDBMS 19c in three flavors, full, slim and fast-start mode, that is, Mac developers using Docker Desktop will have a full performance environment for developing/testing Oracle related projects. Also as collateral efforts OCI Ampere ARM environments can be benefited by using Docker special optimized images for CI/CD pipelines.
Requirements
I am assuming that you already have latest Docker Desktop for Mac up and running, and to facilitate the operation with a minimal impact on Mac OS installation I am using VSCode Docker Desktop Extension, just download them using Extension tab:
as a post installation step add Docker support to VSCode Docker extension using a Mac terminal and this command:
~ % docker exec -ti --user root coder_embedded_dd_vm /bin/sh -c "curl -s https://raw.githubusercontent.com/marcelo-ochoa/coder-docker-extension/main/addDocker.sh | bash"
Getting started, downloading and building full Oracle 19c EE image
Start by downloading 19c Oracle home zip from this page Oracle Database Software Downloads, select Oracle Database 19c for LINUX ARM (aarch64)
Next, open VSCode Docker Desktop Extension (new Terminal) and clone repository Docker Images from Oracle
open a Mac Terminal and copy above zip file from Download area into VSCode personal folder:
% cd Downloads
% docker cp LINUX.ARM64_1919000_db_home.zip coder_embedded_dd_vm:/home/coder/myWorkspace/docker-images/OracleDatabase/SingleInstance/dockerfiles/19.3.0
go back to VSCode, open docker-images as project Folder and a Terminal to run a build command:
$ cd OracleDatabase/SingleInstance/dockerfiles/
$ ./buildContainerImage.sh -v 19.3.0 -e
as a result, a new image will be ready at your Docker Desktop
Building Slim and Slim-Faststart docker images
These images are perfect for a typical day-to-day developer work or CI/CD automation. Gerald´s script where a perfect jump start to build a new one for 19c on ARM, just clone my GitHub repo into another folder and open it as VSCode project folder:
$ git clone -b 19c-arm-slim https://github.com/marcelo-ochoa/oci-oracle-free
$ cd oci-oracle-free
- build first slim version with:
$ docker buildx build --build-arg BUILD_MODE=SLIM -t oracle/database:19.3.0-ee-slim -f Dockerfile.193 .
- and finally build slim-faststart version
$ docker buildx build --build-arg BASE_IMAGE=oracle/database:19.3.0-ee-slim -t oracle/database:19.3.0-ee-sl
im-faststart -f Dockerfile.faststart .
Testing Oracle 19c Docker Images
Just using your Mac terminal run:
% docker run -d --name test19c -e ORACLE_PASSWORD=Oracle_2023 -e APP_USER=scott -e APP_USER_PASSWORD=tiger -p 1521:1521 oracle/database:19.3.0-ee-slim-faststart
f3345ceda6908d55978648654789431790d52d9e8efda4b177811b2983041c45
~ % docker logs -f test19c
.......
#########################
DATABASE IS READY TO USE!
#########################
##################################################################
CONTAINER: The following output is now from the alert_FREE.log file:
##################################################################
FREEPDB1(3):Undo initialization finished serial:0 start:7880788 end:7880821 diff:33 ms (0.0 seconds)
FREEPDB1(3):Database Characterset for FREEPDB1 is AL32UTF8
FREEPDB1(3):SUPLOG: Set PDB SUPLOG SGA at PDB OPEN, old 0x18, new 0x0 (no suplog)
FREEPDB1(3):Opening pdb with no Resource Manager plan active
FREEPDB1(3):joxcsys_required_dirobj_exists: directory object exists with required path /opt/oracle/product/19c/dbhome_1/javavm/admin/, pid 133 cid 3
Pluggable database FREEPDB1 opened read write
Starting background process CJQ0
2023-09-18T19:45:54.724450+00:00
CJQ0 started with pid=47, OS id=191
Completed: ALTER DATABASE OPEN
Sizes
Memory/CPU usage
Next graph shows CPU and memory usage of 19.3.0-slim image started using:
% docker run -ti --rm --name test19c -e ORACLE_PASSWORD=Oracle_2023 -e APP_USER=scott -e APP_USER_PASSWORD=tiger -p 1521:1521 oracle/database:19.3.0-ee-slim
There is an spike of 150% of CPU usage during the startup when decompressing datafiles, then no more than 100% usage due the RDBMS is limited by config to use only two CPUs and once all the scheduled tasks are finished the CPU down to zero.
Memory usage is locked to 2.7 Gb (SGA configuration) and remains at this value over time.
Performance
Startup time of slim image (includes decompress time of datafiles, around 12 seconds)
Startup time of slim-faststart image, datafiles were decompressed during build time.
I am really surprised that this small Mac M1 notebook:
is faster than a Dell Inspiron 7373 notebook with 16Gb of RAM and an Intel CPU Core i7–8550U with 512Gb M2 disk.
Extras
Once your Oracle 19c RDBMS is up and running you can install SQLcl Docker Desktop extension
or SQLDeveloper Web Docker Desktop Extension
and that’s all, happy development with your Oracle RDBMS running native on your Mac M1/M2 processors.