Docker install oracle 12c

#Introduction

In this tutorial, How to install oracle database in docker. Quickstart Docker install Oracle 12c.

1. Requirements

  • You need an account on Docker. Create an account here.
  • Install or update Docker on your PC

2. Oracle Database 12c Docker Image

Oracle Database Enterprise Edition 12c is available as an image in Docker Store.

The following figures show the checkout

Docker install oracle 12c image
Docker install oracle 12c image 2
Docker install oracle 12c images 3

3. Docker install oracle 12c

How to start an Oracle Database Server instance.

  • Docker login
  • Pull Oracle Database Enterprise Edition 12.2.0.1
  • Run Docker container from image

The command line as below

$ docker login
$ docker pull store/oracle/database-enterprise:12.2.0.1
$ mkdir ~/oracle-db-data
$ chmod 775 ~/oracle-db-data
$ sudo chown 54321:54322  ~/oracle-db-data
$ docker run -d -it --name oracle-db-12c \
-p 1521:1521 \
-e DB_SID=ORADEV \
-e DB_PDB=ORADEVPDB \
-e DB_DOMAIN=oracledb.devopsroles.local \
-v ~/oracle-db-data:/ORCL \
store/oracle/database-enterprise:12.2.0.1

I created oracle-db-data directory on the host system for data volume. This data volume is mounted inside the container at /ORCL

  • Container name oracle-db-12c
  • Host port 1521 and Guest port 1521
  • Environment variable:

Set the SID to ORADEV

Set the PDB to ORADEVPDB

Set the DB Domain to oracledb.devopsroles.local

The output terminal is as below:

vagrant@devopsroles:~$ docker login
Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
Username: your_account
Password:

Login Succeeded

vagrant@devopsroles:~$ docker pull store/oracle/database-enterprise:12.2.0.1
12.2.0.1: Pulling from store/oracle/database-enterprise
4ce27fe12c04: Pull complete
9d3556e8e792: Pull complete
fc60a1a28025: Pull complete
0c32e4ed872e: Pull complete
b465d9b6e399: Pull complete
Digest: sha256:40760ac70dba2c4c70d0c542e42e082e8b04d9040d91688d63f728af764a2f5d
Status: Downloaded newer image for store/oracle/database-enterprise:12.2.0.1
docker.io/store/oracle/database-enterprise:12.2.0.1

vagrant@devopsroles:~$ mkdir ~/oracle-db-data
vagrant@devopsroles:~$ chmod 775 ~/oracle-db-data
vagrant@devopsroles:~$ sudo chown 54321:54322  ~/oracle-db-data

vagrant@devopsroles:~$ docker run -d -it --name oracle-db-12c \
> -p 1521:1521 \
> -e DB_SID=ORADEV \
> -e DB_PDB=ORADEVPDB \
> -e DB_DOMAIN=oracledb.devopsroles.local \
> -v ~/oracle-db-data:/ORCL \
> store/oracle/database-enterprise:12.2.0.1
7589a72bb9794d6408eb4b635772b22bc3e711210d3e4422ab0dce639a439c4a

You can check and monitor the container with the command lines below:

$ docker logs -f oracle-db-12c
$ docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}' -f name=oracle-db-12c

4. Oracle Database Setup

The default password to connect to the database with the sys user is Oradoc_db1. Check the character set which should be AL32UTF8

docker exec -it oracle-db-12c bash -c "source /home/oracle/.bashrc; sqlplus /nolog"

SQL> connect sys/Oradoc_db1@ORADEV as sysdba
SQL> alter session set container=ORADEVPDB;
SQL> show parameters db_block_size;
SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
Docker install oracle 12c query

Create data and temp tablespace

SQL> 
--Create tablespace for new devopsroles Project 
CREATE TABLESPACE huupv_devopsroles_data DATAFILE '/u01/app/oracle/product/12.2.0/dbhome_1/data/huupv_devopsroles_data.db' SIZE 64M AUTOEXTEND ON NEXT 32M MAXSIZE 4096M EXTENT MANAGEMENT LOCAL;
 
--Create temp tablespace for new devopsroles Project
CREATE TEMPORARY TABLESPACE huupv_devopsroles_temp TEMPFILE '/u01/app/oracle/product/12.2.0/dbhome_1/data/huupv_devopsroles_temp.db' SIZE 64M  AUTOEXTEND ON NEXT 32M MAXSIZE 4096M EXTENT MANAGEMENT LOCAL;
  • Do not start with too large an initial size, because it can waste space.
  • Use a single block size (8K) for the whole DB
  • Do not allow individual data files to grow large (beyond 8-10Gb)

Create user and assign grant

SQL> 
--Create user for devopsroles schema
CREATE USER huupv_devopsroles IDENTIFIED BY huupv_devopsroles DEFAULT TABLESPACE huupv_devopsroles_data TEMPORARY TABLESPACE huupv_devopsroles_temp PROFILE default ACCOUNT UNLOCK;
 
--Assign grant to user 
GRANT CONNECT TO huupv_devopsroles;
GRANT RESOURCE TO huupv_devopsroles;
GRANT UNLIMITED TABLESPACE TO huupv_devopsroles;

Test to the new scheme using a tool such as Oracle SQLDeveloper

The parameters to connect to the new scheme are:

  • Username/password: huupv_devopsroles/huupv_devopsroles
  • Hostname: 192.168.3.7
  • Service Name: ORADEVPDB.oracledb.devopsroles.local
Docker install oracle 12c login
Docker install oracle 12c devopsroles.com

Via youtube

Conclusions

You use Docker install oracle 12c. oracle 12c docker install. I hope will this your helpful. Thank you for reading the DevopsRoles page!

, ,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published.

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.