How to Install Oracle Database 23ai Free Container Image on MacBook Pro

How to Install Oracle Database 23ai Free Container Image on MacBook Pro

***TLDR:***Oracle Database 23ai, rebranded from 23c, introduces over 300 new features focused on AI, development, and mission-critical data. This guide explains how to install and connect to Oracle Database 23ai using a free container image on a MacBook Pro with an Intel chip, utilising Podman for container management. The process includes setting up Podman, creating the container, and connecting to the database both inside and outside the container.

Oracle Database 23ai's general availability was announced earlier this month. It includes over 300 new features and thousands of enhancements, focusing on three key areas:

  • AI for Data

  • Dev for Data

  • Mission Critical for Data

If you're wondering about Oracle Database 23c, it has been rebranded as Oracle Database 23ai due to the significant AI technology in this release. Oracle Database 23ai is version 23.4.0.0.0 and will be referred to as such from now on.

Oracle Database 23ai - How to Access

Oracle Database 23ai can be installed or used through various options:

  1. Local System or On-Premises Machine or Any Cloud Provider VMs

    • Oracle Database 23ai Free

    • Autonomous Database 23ai Free Container Image

  2. Oracle Cloud Infrastructure - Oracle Database Managed Services

    • Oracle Database 23ai on Exadata Cloud@Customer

    • Oracle Database 23ai on Exadata Database Service

    • Oracle Database 23ai on Base Database Service

    • Oracle Database 23ai on Oracle Autonomous Database (only free tier)

  3. Microsoft Azure - Oracle Database 23ai on Exadata Database Service

Please take a look at My Oracle Support (MOS) note 742060.1 for updates on our release schedule for on-premises deployment.

In this blog, I will explain how to install Oracle Database 23c using an Oracle Database 23ai Free container image on a MacBook Pro with an Intel chip.

Create Oracle Database 23ai using Free Container Image

  1. We will use Podman to install and manage Oracle Database containers. I will install Podman Desktop using the Homebrew package manager. Open a terminal and run the following command:
brew install podman-desktop

Install the homebrew package manager in case you don't have that

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

If you're using a Mac with M1, M2, or M3 chips, you'll need to install Colima and Docker. For all the commands throughout the rest of the blog, replace every 'podman' command with 'docker'.

brew install docker
brew install docker-compose
brew install colima
brew reinstall qemu
  1. All the instructions are applicable for MacBook Pro with Intel chip and using Podman. After installing Podman, you need to create and start your first Podman machine:
podman machine init
podman machine set --cpus 4 --memory 8192
podman machine start

Modify the CPU and memory size based on your requirements

  1. Open the Podman Desktop and verify the Podman machine is running.

Podman Machine

  1. To start an Oracle Database 23ai instance, run the following command, where 23aidb is the container name. If you'd like to use a different name, please just change the container's name. I am also mapping port 1522 (the local host) to the container port (1521); this will help when connecting to the database from outside the container.
podman run -d --name 23aidb \
-p 1522:1521 \
container-registry.oracle.com/database/free:latest

Depending on the network bandwidth,pulling the container image and starting the container will take a few minutesr.

Oracle DB 23ai container

In case you want to create a database with a custom configuration, you can do that using the reference below.

podman run --name <container name> \
-P | -p <host port>:1521 \
-e ORACLE_PWD=<your database passwords> \
-e ORACLE_CHARACTERSET=<your character set> \
-e ENABLE_ARCHIVELOG=true \
-e ENABLE_FORCE_LOGGING=true \
-v [<host mount point>:]/opt/oracle/oradata \
container-registry.oracle.com/database/free:latest

Parameters:

--name: The name of the container (default: auto generated)

-P | -p: The port mapping of the host port to the container port. Only one port is exposed: 1521 (Oracle Listener)

-e ORACLE_PWD: The Oracle Database SYS, SYSTEM and PDB_ADMIN password (default: auto generated)

-e ORACLE_CHARACTERSET: The character set to use when creating the database (default: AL32UTF8)

-e ENABLE_ARCHIVELOG: To enable archive log mode when creating the database (default: false)

-e ENABLE_FORCE_LOGGING: To enable force logging mode when creating the database (default: false)

-v /opt/oracle/oradata The data volume to use for the database. Has to be writable by the Unix "oracle" (uid: 54321) user inside the container. If omitted the database will not be persisted over container recreation.

-v /opt/oracle/scripts/startup Optional: A volume with custom scripts to be run after database startup. For further details see the "Running scripts after setup and on startup" section below.

  1. Verify the container using the below command.
podman container ls

Status should show Up(healthy)

  1. During container creation, random passwords are assigned to SYS, SYSTEM and PDBADMIN users. You can change passwords for those users using the below command. Replace the container name and password.
podman exec 23aidb ./setPassword.sh m#P52sap$V

  1. You can monitor the database alert log using
podman logs 23aidb

Connect the Oracle Database 23ai

You can connect the database if the container has started and shows a 'healthy' status.

  1. Connect to the Database using any of the preferred users. Replace the container name and passwords accordingly.
podman exec -it 23aidb sqlplus sys/m#P52sap$V@FREE as sysdba
podman exec -it 23aidb sqlplus system/m#P52sap$V@FREE
podman exec -it 23aidb sqlplus pdbadmin/m#P52sap$V@FREEPDB1

I have connected to the database using sys user.

  1. If you want to connect to the database from outside the container, you can through TNS using the ports which was used during the container creation. I am using Oracle SQL Developer Command Line (SQLcl) to connect to the database. If you don't have SQLcl, you can install it using the command below or use sqlplus.
brew install sqlcl
  1. Export the SQLcl location to the PATH variable
export PATH=/usr/local/Caskroom/sqlcl/24.1.0.087.0929/sqlcl/bin:"$PATH"
  1. Connect to the database from outside the container. I have used port 1522 during the container creation, modify the port number if you have used a different one.
sql sys/m#P52sap$V@//localhost:1522/FREE as sysdba

Conclusion:

Getting started with Oracle Database 23ai using the Free container image is straightforward and allows you to leverage the latest advancements in AI, development, and mission-critical features. By following the steps outlined, you can efficiently set up and connect to Oracle Database 23ai on your MacBook Pro, enabling you to explore its robust capabilities and integrate them into your projects. Whether you're a developer, data scientist, or database administrator, Oracle Database 23ai offers powerful tools to enhance your data management and application development endeavours.

In the upcoming blogs, we will explore some of the exciting Oracle Database 23ai features. Stay tuned!

References:

  1. https://medium.com/oracledevs/run-oracle-23ai-as-a-free-autonomous-db-container-on-macbook-pro-d83a90a44906

  2. Oracle Database 23ai - https://www.oracle.com/database/23ai/

  3. Oracle Database 23ai get started- https://www.oracle.com/in/database/free/get-started/

  4. Podman - https://podman.io/