Take up space

Inclusion starts with you. Include yourself. Show up fully to the party. Take up space. Be seen. For all our sakes.. “Take up space” is published by Faith Clarke.


独家优惠奖金 100% 高达 1 BTC + 180 免费旋转

Update Oracle Integration Cloud connection from primary to standby database dynamically

In Oracle Data Guard architecture, manual switchover or automatic fail-over to standby instance is a straightforward activity, but changing the endpoints in application instances (like Oracle integration cloud connection) needs manual work.

Let’s say we have one Oracle integration Cloud (OIC) instance in region one that connects to an autonomous transaction processing instance in the same region. Data guard has been configured, and a standby database provisioned in region two. In case of any unplanned (or planned) fail-over or switchover from primary instance to standby instance, the application is still pointing to ATP instance in region one. In this case the OIC administrator should manually upload ATP wallet file of an ATP instance in region two in ATP connector in OIC.

However, in case of automatic fail-over during midnight, the administrator will be notified after receiving lots of failed integration in OIC.

In this article I will explain how we can automate this process to dynamically update ATP connection in OIC after fail-over or switchover has finished.

I am going to use some cloud native features like OCI events and functions to implement this solution.

Here’s the proposed architecture to implement this solution.

In this architecture, I have one OIC instance in Melbourne region and primary ATP (Autonomous Transaction Processing) instance in Melbourne region and a standby ATP instance in Sydney region.

Here is the process:

I am not going to cover details of the implementation steps as I assume you have experience with OCI and Oracle integration cloud.

Here’s a high level list of implementation steps:

After activating your OCI tenancy, you can simply navigate to developer services and provision a new OIC instance (or you can use existing OIC instance if you already have an instance in your tenancy).

Provision ATP instance (with minimal specification) in Melbourne region. for simplicity I have provisioned public instance, but you can use private instances if you like.

After provisioning the primary instance, I will create a data guard (standby instance) in Sydney region.

Now, I will create a sample table in ATP primary instance (with some sample data) to test my integration and I will create a connection to ATP primary instance in OIC using ATP adapter.

Note: We should use the same wallet password from our primary and standby instances.

Finally, I will create a sample integration to trigger by Simple Rest connection and execute query in ATP instance (over ATP connection) to retrieve data.

I will test the integration to make sure everything worked as expected…

Now, to test the process I will manually trigger the switchover in the standby instance.

You just need to navigate to the standby instance and trigger switchover or fail-over.

After few mins you will see database roles will change and you can see an update in OIC ATP connection.

Now, I will explain more in detail how to implement an OCI event and function.

First, we need to create an application in both regions (Sydney and Melbourne) and use the following command to create and deploy OCI function in this application.

To execute the command, you can use cloud shell or configure OCI CLI in your local machine (you should repeat same commands for Sydney region too).

Before deploying the function in Oracle Container Registry (OCIR) you should update function code (func.py) using following code:

and update requirements.txt file with following lines:

Finally, use following commands to deploy the function:

To test the function outside the event process you can create following event payload and execute the following command to test:

This function accepts a few parameters as configuration that you need to set up in the function configuration in OCI console.

Finally, before invoking the function, make sure to create a dynamic group in OCI IAM for this function as below:

also, create a policy for this dynamic group to enable download wallet from ATP instance.

Last step is to create event rule in both regions as in the following:

In this event rule, Event type is “Autonomous Data Guard Association — Failover End” and “Autonomous Data Guard Association —Switch Over End”.

Also, we have another two attributes of compartment ID and resource ID to only raise this event for selected ATP instance.

Finally, in the action part we use an OCI function that we developed in the previous step.

All done!

This was a quick solution to fix a dynamic fail-over issue. You can add lots of improvements to this implementation, like using terraform to provision infrastructure and put credentials that would to a function (OIC and Wallet credentials) in an OCI secret, and pass secret OCID to function and function retrieve credentials in runtime, or use OAuth instead of basic authentication to execute OIC rest API’s, etc.

I hope this article helps you to get some ideas to implement your solutions.

Add a comment

Related posts:

Dolphins Jason Taylor hired as a Miami Hurricanes Coach in 2023

Miami Hurricanes hired ex-Dolphins legendary star Jason Taylor as a defensive ends (DE) coach. Jason Taylor was the NFL 2000’s All-Decades Team member and a former Miami-Dolphins star. Now he is…

12 Writing Tips From My Favorite Comedians

Here are some tips on how to be a better storyteller from some of my favorite comedy writers.

Being an Empath can be a Sign of Hypervigilance from Childhood Trauma.

You can sense things before they happen — a shift in energy, a facial expression, the tone of voice. You have a feeling that something is coming. You always felt that you are highly intuitive. You…