Oracle automatic upgrade ala Docker way

Marcelo Ochoa
May 4 · 4 min read

There is a post and slides from Mike Dietrich about how to do automatic upgrade for your Oracle RDBMS using auto-upgrade tool.

But what happens if your RDBMS is running on Docker or Docker Swarm? Well is quite easy. Let see:

Assuming that We have a Swarm or Docker compose stack like:

Is working 12cR2 RDBMS database which want to migrate to 19.3, first as auto-upgrade says We need a RDBMS working in archive log mode, change it executing:

To upgrade to 19c We will processed with two step migration option, first running analyse — fixups and finally upgrade as is shown in this picture

auto-upgrade steps

To do that We will use a migrate.sh bash script

migrate.sh bash script

the script is designed to run using startup functionality provided by RDBMS images created using Oracle official build scripts.

To execute above script We will change our Docker stack definition adding new mount files:

..... volumes: - /home/data/db/12cR2.test:/opt/oracle/oradata - /home/oracle/autoupgrade.jar:/opt/oracle/scripts/startup/autoupgrade.jar - /home/oracle/migrate.conf:/opt/oracle/scripts/startup/migrate.conf - /home/oracle/migrate.sh:/opt/oracle/scripts/startup/migrate.sh - /run/shm:/dev/shm

autoupgrade.jar is downloaded from My Oracle support link. Adding above mount options to docker-compose-migrate.yml file, a shutdown-startup is required, lets try:

migrate.conf file only have options to define source version and target version, in our example is:

When a database startup with the stack modified it will log this output:

The failed job (101) in my test tell that there is not enough flash recovery area, but with 30Gb as is defined above the migration process will ended OK.

Now the database is checked and prepared for migration to 19.3 release, lets change our docker-compose file with a new Docker image version and launch with the upgrade tool, changes will look like:

Note that We changed to Oracle Docker image to 19.3 and replaced default start script with a migrate.sh using command upgrade, a shutdown-startup is required again:

When RDBMS start will show the upgrade process as is:

Last message is telling us that the /etc/oratab file which resides in a persistent storage need to be update with a new Oracle home directory, now to 19c binary release:

above change ensure that checkStatus.sh script will work OK at the next start, finally by removing docker compose command option and upgrade files give my database just upgraded to 19c:

with above docker-compose.yml definition a final shutdown-startup database is required:

a log output will show our 19.3 database ready to use:

and that’s all happy upgrading your RDBMs.

Oracle Developers

Aggregation of articles from Oracle & partners engineers, Developer Champions, and the developer community on all things Oracle Cloud and its technologies. The views expressed are those of authors solely and do not necessarily reflect Oracle's. Contact @steveonjava for contribs

Marcelo Ochoa

Written by

Oracle Developers

Aggregation of articles from Oracle & partners engineers, Developer Champions, and the developer community on all things Oracle Cloud and its technologies. The views expressed are those of authors solely and do not necessarily reflect Oracle's. Contact @steveonjava for contribs