ORACLE DATABASE on macOS m1/m2 ARM architecture

Oracle Database is not available for the new macOS X ARM architecture and therefore requires a layer of virtualization or containerization to run it over the ARM architecture.

This can be achieved either by installing a VM and using Windows or Linux.

Or we can use a Docker container.

Installing a VM is cumbersome and resource-intensive. Hence, utilize Docker.

Oracle Database on Docker does not run on ARM architecture, so we will utilize the Colima runtime to overcome this.

If you are a Mac user and wish to use Oracle databases, you can also utilize the Oracle Cloud, which is hardware-free. However, for some reason, if you wish to have it on your ARM architecture, you can follow the following steps:

Run Oracle DB Server using Docker inside Colima:

  • Check if Colima (Containers in Lima) is installed on your device.
    [Lima is aka Linux on Mac]

      colima --version
    

    OUTPUT: colima version 0.5.4

  • If it is not installed, then you can install it from Homebrew, MacPorts, and Nix. Check here for other installation options.

      # Homebrew
      brew install colima
    
      # MacPorts
      sudo port install colima
    
      # Nix
      nix-env -iA nixpkgs.colima
    

    Learn more about Colima at : https://github.com/abiosoft/colima

  • Run colima

      colima start --arch x86_64 --memory 4
    
  • Install docker if required

      brew install --cask docker
      #or
      brew install docker
    
  • Go to Docker 1. Settings -> 2. Resources -> 4. Memory, and set it to 4 GB.

  • Create a docker image
docker run -d -p 1521:1521 -e ORACLE_PASSWORD=<your_secure_pwd> -v oracle-volume:/opt/oracle/oradata gvenzl/oracle-xe
  • Check if the image is available and running.
docker container ls -a
  • Run the docker image if not running
docker start <image_id>
  • Enter the int oracle sql bash shell using the following command:
docker exec -it <image_id> bash

Now you can use this as a SQL Bash server and login to it using the following command with your secure password:

sqlplus system/your_secure_pwd@//localhost/XEPDB1

After that, you can create users and connect using the Oracle SQL Developer.

  • Stopping docker and colima

    docker stop <image_id>

    colima stop

Next time when you start the server, you only need to start Colima and run this Docker image, and your Oracle Database server will be good to go.