How to Prevent Oracle Free Tier VPS Reclamation Using CPU & RAM Keepalive Scripts

The Oracle Cloud Free Tier has become one of the most popular options for developers, hobbyists, sysadmins, and small business owners who want access to reliable cloud resources without monthly costs. Among its most attractive features are the Always Free VM shapes, such as the Arm Ampere A1.Flex instance that offers up to 4 OCPUs and 24 GB RAM—far more generous than the free tier of any major cloud provider.

However, there is one important detail many users overlook: Oracle can reclaim Always Free instances if they stay idle for extended periods of time. This means that if your VPS shows extremely low CPU, network, or memory usage for several days, Oracle may automatically delete it. For anyone hosting websites, applications, or personal projects, this can lead to unexpected downtime and data loss.

This article explains why Oracle reclaims idle instances, how to measure system activity, and how to set up safe and lightweight CPU/RAM keepalive scripts to ensure your VPS remains active and permanently available. Whether you’re running a blog, a game server, a bot, or a home lab project, this guide will help you keep your Oracle VPS alive indefinitely.


Why Oracle Reclaims Idle Free Tier Instances

Oracle provides an incredibly generous free tier, but to prevent misuse—such as massive numbers of dormant VMs—they actively monitor the usage of Always Free resources. According to Oracle’s free tier documentation, instances may be reclaimed if the system appears consistently idle for seven consecutive days.

The idle criteria typically include:

  • CPU usage under ~20%
  • RAM usage under ~20% (especially on A1 ARM instances)
  • Network traffic extremely low
  • Little or no active workloads

If all of these remain low for too long, Oracle assumes the machine is abandoned or wasted and may reclaim it to free up capacity.

This can be a surprise for new users who deploy a VPS but don’t actively run applications on it. Many users report that their unused or lightly-used servers were unexpectedly deleted—even when they still needed them.

Fortunately, you can easily avoid this by ensuring your VPS has enough ongoing activity to show Oracle that it is being used.


Checking Your VPS Activity Levels

Before setting up any keepalive system, it’s important to know how idle your instance currently is. You can quickly examine your real-time CPU usage by running:

top

Look at the line starting with:

%Cpu(s):

If you see numbers like:

1.3 us, 0.2 sy, 97.8 id

That means your CPU is ~98% idle, which is far too low to avoid potential reclamation.

To check RAM usage:

free -m

For a 24 GB Oracle A1 instance, you might see something like:

Mem: 23998 total, 2170 used, 16714 free

This means you’re using only 9% of your RAM—again too low to be considered active.

If your usage numbers are well below 20% for both CPU and memory, you’re at a higher risk of losing your VPS due to inactivity.


Using RAM to Keep the VPS Active

One of the safest ways to prevent Oracle from thinking your machine is idle is to keep a portion of the RAM actively allocated. The best part is that Linux handles memory dynamically, so even if your RAM keepalive script allocates several gigabytes, the kernel will automatically reclaim it if real applications need memory.

A widely recommended approach is to keep RAM usage at around 20–30%, which is a healthy and safe level that satisfies Oracle’s activity checks without affecting server performance.

Here is a simple RAM keepalive script that automatically maintains your memory usage at approximately 25%:

#!/bin/bash

# Target: use ~25% RAM for Oracle Free Tier safety
TARGET_PERCENT=25

while true; do
    TOTAL=$(grep MemTotal /proc/meminfo | awk '{print $2}')
    TARGET=$(( TOTAL * TARGET_PERCENT / 100 ))
    CURRENT=$(grep Active: /proc/meminfo | awk '{print $2}')

    if (( CURRENT < TARGET )); then
        DIFF=$(( TARGET - CURRENT ))
        echo "Allocating: $DIFF KB"
        dd if=/dev/zero of=/dev/shm/ramfiller bs=1024 count=$DIFF status=none
    fi

    sleep 60
done

This script:

  • Calculates your total RAM
  • Determines how much memory you should use to reach 25%
  • Fills /dev/shm (a RAM-only filesystem) with temporary data
  • Adjusts allocation every 60 seconds
  • Uses minimal CPU and disk activity

Once saved and made executable, you can run it manually or create a systemd service to run it automatically at boot.

This approach ensures that your Oracle VPS always appears active in terms of memory usage, eliminating one of the key triggers for automatic reclamation.


Keeping CPU Activity Above Oracle’s Threshold

While maintaining RAM usage is helpful, Oracle also checks whether your CPU is idle. To fully ensure your VPS stays safe, it’s best to keep the CPU at around 20–25% usage. This is enough to show activity but not enough to burden your server or reduce performance for other applications.

A CPU keepalive script (if you choose to add one) uses very low-priority background processes to simulate light workload activity. These scripts typically use small loops or tiny calculation tasks that run with “nice” values, meaning they have almost no impact on real workloads.

The combination of CPU and RAM keepalive scripts ensures Oracle sees:

  • Active CPU load
  • Active memory usage
  • A running process
  • A non-idle system

This makes your Always Free instance extremely unlikely to be reclaimed.


Creating a Systemd Service for Automatic Operation

Running the script manually keeps your instance active only until the next reboot or shutdown. To preserve your VPS long-term, you should create a systemd service, which ensures the memory (and optionally CPU) keepalive scripts run automatically at startup.

This involves simply creating a service file, reloading systemd, and enabling the service. Once set, the script becomes a persistent, self-managing part of your VPS environment.


Verifying That Your Keepalive System Is Working

After setting everything up, it’s important to confirm that your VPS is indeed safe from inactivity. There are three easy ways to do this:

1. Check your RAM usage

Run:

free -m

If your RAM usage has increased from something like 2 GB → 7–8 GB+, then your RAM keepalive script is running correctly.

2. Inspect /dev/shm

Run:

ls -lh /dev/shm

You should see a file such as ramfiller occupying several gigabytes.

3. Check systemd service status

Run:

systemctl status ram-keepalive

If you see:

active (running)

Then everything is working perfectly.


Is This Safe for My VPS?

Yes — these techniques are safe and widely used for several reasons:

  • Linux can reclaim RAM anytime if real programs need it.
  • CPU keepalive tasks run at very low priority (nice values).
  • No permanent files are stored; everything is in TEMP memory.
  • The server remains fully responsive and reliable.
  • You stay within the Always Free limits.

In short: your VPS appears active to Oracle, but the scripts don’t interfere with your usage or performance.


The Oracle Cloud Always Free Tier is one of the best free cloud computing options available today, but its idle reclamation policy can cause users to lose valuable servers unexpectedly. Fortunately, with a small amount of setup—particularly managing your CPU and RAM usage—you can ensure your VPS remains active, safe, and permanently available.

Using lightweight keepalive scripts is a smart, effective, and non-intrusive solution. It allows you to enjoy the full benefits of Oracle’s free tier without worrying about losing your server or your data due to inactivity.

Whether you’re running a personal project, a business application, or simply experimenting with cloud computing, taking a few minutes to set up these keepalive strategies will help ensure your VPS stays online for as long as you want.