DEV Community

Udara Dananjaya
Udara Dananjaya

Posted on

Running Oracle 19c Database with Docker

Setting up an Oracle 19c database using Docker is straightforward, but having a detailed guide can be helpful for reference and for those new to this process. While Oracle 12c images are available on Docker Hub, Oracle now hosts newer database images, including 19c, on their GitHub repository. However, you'll still need to download the Oracle Database installation .zip files directly from Oracle's website. Additionally, patching requires an Oracle Support license and a valid login to My Oracle Support (MOS).

Steps to Set Up Oracle 19c with Docker

1. Clone the Oracle Docker Repository

Begin by cloning the Oracle Docker images repository to your local machine:

git clone https://github.com/oracle/docker-images.git  
Enter fullscreen mode Exit fullscreen mode

2. Navigate to the 19c Directory

After cloning the repository, navigate to the Oracle 19.3.0 database directory:

cd docker-images/OracleDatabase/SingleInstance/19.3.0  
Enter fullscreen mode Exit fullscreen mode

3. Copy the Installation File

Download the LINUX.X64_193000_db_home.zip file from Oracle's website and copy it to the 19.3.0 directory:

cp $HOME/Downloads/LINUX.X64_193000_db_home.zip .  
Enter fullscreen mode Exit fullscreen mode

4. Adjust the Slim Option (Optional)

To avoid issues when patching the database in the future, modify the Dockerfile in the 19.3.0 directory to disable the slim option by setting SLIMMING=false:

ARG SLIMMING=false  
Enter fullscreen mode Exit fullscreen mode

5. Build the Docker Image

Move back to the parent directory and run the buildDockerImage.sh script. Specify the version (-v) as 19.3.0 and use the enterprise edition (-e):

cd ..  
./buildDockerImage.sh -v 19.3.0 -e  
Enter fullscreen mode Exit fullscreen mode

The build process typically takes 20–30 minutes, depending on your system resources. Once complete, you'll see a "Build Complete" message.

6. Run the Oracle 19c Docker Container

Run the Docker container using the following command:

docker run --name "oracle19.3" -p 1521:1521 -p 5500:5500 \  
    -e ORACLE_PDB=orapdb1 \  
    -e ORACLE_PWD=topsecretpass \  
    -e ORACLE_MEM=3000 \  
    -v /opt/oracle/oradata:/opt/oracle/oradata \  
    -d oracle/database:19.3.0-ee  
Enter fullscreen mode Exit fullscreen mode
  • --name: The name of the container.
  • ORACLE_PDB: Name of the pluggable database.
  • ORACLE_PWD: Database password.
  • ORACLE_MEM: Memory allocated to the database (in MB).
  • -v: Mounts the volume to persist data outside the container.

The first run initializes the database, which can take some time.

7. Connect to the Database

You can connect using SQL Developer or log into the container and use sqlplus:

docker exec -it oracle19.3 /bin/bash  
ps -ef | grep pmon  
. oraenv  
sqlplus / as sysdba  
Enter fullscreen mode Exit fullscreen mode

Useful Docker Commands

Here are some commands to manage your Docker container:

  • Stop the container:
  docker container stop oracle19.3  
Enter fullscreen mode Exit fullscreen mode
  • Start the container:
  docker container start oracle19.3  
Enter fullscreen mode Exit fullscreen mode
  • List running containers:
  docker ps  
Enter fullscreen mode Exit fullscreen mode
  • List all images:
  docker images  
Enter fullscreen mode Exit fullscreen mode
  • Delete an image:
  docker image rm "image_id_here"  
Enter fullscreen mode Exit fullscreen mode

With these steps, you can efficiently set up and manage an Oracle 19c database using Docker. If you run into issues or want to explore advanced configurations, refer to the Oracle GitHub repository for more information.

Top comments (0)