Oracle-Base Docker Images: Multi-tenant APEX/ORDS

Oracle-Base Docker Images: Multi-tenant APEX/ORDS

Disclaimer

These are notes for myself only. This blog is for entertainment only.

Do not use anywhere near production. I am not a DBA.

About

This guide will give you APEX 22.1 and APEX 21.2 on Docker

Oracle-Base update their scripts with the latest version of APEX. In this approach we will:

  1. Accept that this creates a PDB1 with the latest version (rather than modify their scripts)
  2. Use PDB1 as a base and spawn more PDBs with specific versions of APEX we wish to use.

Assumptions

  1. This blog is going to select Oracle Linux 8 and Enterprise Edition 21 of the DB
  2. The current OL8_21 repository has been updated to APEX 22.1. We are going to use the version of APEX that the repository has been updated with.

Instructions

  1. Install Docker Desktop from docker.com
  2. Download Oracle Base Docker Images Repository and unzip to C:\1\dockerfiles-master
  3. Choose a Oracle Linux + DB version i.e Oracle Linux 8 and Enterprise Edition 21
  4. Obtain all software described in the readme.md and place in the C:\1\dockerfiles-master\database\ol8_21\software folder
  5. Open CMD window and
    cd C:\1\dockerfiles-master\database\ol8_21
    
  6. Create a network
    docker network create my_network
    
  7. Build image (this will take a couple of minutes)
    docker build -t ol8_21:latest .
    
  8. In Docker Desktop, Click Volumes, Create. Im using DB 21 so I will name my Volume as...
    OracleDB21Data
    
  9. Create the Container from the image
    docker run -dit --name ol8_21_con -p 1521:1521 -p 5500:5500 --shm-size="1G" --network=my_network -v OracleDB21Data:/u02 ol8_21:latest
    
  10. In Docker Desktop, Double Click the ol_21_con Container Name and see the Logs. Allow minimum of 30mins until complete image.png it should look like this when its finished image.png
  11. When this is complete we can do a connection from the terminal (command below is for SQLcl) that our PDB is running
    sql sys/SysPassword1@localhost:1521/cdb1 as sysdba
    
    image.png

PDBs

Now we'll create PDBs one for the SAME version of APEX and one ANOTHER version of APEX (im going for the prior version)

Whilst still logged in run the following.

CREATE PLUGGABLE DATABASE APEX221PDB FROM PDB1;
ALTER PLUGGABLE DATABASE APEX221PDB OPEN READ WRITE;
ALTER PLUGGABLE DATABASE APEX221PDB SAVE STATE;

CREATE PLUGGABLE DATABASE APEX212PDB FROM PDB1;
ALTER PLUGGABLE DATABASE APEX212PDB OPEN READ WRITE;
ALTER PLUGGABLE DATABASE APEX212PDB SAVE STATE;

Now lets focus on the current version of APEX i.e the APEX221PDB PDB

  1. Look at the software in the README.md of github.com/oraclebase/dockerfiles/tree/mast.. and add it to C:\1\dockerfiles-master\ords\ol8_ords\software
  2. In CMD navigate to C:\1\dockerfiles-master\ords\ol8_ords
  3. Make the build (adjust the numbers to match the version of APEX e.g 221)
    docker build -t ol8_ords_221:latest .
    
  4. In Docker Desktop, Click Volumes, Create. Im using APEX 221 so I will name my Volume as...
    OracleORDS221Data
    
  5. Create the container (adjust all the numbers to match the version of APEX e.g 221)
docker run -dit --name ol8_ords_con_221 -p 8221:8080 -p 9221:8443 -e DB_HOSTNAME=ol8_21_con -e DB_SERVICE=APEX221PDB -e PDB_NAME=APEX221PDB --network=my_network -v OracleORDS221Data:/u01/config/instance1 ol8_ords_221:latest
  1. Click the container name in Docker Desktop to check on progress. When complete it will look like this image.png.

  2. Check out the link at localhost:8221/ords .The INTERNAL password is ApexPassword1

image.png

Lets install the ANOTHER version of APEX in to the APEX212PDB

  1. In windows explorer unzip C:\1\dockerfiles-master\ords\ol8_ords\software to folder apex_22.1_en
  2. open CMD or terminal and change folder
    cd C:\1\dockerfiles-master\ords\ol8_ords\software\apex_22.1_en\apex
    
  3. Log on to the PDB and install APEX 21.2 (remember we renamed the zip) this time using SQLPLUS !!! it does not work with SQLcl
    sqlplus sys/SysPassword1@localhost:1521/APEX212PDB as sysdba
    
  4. Run the following
    @apxremov.sql
    
  5. exit out of SQLPLUS
  6. Delete or rename the apex_22.1_en folder
  7. Download APEX 21.2 from download.oracle.com/otn_software/apex/apex_..
  8. When downloaded, rename the zip file to apex_22.1_en.zip
  9. Move it to C:\1\dockerfiles-master\ords\ol8_ords\software overwriting the current zip
  10. Extract the zip to apex_22.1_en
  11. open CMD or terminal and change folder
    cd C:\1\dockerfiles-master\ords\ol8_ords\software\apex_22.1_en\apex
    
  12. Log on to the PDB and install APEX 21.2 (remember we renamed the zip) this time using SQLPLUS !!! it does not work with SQLcl
    sqlplus sys/SysPassword1@localhost:1521/APEX212PDB as sysdba
    
  13. Run the following
    @apexins.sql SYSAUX SYSAUX TEMP /i/
    
  14. Run the following
    @apxchpwd.sql;
    ALTER USER APEX_PUBLIC_USER IDENTIFIED BY ApexPassword1 ACCOUNT UNLOCK;
    @apex_rest_config.sql; (use password ApexPassword1)
    
  15. In CMD navigate to the correct folder
    cd C:\1\dockerfiles-master\ords\ol8_ords
    
  16. Make the build (adjust the numbers to match the version of APEX e.g 212)
    docker build -t ol8_ords_212:latest .
    
  17. In Docker Desktop, Click Volumes, Create. I'm using APEX 212 so I will name my Volume as...
    OracleORDS212Data
    
  18. Create the container (adjust all the 212 numbers to match the version of APEX e.g 212)
    docker run -dit --name ol8_ords_con_212 -p 8212:8080 -p 9212:8443 -e DB_HOSTNAME=ol8_21_con -e DB_SERVICE=APEX212PDB -e PDB_NAME=APEX212PDB --network=my_network -v OracleORDS212Data:/u01/config/instance1 ol8_ords_212:latest
    
  19. Click the container name in Docker Desktop to check on progress. When complete it will look like this image.png
  20. Check out the link at localhost:8212/ords .The INTERNAL password is ApexPassword1 image.png

To save memory, probably best to have only one running ORDS Container

handy :

select username from all_users where username like 'APEX%' or username like 'ORDS%'