1. Home
  2. Knowledge Base
  3. Zero Downtime Migration
  4. Oracle database 12c to 21c online migration using ZDM (Zero Downtime Migration) – Part 3

Oracle database 12c to 21c online migration using ZDM (Zero Downtime Migration) – Part 3

Oracle Zero Downtime Migration (ZDM) is the free-to-use Oracle Maximum Availability Architecture (MAA)-recommended solution to migrate Oracle Databases to the Oracle Cloud Infrastructure.

ZDM provides a number of migration options – Physical offline,Physical online, Logical offline, Logical online.

In a Logical Online migration, users are still connected to a live database while ZDM is executing in the background. Internally ZDM uses Oracle GoldenGate technology to enable the ‘zero-downtime’ migration as well as Oracle Data Pump.

These series of posts provide a step-by-step procedure of how to do an Online Logical Migration of an Oracle Database 12c to Oracle Database 21c.

In Part 1, we discussed how to create and configure the ZDM hub.

In Part 2, we discussed how to create and configure the GoldenGate hub.

In this post, we will discuss the process of configuring connectivity from the OCI console to both the ZDM and GoldenGate hubs.

Generate the API public key file.

Execute the commands openssl genrsa -out oci_api_key.pem 2048 and openssl rsa -pubout -in oci_api_key.pem -out oci_api_key_public.pem

[zdmuser@zdm-hub zdm21.3]$ cd
[zdmuser@zdm-hub ~]$ mkdir .oci
[zdmuser@zdm-hub ~]$ cd .oci
[zdmuser@zdm-hub .oci]$ openssl genrsa -out oci_api_key.pem 2048
Generating RSA private key, 2048 bit long modulus
.......................+++
......................+++
e is 65537 (0x10001)

[zdmuser@zdm-hub .oci]$ openssl rsa -pubout -in oci_api_key.pem -out oci_api_key_public.pem
writing RSA key
[zdmuser@zdm-hub .oci]$ ls -lrt
total 8
-rw-r--r--. 1 zdmuser zdm 1679 Feb  6 09:03 oci_api_key.pem
-rw-r--r--. 1 zdmuser zdm  451 Feb  6 09:04 oci_api_key_public.pem

[zdmuser@zdm-hub .oci]$ cat oci_api_key_public.pem

OCI console Identity Users User Details menu – Resources section.

Click on Add API Key

Select the option Paste Public Key and copy the contents of the oci_api_key_public.pem file.

Click Add.

Copy the contents  to .oci/config on ZDM host

Edit the path of the key_file entry to point to the location where the api private key file is located.

[zdmuser@zdm-hub .oci]$ vi config
key_file=/home/zdmuser/.oci/oci_api_key.pem # TODO

[zdmuser@zdm-hub .oci]$ exit
Logout

As root user, copy the .oci directory from /home/zdmuser to /home/opc directory location.

[root@zdm-hub ~]# cd /home/opc
[root@zdm-hub opc]# mkdir .oci
[root@zdm-hub opc]# cd .oci
[root@zdm-hub .oci]# cp -fR /home/zdmuser/.oci/* .
[root@zdm-hub .oci]# cd ..
[root@zdm-hub opc]# chown -fR opc:opc .oci

As the opc user, edit the config file and change key_file entry to provide the location of the oci_api_key.pem file.

[root@zdm-hub opc]# su - opc
[opc@zdm-hub ~]$ cd .oci
[opc@zdm-hub .oci]$ vi config
key_file=/home/opc/.oci/oci_api_key.pem

As root user, edit the /etc/hosts file on the ZDM hub host to add an entry for the GoldenGate hub.

[opc@zdm-hub .oci]$ sudo su -
Last login: Mon Feb  6 04:18:24 GMT 2023 on pts/0

[root@zdm-hub ~]# vi /etc/hosts
…
…
10.0.0.233 ogghub.sub12020731300.soormavcn.oraclevcn.com ogghub

Enable password-less SSH connectivity between the ZDM and GoldenGate hosts.

[opc@zdm-hub .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/opc/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/opc/.ssh/id_rsa.
Your public key has been saved in /home/opc/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:xNaAiKmEHoOsKUMtcXURS57bdy2CXifiY/XfUBrOwcY opc@zdm-hub
The key's randomart image is:
+---[RSA 2048]----+
|+.o+.o *+        |
|oB+.. =.oo       |
|=o+    ++ .      |
|*.     oo .  o.  |
|..     .S+ * +E..|
|        o = *+.= |
|         =   .=  |
|        . .   ...|
|               ..|
+----[SHA256]-----+

[opc@zdm-hub .ssh]$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDcfT5YeW7DetAzfmc+acq1cB/YtXsBIrSY2oh5NyL++kSUQK/hLKkhugMA+sLEJSXJ7nij9Fk3PYyf1OUU7UH83pFzxvuC70dibwkOYDjSjMv5jDf1NxdO3WWUwHM/wcLUDMhfcSTVElj4coThkWeP2n7EcbRt5pahrhPJOLpApTDeKmJ+norGeiMzl/07/JhNPiOUOEUMv5PJJOq8OOopqLkXwdLEaf8kJqDIJmvPR1Fwfb+mKScsH/6l2PISkQZsw/Qa6u67m5nudqrYqEeg7BwKnC8rCMMQFjrK9VTla66FYz7BpAfzB3uGyNCpIBDl53kIPvxZHewk12iGl9gL opc@zdm-hub

[opc@zdm-hub .ssh]$
[opc@zdm-hub .ssh]$ vi authorized_keys

[opc@zdm-hub .ssh]$ ssh opc@ogghub
-bash-4.2$ hostname
ogghub
-bash-4.2$ exit
logout
Connection to ogghub closed.


[root@zdm-hub ~]# su - zdmuser
Last login: Tue Feb  7 04:38:54 GMT 2023 on pts/0
[zdmuser@zdm-hub ~]$ cd .ssh
[zdmuser@zdm-hub .ssh]$ ssh -i id_rsa opc@ogghub
The authenticity of host 'ogghub (10.0.0.233)' can't be established.
ECDSA key fingerprint is SHA256:QiBx80YkrkQGwgS7CSLsx8G9OL8z17corBWNpvujhzo.
ECDSA key fingerprint is MD5:d3:c6:17:92:e8:0b:80:5e:30:d7:ef:04:92:78:a0:60.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ogghub,10.0.0.233' (ECDSA) to the list of known hosts.
-bash-4.2$ hostname
ogghub
-bash-4.2$ exit
logout
Connection to ogghub closed.


[opc@zdm-hub .ssh]$ ssh opc@10.0.0.50
Last login: Wed Feb  8 02:48:29 2023 from 10.0.0.211
[opc@ora12c ~]$ exit
logout
Connection to 10.0.0.50 closed.

[opc@zdm-hub .ssh]$ ssh opc@10.0.0.234
Last login: Wed Feb  8 02:49:35 2023 from 10.0.0.211
[opc@ora21c ~]$ exit
logout
Connection to 10.0.0.234 closed.

Download and install Oracle Cloud Infrastructure Command Line Interface.

bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"

…
…
…

===> Enter a path to an rc file to update (file will be created if it does not exist) (leave blank to use '/home/zdmuser/.bashrc'):
-- Backed up '/home/zdmuser/.bashrc' to '/home/zdmuser/.bashrc.backup'
-- Tab completion set up complete.
-- If tab completion is not activated, verify that '/home/zdmuser/.bashrc' is sourced by your shell.
--
-- ** Run `exec -l $SHELL` to restart your shell. **
--
-- Installation successful.
-- Run the CLI with /home/zdmuser/bin/oci –help

[zdmuser@zdmhub ~]$ oci iam availability-domain list
{
  "data": [
    {
      "compartment-id": "ocid1.tenancy.oc1..aaaaaaaa64twfc56x4q32ylbmjgt3voh5os4ndxphw2qygzn2cmgppowl3fq",
      "id": "ocid1.availabilitydomain.oc1..aaaaaaaalhnzffyixz4hyhp7gtcdskahy22cekpcgndvwdjffrdv6d5iqi5a",
      "name": "YxcO:AP-SYDNEY-1-AD-1"
    }
  ]
}
Updated on May 10, 2023

Was this article helpful?

Related Articles

Leave a Comment