Skip to content

Oracle Instance Maintenance (Oracle-Alive)

Procedures and automated scripts for maintaining instance availability on the Oracle Cloud "Always Free" tier.


1. Overview

Oracle Cloud Infrastructure (OCI) may reclaim idle "Always Free" instances. To maintain availability, minimum resource utilization is ensured via automated background tasks.

Targets:

  • CPU Utilization: Minimum 10% sustained load.
  • Memory Utilization: Minimum 10% sustained allocation.

2. Implementation Logic

A lightweight background process (Oracle-Alive) is utilized to generate simulated load. This prevents the instance from being flagged as "Idle" by the OCI monitoring system.

Resource Hammer Script (alive.py)

A Python script is executed to maintain resource thresholds:

import os
import time
import multiprocessing

def cpu_load():
    # Sustained CPU load generation
    while True:
        x = 123 * 456

def mem_load():
    # Sustained Memory allocation
    data = bytearray(1024 * 1024 * 100) # 100MB allocation
    while True:
        time.sleep(10)

if __name__ == "__main__":
    p1 = multiprocessing.Process(target=cpu_load)
    p2 = multiprocessing.Process(target=mem_load)
    p1.start()
    p2.start()

3. Deployment Procedure

A. Environment Configuration

  1. Ensure Python 3 is installed on the target instance.
  2. Create the script directory: mkdir -p /opt/oracle-alive.

B. Service Installation

Create a systemd unit file /etc/systemd/system/oracle-alive.service:

[Unit]
Description=Oracle Instance Activity Generator
After=network.target

[Service]
ExecStart=/usr/bin/python3 /opt/oracle-alive/alive.py
Restart=always
User=root

[Install]
WantedBy=multi-user.target

C. Execution and Persistence

Enable and start the service:

systemctl daemon-reload
systemctl enable oracle-alive
systemctl start oracle-alive

4. Monitoring and Validation

Verification of sustained load is required to ensure compliance with OCI "Always Free" policies:

  1. Monitor CPU usage via htop or top.
  2. Verify service status: systemctl status oracle-alive.
  3. Cross-reference metrics with the OCI Monitoring Dashboard.