Monitoring CPU, Memory, and IOPS in Oracle Cloud Databases using OCI CLI

As a Cloud Ops DBA, one of your primary responsibilities is monitoring the performance of Oracle Cloud Databases. Key metrics such as CPU utilization, memory usage, and IOPS (input/output operations per second) must be continuously tracked to ensure database stability and to avoid hitting resource bottlenecks.

The Oracle Cloud Infrastructure (OCI) Command Line Interface (CLI) provides an efficient way to fetch these metrics directly from the terminal. In this post, we will explore how to monitor CPU, memory, and IOPS using the OCI CLI, with real examples and outputs.

Prerequisites

  1. OCI CLI installed and configured (oci setup config).
  2. Compartment OCID available.
  3. Sufficient IAM permissions to access monitoring metrics.

Monitoring CPU Utilization

The following command fetches average CPU utilization for an OCI database:

oci monitoring metric-data summarize-metrics-data \
--compartment-id ocid1.compartment.oc1..aaaaexample \
--namespace oci_database \
--query-text "CpuUtilization[1m].mean()" \
--start-time 2025-09-05T14:00:00Z \
--end-time 2025-09-05T14:10:00Z

Sample output

{
  "data": [
    {
      "aggregated-datapoints": [
        { "timestamp": "2025-09-05T14:00:00+00:00", "value": 72.4 },
        { "timestamp": "2025-09-05T14:01:00+00:00", "value": 81.2 },
        { "timestamp": "2025-09-05T14:02:00+00:00", "value": 89.5 }
      ]
    }
  ]
}

Interpretation: CPU usage spiked close to 90 percent at 14:02, which may explain slowness reported by users.

Monitoring Memory Usage

Memory pressure can cause query slowness and ORA-04031 errors. The following command fetches memory utilization metrics:

oci monitoring metric-data summarize-metrics-data \
--compartment-id ocid1.compartment.oc1..aaaaexample \
--namespace oci_database \
--query-text "MemoryUtilization[1m].mean()" \
--start-time 2025-09-05T14:00:00Z \
--end-time 2025-09-05T14:10:00Z

Sample output

{
  "data": [
    {
      "aggregated-datapoints": [
        { "timestamp": "2025-09-05T14:00:00+00:00", "value": 68.7 },
        { "timestamp": "2025-09-05T14:01:00+00:00", "value": 74.3 },
        { "timestamp": "2025-09-05T14:02:00+00:00", "value": 83.1 }
      ]
    }
  ]
}

Interpretation: Memory usage is steadily increasing, reaching more than 80 percent, which could be a sign of queries consuming too much PGA or SGA.

Monitoring IOPS

Database performance is often tied to storage throughput. The following command checks disk I/O utilization:

oci monitoring metric-data summarize-metrics-data \
--compartment-id ocid1.compartment.oc1..aaaaexample \
--namespace oci_database \
--query-text "Iops[1m].mean()" \
--start-time 2025-09-05T14:00:00Z \
--end-time 2025-09-05T14:10:00Z

Sample output

{
  "data": [
    {
      "aggregated-datapoints": [
        { "timestamp": "2025-09-05T14:00:00+00:00", "value": 1200 },
        { "timestamp": "2025-09-05T14:01:00+00:00", "value": 3100 },
        { "timestamp": "2025-09-05T14:02:00+00:00", "value": 4900 }
      ]
    }
  ]
}

Interpretation: At 14:02, IOPS jumped to nearly 5000. If this approaches the maximum provisioned IOPS for your storage, queries will slow down due to throttling.

Combined Example: Checking CPU, Memory, and IOPS Together

You can also fetch multiple metrics in one go by chaining queries:

oci monitoring metric-data summarize-metrics-data \
--compartment-id ocid1.compartment.oc1..aaaaexample \
--namespace oci_database \
--query-text "CpuUtilization[1m].mean(), MemoryUtilization[1m].mean(), Iops[1m].mean()" \
--start-time 2025-09-05T14:00:00Z \
--end-time 2025-09-05T14:10:00Z

Sample output

{
  "data": [
    {
      "aggregated-datapoints": [
        {
          "timestamp": "2025-09-05T14:02:00+00:00",
          "CpuUtilization[1m].mean()": 89.5,
          "MemoryUtilization[1m].mean()": 83.1,
          "Iops[1m].mean()": 4900
        }
      ]
    }
  ]
}

This output shows that all three metrics peaked together, confirming a resource bottleneck.

Oracle DBA

Experienced OCM-certified Oracle Database Administrator with over 18 years of expertise in designing, implementing, and managing complex database solutions. My expertise spans performance optimization, security, and high-stakes solution implementation. Adept at managing complex environments with precision.

No Comments

    Leave a Message

    Your email address will not be published. All fields are mandatory. **