I have previously shared how to run the Oracle Database 23c FREE database on an X86 Mac using PodMan, you can find that blog post here.
But what about the newer M1/M2 Macs I here you ask ?
Well, I have just got myself and new 2023 MacBook Pro with the Apple M2 Pro ARM based chipset, so it’s time to look into running Oracle Database 23c Free on Apple M2.
Preparation
Start by installing Homebrew package manager.
brew update
% brew --version Homebrew 4.1.17
Now, install Colima container runtime and Docker if not already installed on your Mac.
brew install colima docker
% colima --version colima version 0.5.6 % docker --version Docker version 24.0.6, build ed223bc820
If we now try docker ps to check for processes, we see a docker daemon error message.
% docker ps Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Colima Container Runtime
Start Colima container runtime using the colima start command, we can use colima -help to list all available command line options.
Also, colima defaults can be edited using colima -template or passed on the command line for example.
colima start \
--arch x86_64 \
--vm-type=vz \
--vz-rosetta \
--mount-type=virtiofs \
--memory 8
Below is a list of the Colima container runtime parameters specified or left to default.
- a86_64: Architecture (aarch64, x86_64)
- vz: Virtual machine type (qemu, vz)
- vz-rosetta: Enable Rosetta for amd64 emulation
- disk: Default 60GiB
- virtiofs: Volume Mount Driver – Default virtiofs (for vz), sshfs (for qemu)
- memory: Memory default 2G
- cpu: Default 2
% colima start \ --arch x86_64 \ --vm-type=vz \ --vz-rosetta \ --mount-type=virtiofs \ --memory 8 INFO[0000] starting colima INFO[0000] runtime: docker INFO[0000] creating and starting ... context=vm INFO[0051] provisioning ... context=docker INFO[0051] starting ... context=docker INFO[0058] done
We can confirm the Colima Container Runtime configuration with colima staus and colima list, for example.
% colima status INFO[0000] colima is running using macOS Virtualization.Framework INFO[0000] arch: x86_64 INFO[0000] runtime: docker INFO[0000] mountType: virtiofs INFO[0000] socket: unix:///Users/rekins/.colima/default/docker.sock % colima list PROFILE STATUS ARCH CPUS MEMORY DISK RUNTIME ADDRESS default Running x86_64 2 8GiB 60GiB docker
Before we try and start our Oracle Database 23c Free container, let’s check for Docker processes using docker ps.
We now no longer see the Docker daemon error message.
% docker CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
We can check for existing docker images with docker images, for example.
% docker images REPOSITORY TAG IMAGE ID CREATED SIZE
The docker context show command should return colima, which means Docker runs under Colima and you can therefore use docker commands as usual.
% docker context show colima
Oracle Database 23c FREE
The Docker run command will automatically attempt to download the Oracle Database 23c Free image from the Oracle Container Registry.
However it’s also possible to pull the image advance using:
docker pull container-registry.oracle.com/database/free
% docker pull container-registry.oracle.com/database/free Using default tag: latest latest: Pulling from database/free Digest: sha256:5ac0efa9896962f6e0e91c54e23c03ae8f140cf6ed43ca09ef4354268a942882 Status: Image is up to date for container-registry.oracle.com/database/free:latest container-registry.oracle.com/database/free:latest
As we are using the Oracle Database 23c FREE release there is no need to provide Oracle SSO credentials
Use docker images, docker image ls or docker image list to list available images.
% docker images REPOSITORY TAG IMAGE ID CREATED SIZE container-registry.oracle.com/database/free latest 39cabc8e6db0 7 weeks ago 9.16GB
We can confirm source and check other details using docker image inspect, for example.
% docker image inspect container-registry.oracle.com/database/free | grep INSTALL_FILE_1 "INSTALL_FILE_1=oracle-database-free-23c-1.0-1.el8.x86_64.rpm"
To start the Oracle Database 23c Container use docker run, for example
docker run -d \
--name ora23c \
-p 1522:1521 \
--mount source=oradata,target=/opt/oracle/oradata \
container-registry.oracle.com/database/free
Example output:
% docker run -d \ --name ora23c \ -p 1522:1521 \ --mount source=oradata,target=/opt/oracle/oradata \ container-registry.oracle.com/database/free 853cba01bffac8d22797301ec48c049cb7fa196ec46c050b6b3827b4c9cdafa8
We can see the Docker process using docker ps, for example.
% docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 853cba01bffa container-registry.oracle.com/database/free "/bin/bash -c $ORACL…" 7 minutes ago Up 7 minutes (healthy) 0.0.0.0:1522->1521/tcp, :::1522->1521/tcp ora23c
Database Logs
We check check progress of the container startup with docker logs, which shows the Oracle database alert.log output.
Wait until the log shows DATABASE IS READY TO USE!
% docker logs ora23c Starting Oracle Net Listener. Oracle Net Listener started. Starting Oracle Database instance FREE. Oracle Database instance FREE started. The Oracle base remains unchanged with value /opt/oracle ######################### DATABASE IS READY TO USE! ######################### The following output is now a tail of the alert.log: : QPI: opatch file present, opatch : QPI: qopiprep.bat file present FREEPDB1(3):Autotune of undo retention is turned on. 2023-10-24T10:21:14.443631+00:00 FREEPDB1(3):Opening pdb with Resource Manager plan: DEFAULT_PLAN 2023-10-24T10:21:16.240525+00:00 Completed: Pluggable database FREEPDB1 opened read write Completed: ALTER DATABASE OPEN 2023-10-24T10:21:24.649146+00:00 =========================================================== Dumping current patch information =========================================================== No patches have been applied =========================================================== 2023-10-24T10:21:25.790135+00:00 FREEPDB1(3):Resize operation completed for file# 13, fname /opt/oracle/oradata/FREE/FREEPDB1/sysaux01.dbf, old size 317440K, new size 337920K 2023-10-24T10:27:12.829526+00:00 Resize operation completed for file# 201, fname /opt/oracle/oradata/FREE/temp01.dbf, old size 20480K, new size 86016K ...
Database Password
The Oracle 23c FREE database was created with random passwords for SYS, SYSTEM and PDBADMIN, we can reset these using the ./setPassword.sh script provided.
% docker exec -it ora23c ./setPassword.sh oracle The Oracle base remains unchanged with value /opt/oracle SQL*Plus: Release 23.0.0.0.0 - Production on Tue Oct 24 10:39:43 2023 Version 23.3.0.23.09 Copyright (c) 1982, 2023, Oracle. All rights reserved. Connected to: Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.3.0.23.09 SQL> User altered. SQL> User altered. SQL> Session altered. SQL> User altered. SQL> Disconnected from Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.3.0.23.09
Database Access
If you have an Oracle client installed on your Mac you can use that to connect to the Oracle 23c database.
Confirm the container port for the database listener using docker port, for example.
% docker port ora23c 1521/tcp -> 0.0.0.0:1522 1521/tcp -> [::]:1522
Using sqlcl with the new password, the mapped listener port and database name we can connect thus.
% sql -v SQLcl: Release 23.2.0.0 Production Build: 23.2.0.178.1029 % sql system/oracle@//localhost:1522/FREE SQLcl: Release 23.2 Production on Tue Oct 24 11:56:04 2023 Copyright (c) 1982, 2023, Oracle. All rights reserved. Last Successful login time: Tue Oct 24 2023 11:56:03 +01:00 Connected to: Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.3.0.23.09 SQL> select INSTANCE_NAME, HOST_NAME, VERSION_FULL from v$instance; INSTANCE_NAME HOST_NAME VERSION_FULL ________________ _______________ _______________ FREE 853cba01bffa 23.3.0.23.09
The FREE database come with a single Pluggable Database (PDB) called FREEPDB1, we can connect to the PDB using the same method.
% sql system/oracle@//localhost:1522/FREEPDB1 SQLcl: Release 23.2 Production on Tue Oct 24 13:08:58 2023 Copyright (c) 1982, 2023, Oracle. All rights reserved. Last Successful login time: Tue Oct 24 2023 13:08:57 +01:00 Connected to: Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.3.0.23.09 SQL> show con_name; CON_NAME ------------------------------ FREEPDB1 SQL>
Alternatively, we can access the 23c database by executing sqlplus within the container.
% docker exec -it ora23c sqlplus / as sysdba SQL*Plus: Release 23.0.0.0.0 - Production on Tue Oct 24 10:44:36 2023 Version 23.3.0.23.09 Copyright (c) 1982, 2023, Oracle. All rights reserved. Connected to: Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.3.0.23.09 SQL> select banner from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 23c Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free
Summary
In this blog post I have shown that it is possible to run the Oracle Database 23c Free version on the newer M1/M2 MacBooks.
There are defintely some performance challenges, but if you can’t wait till Oracle ships a native Oracle Database 23c ARM version to start your Oracle 23c learning journey, it may be just what you need.
Leave a Reply