Table of Contents
- 1 Introduction
- 2 Prerequisites
- 3 Step 1: Install Docker
- 4 Step 2: Download the Oracle 19c Docker Image
- 5 Step 3: Create and Run the Oracle 19c Docker Container
- 6 Step 4: Accessing Oracle 19c in the Docker Container
- 7 Step 5: Configuring Persistent Storage
- 8 Step 6: Configuring Networking for Oracle 19c Docker Container
- 9 Step 7: Performance Tuning for Oracle 19c on Docker
- 10 Common Issues and Troubleshooting
- 11 Frequently Asked Questions (FAQ)
- 12 Conclusion
Introduction
Oracle 19c, the latest long-term release of Oracle’s relational database, is widely used in enterprise settings. Docker, known for its containerized architecture, allows you to deploy Oracle 19c in an isolated environment, making it easier to set up, manage, and maintain databases. This deep guide covers the entire process, from installing Docker to advanced configurations for Oracle 19c, providing insights into securing, backing up, and optimizing your database environment for both development and production needs.
This guide caters to various expertise levels, giving an overview of both the fundamentals and advanced configurations such as persistent storage, networking, and performance tuning. By following along, you’ll gain an in-depth understanding of how to deploy and manage Oracle 19c on Docker efficiently.
Prerequisites
Before getting started, ensure the following:
- Operating System: A Linux-based OS, Windows, or macOS (Linux is recommended for production).
- Docker: Docker Engine version 19.03 or later.
- Hardware: Minimum 4GB RAM, 20GB free disk space.
- Oracle Account: For accessing Oracle 19c Docker images from the Oracle Container Registry.
- Database Knowledge: Familiarity with Oracle Database basics and Docker commands.
Step 1: Install Docker
If Docker isn’t installed on your system, follow these instructions based on your OS:
- Linux: Follow the official Docker installation guide for Linux.
- Windows: Install Docker Desktop for Windows.
- macOS: Install Docker Desktop for macOS.
After installation, verify Docker is working by running:
docker --version
You should see your Docker version if the installation was successful.
Step 2: Download the Oracle 19c Docker Image
Oracle maintains official images on the Oracle Container Registry, but they require an Oracle account for access. Alternatively, community-maintained images are available on Docker Hub.
- Create an Oracle account if you haven’t already.
- Log in to the Oracle Container Registry at https://container-registry.oracle.com.
- Locate the Oracle Database 19c image and accept the licensing terms.
- Pull the Docker image:
docker pull container-registry.oracle.com/database/enterprise:19.3.0
Alternatively, if you prefer a community-maintained image, you can use:
docker pull gvenzl/oracle-free:19c
Step 3: Create and Run the Oracle 19c Docker Container
To initialize the Oracle 19c Docker container, use the following command:
docker run -d --name oracle19c \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_PWD=YourSecurePassword \
container-registry.oracle.com/database/enterprise:19.3.0
Replace YourSecurePassword
with a secure password.
Explanation of Parameters
-d
: Runs the container in the background (detached mode).--name oracle19c
: Names the container “oracle19c” for easy reference.-p 1521:1521 -p 5500:5500
: Maps the container ports to host ports.-e ORACLE_PWD=YourSecurePassword
: Sets the Oracle administrative password.
To confirm the container is running, execute:
docker ps
Step 4: Accessing Oracle 19c in the Docker Container
Connect to Oracle 19c using SQLPlus or Oracle SQL Developer. To use SQLPlus from within the container:
- Open a new terminal.
- Run the following command to access the container shell:
docker exec -it oracle19c bash
- Connect to Oracle as the
SYS
user:sqlplus sys/YourSecurePassword@localhost:1521/ORCLCDB as sysdba
Replace YourSecurePassword
with the password set during container creation.
Step 5: Configuring Persistent Storage
Docker containers are ephemeral, meaning data is lost if the container is removed. Setting up a Docker volume ensures data persistence.
Creating a Docker Volume
- Stop the container if it’s running:
docker stop oracle19c
- Create a persistent volume:
docker volume create oracle19c_data
- Run the container with volume mounted:
docker run -d --name oracle19c \ -p 1521:1521 -p 5500:5500 \ -e ORACLE_PWD=YourSecurePassword \ -v oracle19c_data:/opt/oracle/oradata \ container-registry.oracle.com/database/enterprise:19.3.0
Mounting the volume at /opt/oracle/oradata
ensures data persists outside the container.
Step 6: Configuring Networking for Oracle 19c Docker Container
For more complex environments, configure Docker networking to allow other containers or hosts to communicate with Oracle 19c.
- Create a custom Docker network:
docker network create oracle_network
- Run the container on this network:
docker run -d --name oracle19c \ --network oracle_network \ -p 1521:1521 -p 5500:5500 \ -e ORACLE_PWD=YourSecurePassword \ container-registry.oracle.com/database/enterprise:19.3.0
Now, other containers on the oracle_network
can connect to Oracle 19c using its container name oracle19c
as the hostname.
Step 7: Performance Tuning for Oracle 19c on Docker
Oracle databases can be resource-intensive. To optimize performance, consider adjusting the following:
Adjusting Memory and CPU Limits
Limit CPU and memory usage for your container:
docker run -d --name oracle19c \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_PWD=YourSecurePassword \
--cpus=2 --memory=4g \
container-registry.oracle.com/database/enterprise:19.3.0
Database Initialization Parameters
To customize database settings, create an init.ora
file with desired parameters (e.g., memory target). Mount the file:
docker run -d --name oracle19c \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_PWD=YourSecurePassword \
-v /path/to/init.ora:/opt/oracle/dbs/init.ora \
container-registry.oracle.com/database/enterprise:19.3.0
Common Issues and Troubleshooting
Port Conflicts
If ports 1521 or 5500 are already occupied, specify alternate ports:
docker run -d --name oracle19c -p 1522:1521 -p 5501:5500 ...
SQL*Plus Connection Errors
Check the connection string and password. Ensure the container is up and reachable.
Persistent Data Loss
Verify that you’ve set up and mounted a Docker volume correctly.
Frequently Asked Questions (FAQ)
1. Can I use Oracle 19c on Docker in production?
Yes, but consider setting up persistent storage, security measures, and regular backups.
2. What is the default Oracle 19c username?
The default administrative user is SYS
. Set its password during initial setup.
3. How do I reset the Oracle admin password?
Inside SQL*Plus, use the following command:
sqlCopy codeALTER USER SYS IDENTIFIED BY NewPassword;
Replace NewPassword
with the desired password.
4. Can I use Docker Compose with Oracle 19c?
Yes, you can configure Docker Compose for multi-container setups with Oracle 19c. Add the Oracle container as a service in your docker-compose.yml
.
Conclusion
Installing Oracle 19c on Docker offers flexibility and efficiency, especially when combined with Docker’s containerized environment. By following this guide, you’ve successfully set up Oracle 19c, configured persistent storage, customized networking, and optimized performance. This setup is ideal for development and scalable for production, provided proper security and maintenance practices.
For additional information, check out the official Docker documentation and Oracle’s container registry. Thank you for reading the DevopsRoles page!