Build an image from raw data files or a restore script and deliver containers with Oracle database clones on Linux

This article describes building a simple image on Linux for an Oracle database and delivering fast clones in containers from the image on Linux. The control plane runs on Windows while the cloning and containerization service runs on Linux. You need two downloads - the Windocks installer for Windows and the .Deb package for Linux. You may choose to call the Windocks Linux API directly if you don't want the Windows control plane - contact support@windocks.com for documentation on this.

Hardware requirements: The Windocks service is a software install on standard Linux (Ubuntu). The recommended minimum machine size for Oracle support is 8GB RAM with 80GB of disk not counting database sizes. If you want to deliver clones of an Oracle database of size say 1TB, then get a separate disk of size 1 TB + room for growth + room for fresh writes to the clones. The clones do not take disk space when you create them, only the images occupy the 1TB disk space. The cloning service requires one or more separate disks so you must add a separate disk to your machine (The single disk that most VMs come with is used to run the Windocks service and containers. The cloning service requires a different disk for delivering database clones, so you cannot use the single disk of the VM for the cloning service).

Software requirements: Ubuntu 18.04 onwards is supported. The installer package is a .deb file. Email support@windocks.com for the .deb file.

User account: You need a sudo user account. Configure the account in /etc/sudoers so that a password is not required each time sudo is used. To do this, edit the file with
sudo visudo
In the file add the following line at the bottom:
YOUR_USERNAME_HERE ALL=(ALL) NOPASSWD: ALL

You may need to log out of ssh and log back in for it to take effect.

Install steps on Linux: Login to Ubuntu with the sudo account and run the following:

mkdir ~/windocksinstall

# Copy the .deb file into ~/windocksinstall

cd ~/windocksinstall
dpkg -x windockslinux.deb .

# Download the Oracle Zip installer from https://www.oracle.com/database/technologies/oracle-database-software-downloads.html#19c (the Linux x86-64 file)
# Copy the Oracle LINUX install file into ~/windocksinstall/oraclezip/19.3.0
# Repeat copy for all oracle versions you want

cp ~/LINUX.X64_193000_db_home.zip ~/windocksinstall/oraclezip/19.3.0

# Get the disks needed for the cloning system. Windocks Linux needs one or more disks for database cloning
# For example, If you are on AWS, then create one or more volumes and attach the volume(s) to your EC2 VM
# The disk(s) should be visible in the fdisk command (for example /dev/xvdf )

sudo fdisk -l

cd ~/windocksinstall/install
cat install.sh

# Follow the instructions in install.sh

# Following a reboot of Ubuntu, you need to start Windocks again by
cd /var/www/windocks
dotnet WebApi.Service.dll

Open the firewall ports on the Linux machine for a range of container ports 10001 to 11000. These are the host ports for the containers.

Install steps on Windows: Run the Windows installer. On Windows open the file windocks\config\node.conf and uncomment the lines below and set the values. Save the node.conf file and restart the Windocks service. Put in the IP address or DNS name of the Linux server for ORACLE_LINUX_SERVICE_IP_OR_DNS

ORACLE_LINUX_SERVICE="1"
ORACLE_LINUX_SERVICE_IP_OR_DNS="18.237.65.109"
ORACLE_LINUX_SERVICE_PORT="80"
ORACLE_LINUX_SERVICE_HTTPS="0"
ORACLE_LINUX_SERVICE_TIMEOUT_SECONDS="3600"

See the sample in windocks\samples\oraclelinux. On Windows, create a file named dockerfile (# indicates comments). Start with the sample windocks\samples\oraclelinux\dockerfile. Copy the restore.sql script to Linux to the path specified in the dockerfile. The dockerfile is below:

dockerfile
FROM oracle-19.3.0-enterprise

# A sample restore.sql script is provided which creates a pluggable database
# You may want to create a script that restores an Oracle backup
# Or use COPY in your SQL script to copy the database from the source Oracle server # Windocks uses SQLPlus to execute the script
# Replace ORCLCDB with the SID name you want

SETUPCLONING FULL ORCLCDB /home/ubuntu/scripts/restore.sql

# Alternatively provide the path to an oradata as the source database for the image. The image build will copy the contents of this directory into the image and use that to create clones
# Replace ORCLCDB with the SID name in /linux/path/to/oradata

# SETUPCLONING RAW ORCLCDB /linux/path/to/oradata

# Running scripts post database ready - You may specify sql or sh scripts or executable to run after the database is ready in the image
# Useful for running database masks for example

# Post database create shell scripts or executables
# Copy the mask.sh file to /home/ubuntu/scripts on the Linux machine
# The script is run with two system populated parameters
# Windocks automatically provides two parameters to the script or executable: $1 = host port for Oracle and $2 = Linux docker container id
# For example in mask.sh you can run sqlplus to the 127.0.0.1 with port $1
# Or you can run docker exec -it $2 /bin/bash -c "echo ImRunningInTheContainer"

RUN RUN_ON_IMAGE_DATABASES /home/ubuntu/scripts/mask.sh

# Post database create sql scripts
# Copy the sqlscript.sql file to /home/ubuntu/scripts on the Linux machine
# Windocks automatically runs the SQL script against the Oracle container using sqlplus

RUN /home/ubuntu/scripts/sqlscript.sql

Build the image from the above dockerfile. This will create an image

In a command line on the Windocks server:
docker build -t yourimagename path\to\directory\containing\dockerfile

Alternatively, use the web application and click on Build in the top menu and click Browse. Select all the files in the directory (dockerfile, any script files) and then Open. Then click Build.

You may also use the REST API to build the image


Create a container from the image. This can be done using a command line (only on the Windocks machine), or the web application (from any machine) or from the REST API (any machine)

In a command line on the Windocks server:
docker run -d yourimagename

This will deliver a container with a writeable database clone of the Oracle database

You may also create containers with the clones from the web application at ServerIp:/index.html or the file windocks\ui\index.html in Chrome or Firefox

You may also create containers with the REST API here