Let’s say you are trying to move an Oracle database to Azure, but don’t want to go down the route of creating an Oracle Database in an Azure VM for obvious reasons: You don’t want to be responsible for maintaining the VM’s availability, hotfixes patching, etc. At the same time, let’s say you do want to take advantage of a fully-managed persistence service that offers local and geo-redundancy and the ability to create snapshots to protect against accidental deletes or data corruption.
It turns out that the latest advancements in Azure Container Instances (ACI), combined with the ability to deploy them in a VNET, can get you close.
Get Your Oracle Resources into the Cloud, and Fast! Request an Oracle Migration Assessment from AIS Today.
Let’s start by reviewing the architecture.
We can host an Oracle DB container image inside Azure Container Instances (ACI). ACI is a container-as-a-service offering that removes the need to manage the underlying virtual machines. It also eliminates the need for setting up our orchestrator. Additionally, ACI-hosted containers (Linux only for now) are placed in a delegated subnet. This allows the Azure container instance to be available from inside a VNET without the need to open a public endpoint.
Finally, the data files (persistent) aspect of the database resides in Azure Files, which removes the need to manage our durable storage since Azure Files takes care of the local and geo-redundancy. Additionally, Azure Files can take snapshots, allowing us a point-in-time restore ability.
(Azure Files also support Virtual Network service endpoints that allow for locking down access to the resources within the VNET.)
ACI also offers fast start times, plus policy-based automatic restarting of the container upon failure.
Here are the three steps to get this setup working:
Step One
Create the ACI hosting Oracle Database Server 12.2.01 that mounts an Azure File share and is connected to a delegated subnet.
az container create -g <> --name <> --image registry-1.docker.io/store/oracle/database-enterprise:12.2.0.1 --registry-username <> --registry-password <> --ports 1521 5500 --memory 8 --cpu 2 --azure-file-volume-account-name <> --azure-file-volume-account-key <> --azure-file-volume-share-name <> --azure-file-volume-mount-path /ORCL --vnet <> --vnet-address-prefix <> --subnet <> --subnet-address-prefix <>
Step Two
This step is a workaround that could be eliminated if we had access to the Docker file used to create this image. We are essentially copying /oradata files containing the control files, data files, etc. to the Azure file share.
mkdir -p /u02/app/oracle/oradata/ORCL; cp -r /u02/app/oracle/oradata/ORCLCDB/. /u02/app/oracle/oradata/ORCL/
Step Three
Connect to the Oracle database from the VNET.
Since the Oracle DB container is created in a VNET, a private IP address is assigned to the container. We can use this IP to connect to it from inside the VNET.
That’s it! We now have an Oracle database without the need to maintain the underlying VM or data volume.
Let’s Talk Pricing
Azure Container Instances bill per second at the “container” group level. “Container group” resources like vCPU/ Memory are shared across multiple containers sharing the same host
The current pricing per second is listed below:
Container group duration:
Memory: $0.0000015 per GB-s
vCPU: $0.0000135 per vCPU-s
The setup we defined above (8GB memory and two vCPUs) will cost ~$100/month based on the following pricing calculation:
Memory duration:
Number of container groups * memory duration (seconds) * GB * price per GB-s * number of days
1 container group * 86,400 seconds * 8 GB * $0.0000015 per GB-s * 30 days = $31.1
vCPU duration:
Number of container groups * vCPU duration (seconds) * vCPU(s) * price per vCPU-s * number of days
1 container groups * 86,400 seconds * 1 vCPU * $0.0000135 per vCPU-s * 30 days = $69.98
Total billing:
Memory duration (seconds) + vCPU duration (seconds) = total cost
$31.1 + $69.98 = $101 per month
Almost! But not completely there!
As the title suggests, the approach mentioned above gets us close to our objective of “Oracle DB as a service on Azure” but we are not all the way there. I would be remiss not to mention some of the challenges that remain.
Our setup is resilient to failure (e.g., policy-based restart) but this setup does not offer us high availability. For that, you will have to rely on setting up something like the Oracle Data Guard on Azure.
ACI supports horizontal scaling and as such the vertical scaling options are limited to current ACI limits (16GB and four vCPU).
ACI VNET Integration capability has some networking limits around outbound NSGs and public peering that you need to aware of.
I’d like to thank Manish Agarwal and his team for help with this setup.
Looking to Retire Your Oracle Hardware and Migrate to the Cloud? Contact AIS Today to Discuss Your Options.