Restoring and upgrading Oracle DB to 19c in one shot with Docker

Image for post
Image for post
Photo by Miguel Andrade on Unsplash

Preparing an RMAN full backup

# mkdir /tmp/setup
# cat > /tmp/setup/zz-backup-full.sh
..... paste above content here .....
# chmod +x /tmp/setup/zz-backup-full.sh
# chown -R 54321:54321 /tmp/setup
# docker run -ti --rm --name freshdb -v /tmp/setup:/opt/oracle/scripts/setup -v /run/shm:/dev/shm oracle/database:12.2.0.1-ee
....... wait to DATABASE IS READY TO USE! message .......
# docker stop freshdb
# ll
total 683816
drwxr-xr-x 2 oracle oinstall 4096 ago 12 17:10 ./
drwxrwxrwt 26 root root 20480 ago 12 17:10 ../
-rw-r----- 1 oracle oinstall 338280448 ago 12 13:50 01v7mglm_1_1
-rw-r----- 1 oracle oinstall 171671552 ago 12 13:51 02v7mgn3_1_1
-rw-r----- 1 oracle oinstall 171327488 ago 12 13:51 03v7mgns_1_1
-rw-r----- 1 oracle oinstall 18792448 ago 12 13:51 control.bks
-rw-r----- 1 oracle oinstall 114688 ago 12 13:51 spfile.bks
-rwxr-xr-x 1 oracle oinstall 680 ago 12 13:40 zz-backup-full.sh*
upgradeDB.sh
# rm /tmp/setup/zz-backup-full.sh
# cat > /tmp/upgradeDB.sh
..... paste here above content or download from gits .....
# chmod +x /tmp/upgradeDB.sh
# docker run -ti --name newdb -v /tmp/setup:/opt/oracle/scripts/setup -v /tmp/upgradeDB.sh:/opt/oracle/createDB.sh -v /run/shm:/dev/shm oracle/database:19.3.0-ee
.... lots of output here ....
RMAN>
Starting restore at 12-AUG-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=621 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /opt/oracle/oradata/ORCLCDB/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /opt/oracle/oradata/ORCLCDB/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /opt/oracle/oradata/ORCLCDB/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00007 to /opt/oracle/oradata/ORCLCDB/users01.dbf
channel ORA_DISK_1: reading from backup piece /opt/oracle/scripts/setup/01v7mglm_1_1
..........
Number of Cpus = 8
Database Name = ORCLCDB
DataBase Version = 12.2.0.1.0
catcon::set_log_file_base_path: ALL catcon-related output will be written to [/opt/oracle/product/19c/dbhome_1/cfgtoollogs/ORCLCDB/upgrade20200812170336/catupgrdcdbroot_catcon_418.lst]
..........
Grand Total Upgrade Time: [0d:1h:11m:17s]
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Aug 12 18:15:15 2020
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.SQL> Connected.
SQL> Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> ORACLE instance started.
Total System Global Area 1610610568 bytes
Fixed Size 9136008 bytes
Variable Size 654311424 bytes
Database Buffers 939524096 bytes
Redo Buffers 7639040 bytes
Database mounted.
Database opened.
................
The Oracle base remains unchanged with value /opt/oracle
#########################
DATABASE IS READY TO USE!
#########################

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store