Skip to content

Instantly share code, notes, and snippets.

@rutcreate
Created February 7, 2024 03:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rutcreate/7737ba721cd7058f75eb312a080bc446 to your computer and use it in GitHub Desktop.
Save rutcreate/7737ba721cd7058f75eb312a080bc446 to your computer and use it in GitHub Desktop.
Setup Oracle Database on Apple Silicon Chip (Docker)

Run Oracle on Apple Silicon Chip (Docker)

This is the step by step for ONLY Apple Silicon Chip.

Please see full instruction at: https://github.com/oraclesean/cloud-native-oracle

Prequisite

Clone source code

mkdir -p ~/oracle-docker && cd ~/oracle-docker
git clone https://github.com/oraclesean/cloud-native-oracle && cd cloud-native-oracle

Download Oracle Database

  • Go to download page and download Oracle Database 19c for LINUX ARM (aarch64) as ZIP file
  • Place ZIP file to `mv ~/Downloads/LINUX.ARM64_1919000_db_home.zip ~/.oracle-docker/cloud-native-oracle/database

Build docker images

./buildDBImage.sh

Prepare shell variables

CONTAINER_NAME=MYDB
ORADATA=~/oracle-docker/oradata

Create data directory and docker volumes

mkdir -p $ORADATA/scripts
for dir in audit data diag reco
do mkdir -p $ORADATA/${CONTAINER_NAME}/${dir}
    rm -fr $ORADATA/${CONTAINER_NAME}/${dir}/*
    docker volume rm ${CONTAINER_NAME}_${dir} 2>/dev/null
    docker volume create --opt type=none --opt o=bind \
        --opt device=$ORADATA/${CONTAINER_NAME}/${dir} \
        ${CONTAINER_NAME}_${dir}
done

Build docker images

docker run -d \
    --name ${CONTAINER_NAME} \
    --volume ${CONTAINER_NAME}_data:/u02/app/oracle/oradata \
    --volume ${CONTAINER_NAME}_diag:/u01/app/oracle/diag \
    --volume ${CONTAINER_NAME}_audit:/u01/app/oracle/admin \
    --volume ${CONTAINER_NAME}_reco:/u03/app/oracle \
    --volume $ORADATA/scripts:/scripts \
    -e ORACLE_SID=${CONTAINER_NAME} \
    -e ORACLE_PDB=${CONTAINER_NAME}PDB1 \
    -p 8080:8080 \
    -p 51521:1521 \
    oracle/db:19.19-EE

Monitor DB creation

docker logs -f $CONTAINER_NAME

Output will be liked:

# ----------------------------------------------------------------------------------------------- #
  Oracle password for SYS, SYSTEM and PDBADMIN: HB#K_xhkwM_O10
# ----------------------------------------------------------------------------------------------- #

...
...
...

Completed: alter pluggable database all save state

Wait until database initialization completed.

Test connection

See the first 3 lines in the logs. You will see the generated password for SYS.

# ----------------------------------------------------------------------------------------------- #
  Oracle password for SYS, SYSTEM and PDBADMIN: XXXXXXXXXXXXXXXX
# ----------------------------------------------------------------------------------------------- #

Enter to docker container.

docker exec -it $CONTAINER_NAME /bin/sh

Login to database

sqlplus SYS/XXXXXXXXXXXXXXXX@localhost:1521/MYDB as sysdba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment