Skip to main content

Command Palette

Search for a command to run...

ORACLE DATABASE on macOS m1/m2 ARM architecture

Updated
2 min read

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.

S
Sir Madz2y ago

After I followed the tutorial you gave, I was able to make a connection in SQL Developer, but the next day when I tried again in the terminal it still worked, but when I tried to continue my work the previous day in SQL Developer, an error occurred in the connection, but in the terminal there was no error. Please help

K

It is a very subjective matter, maybe a screenshot of the error could help to better understand if there is a connection problem.

I

hello, how i want to connect the database with my eclipse?

K

I am not very familiar with Eclipse but I am providing some additional details then you might be able to connect.

Screenshot 2023-05-05 at 9.47.27 PM.png

The username will be "system". The password will be the password you set in the docker run command.

The host will be "localhost"

The port will be 1521

The service name will be "XEPDB1"

You can also create a user using SQL shell for Eclipse:

docker exec -it <image_ID> bash

sqlplus system/<yourPassword>//localhost/XEPDB1

create user <newName> identified by <userPass> default tablespace users;

And then give privileges to this user.

A

fantastic!

1