ORASOLU TOOLBOX · AUTOMATION & DEVOPS

Monitoring Automation

Practical resources for turning database checks into repeatable monitoring and operational workflows.

ORASOLU TOOLBOX · AUTOMATION & DEVOPS

Turn database checks into useful signals

Monitoring automation works best when each check has a clear threshold, useful evidence and an operational response. These examples provide simple starting points for repeatable database monitoring.

01 · SESSIONS

Monitor active sessions

Identify sessions currently active or waiting so workload changes can be surfaced.

SELECT
    sid,
    serial#,
    username,
    status,
    event,
    wait_class,
    seconds_in_wait
FROM v$session
WHERE type = 'USER'
ORDER BY seconds_in_wait DESC;
02 · TABLESPACE

Monitor tablespace usage

Identify tablespaces whose used percentage has reached a monitoring threshold.

SELECT
    tablespace_name,
    ROUND(used_percent, 2) AS used_percent
FROM dba_tablespace_usage_metrics
WHERE used_percent >= 80
ORDER BY used_percent DESC;
03 · BLOCKING

Monitor blocking sessions

Find sessions currently blocking other sessions.

SELECT
    sid,
    serial#,
    username,
    blocking_session,
    event
FROM v$session
WHERE blocking_session IS NOT NULL
ORDER BY blocking_session, sid;
04 · INVALID

Monitor invalid objects

Detect invalid objects that may indicate deployment or maintenance issues.

SELECT
    owner,
    object_type,
    COUNT(*) AS invalid_count
FROM dba_objects
WHERE status = 'INVALID'
GROUP BY owner, object_type
ORDER BY invalid_count DESC;
05 · JOBS

Monitor scheduler failures

Surface recent scheduler failures for operational follow-up.

SELECT
    owner,
    job_name,
    status,
    error#,
    actual_start_date
FROM dba_scheduler_job_run_details
WHERE status <> 'SUCCEEDED'
ORDER BY actual_start_date DESC
FETCH FIRST 20 ROWS ONLY;
06 · ALERTS

Build a monitoring result

Return a simple status value that can be consumed by a script or monitoring workflow.

SELECT
    CASE
        WHEN EXISTS (
            SELECT 1
            FROM dba_tablespace_usage_metrics
            WHERE used_percent >= 90
        )
        THEN 'ALERT'
        ELSE 'OK'
    END AS status
FROM dual;
ORASOLU TOOLBOX · AUTOMATION & DEVOPS

A monitoring check should lead to useful evidence.

Avoid collecting metrics without an operational purpose. Define what is being checked, what threshold matters and what evidence an operator needs when the check reports a problem.