Montag, 11. März 2024

Install Oracle DB docker container on Debian

Installation

Docker on Debian

docker pull container-registry.oracle.com/database/free:latest
Oracle source

To run stuff within the docker container, one must have the respective permissions. Piece of cake with

usermod -aG docker <username>

You can check with the id or the group command

Management

Sources

Start the docker container

Before you start: If you are doing this over a remote connection, make sure a window can get opened.

docker run --detach [--interactive --tty] --name oracle_db --publish 1521:1521 --publish 5500:5500 container-registry.oracle.com/database/free:latest

where

  • --detach: Run container in background and print container ID
  • --name: Assign a name to the container by which the container can be stopped or removed
  • --interactive: Keep STDIN open even if not attached
  • --tty: Allocate a pseudo-TTY
  • --publish: Publish a container's port(s) to the host, 1521 is the standard port for DB access and 5500 for the Enterprise Manager Express
  • conta…: the image name

This should issue the container ID used like d6f5a36a8d60af6a980b3acf7945efe4fa1af368f5130d04164d7c1269a8bd33; it can be used to stop/remove the container instead of the name.

Stop the docker container

docker stop oracle_db

Remove the docker container

docker rm oracle_db

Execute stuff from within the docker

docker execute --interactive --tty oracle_db <command>

e.g. docker execute --interactive --tty oracle_db /usr/bin/env bash
Unfortunately, the docker I used has no zsh installed.

Set a new SYS password

  1. Fire up a shell
    docker execute --interactive --tty oracle_db bash
  2. Fire up sqlplus as SYS
    sqlplus / as sysdba
  3. Change the password of SYS (or any other user), you might want to double quote it in the first place as there are quite of a number of characters that require that anyway.
    ALTER USER sys IDENTIFIED BY "finding_a_valid_password_is_a_pain_in_the_a";