Introduction
If you have read my previous posts on Docker you may have already installed Docker and have an Oracle 12c database running in a Docker container, if not you may want to read my first post on Docker – Running Oracle 12.2.01 on Docker
However, since I wrote the above post Oracle have published Docker images for many of their products, these can be found at the Docker Store. The Oracle images on the Docker Store are not just a great resource and help accelerate adoption, but are also certified and supported by Oracle.
Before continuing with this post you need to check-out my posts on using the new Oracle 12c Docker images and the Pure Storage Docker plugin as this post can be considered the ‘Return of the Jedi’ in the series.
Oracle 12c with Persistent Storage
In this post I will create a Docker container running an Oracle 12c database called PSTG using 4 mount points /u01, /u02, /u03 & /u04 mounted from a Pure Storage FlashArray.
Database environment Layout
/u01 – OraInventory and Oracle 12c product directories
/u02 – Oracle Datafile
/u03 – Fast Recovery Area
/u04 – RedoLog files.
The 4 mount points will all be using persistent All Flash Storage providing low latency performance, space efficient crash consistent snapshots and requiring no local storage.
First, confirm that you have installed the Oracle 12c image using the the following:
$ docker images list
You should be able see the store/oracle/database-enterprise 12.1.0.2 Docker Image, if missing you need to read my previous post.
Ok, copy the db_env.dat file created in the previous post to a new environment file $ORACLE_SID_env.dat and update database name and password e.g.
#################################################################### ## Copyright(c) Oracle Corporation 1998,2016. All rights reserved.## ## ## ## Docker OL7 db12c dat file ## ## ## #################################################################### ##------------------------------------------------------------------ ## Specify the basic DB parameters ##------------------------------------------------------------------ ## db sid (name) ## default : ORCL ## cannot be longer than 8 characters DB_SID=PSTG ## db passwd ## default : Oracle DB_PASSWD=Oracle ## db domain ## default : localdomain DB_DOMAIN=localdomain ## db bundle ## default : basic ## valid : basic / high / extreme ## (high and extreme are only available for enterprise edition) DB_BUNDLE=basic ## end
We will now create the 4 volumes using the docker volume create command and Pure Storage Docker plug-in providing name, size and label.
docker volume create --driver=pure --opt size=20GB --name=PSTG-u01 --label=product docker volume create --driver=pure --opt size=100GB --name=PSTG-u02 --label=oradata docker volume create --driver=pure --opt size=200GB --name=PSTG-u03 --label=fast_recovery_area docker volume create --driver=pure --opt size=10GB --name=PSTG-u04 --label=redo
We can use the docker volume ls command with a filter to list the 4 database volumes we are interested in using the following syntax
$ docker volume ls -f name=environment

The Pure Storage Docker Plugin also supports docker volume inspect, from here we can see the labels which we defined earlier, great way to see where and what the mount is being used for.
$ docker volume inspect volume name

Now that we have installed the Oracle 12c Docker image and created the 4 volumes we are ready to create our Oracle 12c container using the docker run command with -v to present our newly volumes to our container.
docker run -d –env-file ./PSTG_env.dat -p 1527:1521 -p 5507:5500 -it –name PSTG -v PSTG-u01:/u01 -v PSTG-u02:/u02 -v PSTG-u03:/u03 -v PSTG-u04:/u04 –shm-size=”8g” store/oracle/database-enterprise:12.1.0.2
Progress can be monitored using the docker logs command.
docker logs -f PSTG
Once the container has started we can now connect to it and check out our Oracle 12c environment using the docker exec command and container name
docker exec -it PSTG /bin/bash
From within our Oracle 12c ‘PSTG’ container we can see our Pure Storage volumes (/u01, /u02, /u03 & /u04) and the sizes we specified.

Now we are in our Docker container we can use SQLPlus to see data file locations, instance name, docker assigned hostname etc…


[twitter-follow screen_name=’RonEkins’ show_count=’yes’]
Leave a Reply