How to setup Docker container Oracle Database 19c for Liferay Development Environment
Tags: blog, liferay, oracle, rdbms
Published: 2020-04-27 12:49:29

---
title: How to setup Docker container Oracle Database 19c for Liferay Development Environment
published: true
date: 2020-03-15 15:54:46 UTC
tags: Blog,Liferay,Oracle,RDBMS
canonical_url: https://www.dontesta.it/2020/03/15/how-to-setup-docker-container-oracle-database-19c-for-liferay-development-environment/
---


In the previous article [How to setup Docker container Oracle Database 12c for Liferay Development Environment](https://www.dontesta.it/2019/08/26/how-to-setup-docker-container-oracle-database-12c-for-liferay-development-environment/) we saw how to create an **Oracle 12c** Docker container for our Liferay Development Environment. In this article we will see how to get an **Oracle 19c** Docker container that we could later use to host the Liferay database.

The following documents (see database section) provide details of the configurations that are certified by Liferay (pay attention to support for Oracle 19c). You can see the complete documents on [Liferay Portal](https://web.liferay.com/it/services/support/compatibility-matrix).

 

[![Liferay 7.2 Compatibility Matrix Database Section](https://www.dontesta.it/wp-content/uploads/2020/03/Liferay_72_Compatibility_Matrix_Database-1024x464.png)](https://www.dontesta.it/wp-content/uploads/2020/03/Liferay_72_Compatibility_Matrix_Database.png)

Liferay 7.2 Compatibility Matrix Database Section

I also recommend reading the article [How to build a Docker Liferay 7.2 image with the Oracle Database support](https://www.dontesta.it/2019/08/21/how-to-build-a-docker-liferay-7-2-image-with-the-oracle-database-support/).

 

## 1. What are the requirements

Before proceeding with the Docker container setup, let’s see what the requirements are.

1. You need to install or update Docker on your PC. Refer to this [article](https://docs.docker.com/docker-for-windows/) for how to install Docker on Windows;
2. You must have configured Docker with at least 2 CPUs;
3. You must have configured Docker with at least 6GByte of the memory;
4. You must have configured Docker with at least 15GByte of free storage for Docker.

The docker versions on which I have successfully run the Oracle Docker container are: 17.x, 18.x and 19.x. The version of Docker Engine (Community Edition) that I will refer to in this article is  **19.03.5**  (you can check version with command `docker version`).

What is shown in this article can be performed on Windows, Unix-like operating systems. In my case I use macOS. However, always refer to the documentation of Docker and Oracle for what concerns the minimal requirements that the target system must have.

 

## 2. Oracle Database 19c Docker Image

For some years now, Oracle Database Enterprise Edition 12c is available as an image in Docker Store. Unfortunately Oracle 19c is not available on the Docker Store, but this is not a problem, **you can build the Oracle 19c Docker image yourself**.

The GitHub [oracle/docker-images](https://github.com/oracle/docker-images) repository contains everything needed to build Docker images of some of the Oracle products and in particular the [**Oracle Database**](https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance). This project on GitHub offers sample [Dockerfiles](https://docs.docker.com/engine/reference/builder/) for:

- [**Oracle Database 19c (19.3.0) Enterprise Edition and Standard Edition 2**](https://github.com/oracle/docker-images/tree/master/OracleDatabase/SingleInstance/dockerfiles/19.3.0)
- Oracle Database 18c (18.4.0) Express Edition (XE)
- Oracle Database 18c (18.3.0) Enterprise Edition and Standard Edition 2
- Oracle Database 12c Release 2 (12.2.0.2) Enterprise Edition and Standard Edition 2
- Oracle Database 12c Release 1 (12.1.0.2) Enterprise Edition and Standard Edition 2
- Oracle Database 11g Release 2 (11.2.0.2) Express Edition (XE)

The project [README](https://github.com/oracle/docker-images/blob/master/OracleDatabase/SingleInstance/README.md) contains all the information necessary for building and running the Oracle Docker image. In case you would like to know more, I invite you to read the article [Oracle Database 19c com Docker](https://www.oracle.com/technetwork/pt/articles/database-performance/oracle-db19c-com-docker-5592460-ptb.html) published by [Alex Zaballa](https://twitter.com/alexzaballa) on the [Oracle Technology Network (OTN)](https://www.oracle.com/technetwork) blog.

* * *

_Thanks to Alex Zaballa @alexzaballa for his article where he shows how to install #Docker on #macOS and create an #Oracle Database 19c Docker Image_   
[Click To Tweet](https://twitter.com/share?text=Thanks+to+Alex+Zaballa+%40alexzaballa+for+his+article+where+he+shows+how+to+install+%23Docker+on+%23macOS+and+create+an+%23Oracle+Database+19c+Docker+Image+&via=antonio_musarra&related=antonio_musarra&url=https://www.dontesta.it/2020/03/15/how-to-setup-docker-container-oracle-database-19c-for-liferay-development-environment/)

* * *

Very well! Once we get our Oracle 19c Docker image, we can go on: running the Docker image and configuring for Liferay.

[![Docker image built from the Oracle GitHub project.](https://www.dontesta.it/wp-content/uploads/2020/03/DockerImageOracle19c-1024x90.png "Docker image built from the Oracle GitHub project.")](https://www.dontesta.it/wp-content/uploads/2020/03/DockerImageOracle19c.png)

Docker image built from the Oracle GitHub project.

## 

## 3. How to starting an Oracle Database Server instance

This Oracle database server image uses [Docker data volumes](https://docs.docker.com/storage/volumes/) to store data files, redo logs, audit logs, alert logs and trace files. The data volume is mounted inside the container at **/opt/oracle/oradata**. To use a directory on the host system for the data volume and SQL Scripts, I created the **~/OracleData/19c/data** and **~/OracleData/19c/scripts/setup**  directory.

 

```
docker run -d -it --name oracledb-19c \-p 1521:1521 \-e ORACLE\_SID=ORALFRDEV \-e ORACLE\_PDB=ORALFRDEVPDB \-e ORACLE\_PWD=LwB\_27i5Wi8=1 \-v /Users/antoniomusarra/OracleData/19c/data:/opt/oracle/oradata \-v /Users/antoniomusarra/OracleData/19c/scripts/setup:/opt/oracle/scripts/setup \oracle/database:19.3.0-ee
```

 

The _docker run_ command starts the database with the following features:

1. Assign the container the name  **oracledb-19c**
2. Exposes the TCP/IP SQL Net port  **1521**
3. Through the environment variables
  1. Set the SID to **ORALFRDEV**
  2. Set the PDB to **ORALFRDEVPDB**
  3. Set sysdba password to **LwB\_27i5Wi8=1**
4. Configure volume usage
  1. **~/OracleData/19c/data:/opt/oracle/oradata** : The data volume to use for the database. Has to be writable by the Unix “oracle” (uid: 54321) user inside the container! If omitted the database will not be persisted over container recreation.
  2. **~/OracleData/19c/scripts/setup:/opt/oracle/scripts/setup** : A volume with custom scripts to be run after database setup.

Obviously you can customize the values of the start parameters to your liking, these are the ones I usually use for my development environment.

Inside the ~/OracleData/19c/scripts/setup directory are the SQL Scripts (that be run after database setup) needed to create **tablespaces** , **user** and **grants** for Liferay. Following the contents of the file **01\_liferay\_tablespace.sql** , **02\_liferay\_user.sql** , **03\_liferay\_grant\_user.sql**.

 

```
-- Change session to Pluggable DataBase (PDB)ALTER SESSION SET container = ORALFRDEVPDB;-- Create tablespace for schema Liferay 7.2 GA2CREATE TABLESPACE liferay\_dev\_72\_ga2\_data logging DATAFILE'/opt/oracle/oradata/ORALFRDEV/ORALFRDEVPDB/liferay\_dev\_72\_ga2\_data.dbf' SIZE 64mautoextend ON NEXT 32m maxsize 4096m blocksize 8k EXTENT management local;--Create temp tablespace for Liferay 7.2 GA2CREATE TEMPORARY TABLESPACE liferay\_dev\_72\_ga2\_temp tempfile '/opt/oracle/oradata/ORALFRDEV/ORALFRDEVPDB/liferay\_dev\_72\_ga2\_temp.dbf' SIZE 64m autoextend ON NEXT 32m maxsize 2048m blocksize 8k EXTENT management local;
```

 

```
-- Change session to Pluggable DataBase (PDB)ALTER SESSION SET container = ORALFRDEVPDB;-- Create user for new schema Liferay DevCREATE USER liferay\_dev IDENTIFIED BY liferay\_dev DEFAULT TABLESPACEliferay\_dev\_72\_ga2\_data TEMPORARY TABLESPACE liferay\_dev\_72\_ga2\_temp PROFILEDEFAULT account unlock;
```

 

```
-- Change session to Pluggable DataBase (PDB)ALTER SESSION SET container = ORALFRDEVPDB;-- Assign grant to Liferay UserGRANT CONNECT TO liferay\_dev;GRANT RESOURCE TO liferay\_dev;GRANT UNLIMITED TABLESPACE TO liferay\_dev;
```

In this case I created the tablespaces to host the schema for my **Liferay Portal 7.2 CE GA2** development environment. I invite you to read the article [Liferay Portal 7.2 CE GA2: Update Oracle Database Driver](https://www.dontesta.it/2020/03/08/liferay-portal-7-2-ce-ga2-update-oracle-database-driver/).

You can monitor the start of the container by viewing the logs or using the docker command below.

```
$ docker logs -f oracledb-19c$ docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}' -f name=oracledb-19c
```

The first start of the Oracle 19c container will take a few minutes because the whole database setup process must be performed. Here you could see the [Docker Container Oracle Database 19c Log](https://www.dontesta.it/wp-content/uploads/2020/03/docker-container-oracledb19c-log.txt) of the first boot. The figure below shows the output of the docker ps command. You can see the status of the container indicating that it is ready ( **healthy** ) for use and port 1521 is exported.

 

[![Checking the Oracle Docker Container Status](https://www.dontesta.it/wp-content/uploads/2020/03/DockerContainerOracleStatus-1024x86.png "Checking the Oracle Docker Container Status")](https://www.dontesta.it/wp-content/uploads/2020/03/DockerContainerOracleStatus.png)

Checking the Oracle Docker Container Status

 

The following figure shows the execution of the SQL scripts after the Oracle database setup. These scripts will not be executed on subsequent container starts.

 

[![Executing the SQL Scripts for Liferay](https://www.dontesta.it/wp-content/uploads/2020/03/ExecuteLiferaySQLScript-1024x1029.png "Executing the SQL Scripts for Liferay")](https://www.dontesta.it/wp-content/uploads/2020/03/ExecuteLiferaySQLScript.png)

Executing the SQL Scripts for Liferay

 

Following is the structure of the OracleData directory after starting the Oracle container.

```
~/OracleData/19c $ tree  ![✔](https://s.w.org/images/core/emoji/12.0.0-1/72x72/2714.png)  16:29:29  5.81G RAM  89% hdd  3.31 L  100% ![🔋](https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f50b.png).├── data│   ├── ORALFRDEV│   │   ├── ORALFRDEVPDB│   │   │   ├── liferay\_dev\_72\_ga2\_data.dbf│   │   │   ├── liferay\_dev\_72\_ga2\_temp.dbf│   │   │   ├── sysaux01.dbf│   │   │   ├── system01.dbf│   │   │   ├── temp01.dbf│   │   │   ├── undotbs01.dbf│   │   │   └── users01.dbf│   │   ├── control01.ctl│   │   ├── control02.ctl│   │   ├── pdbseed│   │   │   ├── sysaux01.dbf│   │   │   ├── system01.dbf│   │   │   ├── temp012020-03-15\_14-15-40-714-PM.dbf│   │   │   └── undotbs01.dbf│   │   ├── redo01.log│   │   ├── redo02.log│   │   ├── redo03.log│   │   ├── sysaux01.dbf│   │   ├── system01.dbf│   │   ├── temp01.dbf│   │   ├── undotbs01.dbf│   │   └── users01.dbf│   └── dbconfig│   └── ORALFRDEV│   ├── listener.ora│   ├── orapwORALFRDEV│   ├── oratab│   ├── spfileORALFRDEV.ora│   ├── sqlnet.ora│   └── tnsnames.ora└── scripts ├── setup │   ├── 01\_liferay\_tablespace.sql │   ├── 02\_liferay\_user.sql │   └── 03\_liferay\_grant\_user.sql └── startup
```

 

At this point we have our Oracle Database 19c ready to host the Liferay Portal database.

 

## 4. Connection Test

At this point we are in a position to perform a connection test to the new scheme using a tool such as [Oracle SQLDeveloper](https://www.oracle.com/it/database/technologies/appdev/sql-developer.html). The following figures show the configuration of the database connection, the view of the Liferay tables and the status of the tablespaces created for Liferay.

The parameters to connect to the new Liferay scheme are:

- Username/password: liferay\_dev/liferay\_dev
- Hostname: localhost
- Service Name: ORALFRDEVPDB

 

[![Configuring connection to the Oracle database via SQL Developer](https://www.dontesta.it/wp-content/uploads/2020/03/SQLDeveloperSetupConnectionToLiferayDatabase-1024x612.png "Configuring connection to the Oracle database via SQL Developer")](https://www.dontesta.it/wp-content/uploads/2020/03/SQLDeveloperSetupConnectionToLiferayDatabase.png)

Configuring connection to the Oracle database via SQL Developer

 

[![View Liferay Tables on Oracle Database 19c](https://www.dontesta.it/wp-content/uploads/2020/03/LiferaySchemaOnOracleDatabase19c-1-1024x242.png "View Liferay Tables on Oracle Database 19c")](https://www.dontesta.it/wp-content/uploads/2020/03/LiferaySchemaOnOracleDatabase19c-1.png)

View Liferay Tables on Oracle Database 19c

 

[![View of the Liferay Tablespace](https://www.dontesta.it/wp-content/uploads/2020/03/OracleLiferayTableSpace-1024x336.png "View of the Liferay Tablespace")](https://www.dontesta.it/wp-content/uploads/2020/03/OracleLiferayTableSpace.png)

View of the Liferay Tablespace

 

## Conclusions

In this article I wanted to show you how I usually configure my development environment when I need to have an Oracle Database to be later connected to Liferay. As you have seen, using Docker makes this all very simple and fast. Other useful resources. Do not hesitate to contact me with any questions and I hope this article has been helpful.

1. [How to build a Docker Liferay 7.2 image with the Oracle Database support](https://www.dontesta.it/en/2019/08/21/how-to-build-a-docker-liferay-7-2-image-with-the-oracle-database-support/)
2. [How to build a Docker Liferay 7.2 image with the SQL Server 2017 Database support](https://www.dontesta.it/en/2019/10/06/how-to-build-a-docker-liferay-7-2-image-with-the-sql-server-2017-database-support/)
3. [Liferay 7.1: How to add support for Oracle DB](https://www.dontesta.it/en/2018/10/07/liferay-7-1-how-to-add-support-for-oracle-db/)
4. [Come installare Liferay 7 su JBOSS EAP con il supporto Oracle Database](https://www.slideshare.net/amusarra/come-installare-liferay-7-su-jboss-eap-con-il-support-oracle-database)
5. [Liferay 7 Wildfly: How to add support for Oracle DB](https://www.youtube.com/watch?v=7fojCjko7Ac) (video on Antonio Musarra’s Blog YouTube Channel)
6. [Liferay 7 Community Edition GA5 & Oracle 12c via Docker Composer](https://www.youtube.com/watch?v=yLVCEl8L8cU) (video on Antonio Musarra’s Blog YouTube Channel)
7. [Come installare Liferay 7 su JBoss EAP con il supporto per Oracle Database](https://www.youtube.com/watch?v=QaVaP89yWiM&t=848s) (video on Antonio Musarra’s Blog YouTube Channel)

L'articolo [(English) How to setup Docker container Oracle Database 19c for Liferay Development Environment](https://www.dontesta.it/2020/03/15/how-to-setup-docker-container-oracle-database-19c-for-liferay-development-environment/) sembra essere il primo su [Antonio Musarra's Blog](https://www.dontesta.it).

[![](http://feeds.feedburner.com/~ff/dontesta/blog?d=yIl2AUoC8zA)](http://feeds.feedburner.com/~ff/dontesta/blog?a=vvZBOiy1Zcs:AwJWLbtnthw:yIl2AUoC8zA) [![](http://feeds.feedburner.com/~ff/dontesta/blog?d=dnMXMwOfBR0)](http://feeds.feedburner.com/~ff/dontesta/blog?a=vvZBOiy1Zcs:AwJWLbtnthw:dnMXMwOfBR0) [![](http://feeds.feedburner.com/~ff/dontesta/blog?i=vvZBOiy1Zcs:AwJWLbtnthw:D7DqB2pKExk)](http://feeds.feedburner.com/~ff/dontesta/blog?a=vvZBOiy1Zcs:AwJWLbtnthw:D7DqB2pKExk) [![](http://feeds.feedburner.com/~ff/dontesta/blog?d=YwkR-u9nhCs)](http://feeds.feedburner.com/~ff/dontesta/blog?a=vvZBOiy1Zcs:AwJWLbtnthw:YwkR-u9nhCs) [![](http://feeds.feedburner.com/~ff/dontesta/blog?i=vvZBOiy1Zcs:AwJWLbtnthw:F7zBnMyn0Lo)](http://feeds.feedburner.com/~ff/dontesta/blog?a=vvZBOiy1Zcs:AwJWLbtnthw:F7zBnMyn0Lo) [![](http://feeds.feedburner.com/~ff/dontesta/blog?i=vvZBOiy1Zcs:AwJWLbtnthw:V_sGLiPBpWU)](http://feeds.feedburner.com/~ff/dontesta/blog?a=vvZBOiy1Zcs:AwJWLbtnthw:V_sGLiPBpWU) [![](http://feeds.feedburner.com/~ff/dontesta/blog?d=qj6IDK7rITs)](http://feeds.feedburner.com/~ff/dontesta/blog?a=vvZBOiy1Zcs:AwJWLbtnthw:qj6IDK7rITs) [![](http://feeds.feedburner.com/~ff/dontesta/blog?i=vvZBOiy1Zcs:AwJWLbtnthw:gIN9vFwOqvQ)](http://feeds.feedburner.com/~ff/dontesta/blog?a=vvZBOiy1Zcs:AwJWLbtnthw:gIN9vFwOqvQ)
 ![](http://feeds.feedburner.com/~r/dontesta/blog/~4/vvZBOiy1Zcs)