Note:

Enable Database Management for Oracle Cloud databases Using Terraform

Introduction

Oracle Cloud Infrastructure (OCI) Database Management is an useful performance diagnostics tool which can help you in monitoring and managing your Oracle database. When you create an Oracle Cloud Database within a database system, the Database Management option is not enabled by default because it is based on supplementary resources and actions, independent of the database creation process.

This tutorial describes an example about how to create Terraform code to enable or disable Database Management at code level, as part of a Terraform automation.

The Database Management option for Oracle Cloud Databases is available on the Database Information page, under Associated Services and you can also enable it from the UI. There are several steps and prerequisites for this process to succeed and have all the needed information. For more information about the steps to enable database management using the UI, see the links in the Related Links section at the end of this tutorial.

Objectives

Assuming you have a code that creates an Oracle Cloud database, single instance or RAC, in a private subnet, at this stage the database will not have Database Management enabled and there is no exposed parameter which will do this directly. You will need to create extra resources, grant privileges at OCI level and database level and obtain information from the existing database to be used in the Database Management enabling. All this should be done as an addition to the same code that creates the database, without hardcoded values. The following steps need to be done:

Prerequisites

Task 1: Get the private IP of the database node (or of one of the RAC nodes)

There is no attribute that exposes the private IP of the database node(s), so you need to find it indirectly. One way is to use the following 2 steps:

Task 3: Create vault, master key and secret for the DBSNMP password

Task 4: Create policy for Database Management service and the OCI user

Create policies using the resource oci_identity_policy:

Task 5: Create private endpoint in your VCN

Task 6: Configure network to allow traffic between the private endpoint and the Cloud database

Task 7: Enable Database Management on the Cloud database

To enable database management, you need to use the Terraform resource oci_database_cloud_database_management. It needs to be populated with some of the information created in the previous steps.

Acknowledgments

Author - Adina Nicolescu (Senior Cloud Engineer)

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.