-- 1. Drop the existing control table (PURGE ensures it doesn't linger in the recycle bin)
DROP TABLE rdsadm.elo_ln_rebuild_driver PURGE;
EXEC DBMS_SCHEDULER.DROP_JOB(job_name => 'MASS_IDX_REBUILD_ELO_LN', force => TRUE);BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'MASS_IDX_REBUILD_ELO_LN',
job_type => 'PLSQL_BLOCK',
job_action => '
DECLARE
v_err_msg VARCHAR2(4000);
v_module VARCHAR2(48) := ''IDX_REBUILD_JOB'';
BEGIN
-- Wait up to 60 seconds for active application transactions (Zero DDL-blocking)
EXECUTE IMMEDIATE ''ALTER SESSION SET DDL_LOCK_TIMEOUT = 60'';
FOR rec IN (
SELECT driver_id, rebuild_ddl, index_name, partition_name, segment_bytes
FROM rdsadm.elo_ln_rebuild_driver
WHERE status IN (''PENDING'', ''FAILED'')
-- Safeguard: Skip segments > 30 GB (32212254720 bytes) to protect 53 GB free space margin
AND segment_bytes < 32212254720
ORDER BY segment_bytes ASC
) LOOP
-- Publish live execution status to v$session
DBMS_APPLICATION_INFO.SET_MODULE(
module_name => v_module,
action_name => ''Rebuilding: '' || substr(rec.index_name, 1, 15)
);
UPDATE rdsadm.elo_ln_rebuild_driver
SET status = ''PROCESSING'', start_time = SYSTIMESTAMP
WHERE driver_id = rec.driver_id;
COMMIT;
BEGIN
EXECUTE IMMEDIATE rec.rebuild_ddl;
UPDATE rdsadm.elo_ln_rebuild_driver
SET status = ''SUCCESS'', end_time = SYSTIMESTAMP
WHERE driver_id = rec.driver_id;
COMMIT;
EXCEPTION WHEN OTHERS THEN
v_err_msg := SUBSTR(SQLERRM, 1, 3900);
UPDATE rdsadm.elo_ln_rebuild_driver
SET status = ''FAILED'', end_time = SYSTIMESTAMP, error_message = v_err_msg
WHERE driver_id = rec.driver_id;
COMMIT;
END;
-- REDO THROTTLE: If segment was > 2 GB (2147483648 bytes), sleep for 60 seconds
-- to allow replica sync and prevent exhausting the 2 TB physical margin
IF rec.segment_bytes > 2147483648 THEN
DBMS_SESSION.SLEEP(60);
END IF;
END LOOP;
-- Clear session info upon completion
DBMS_APPLICATION_INFO.SET_MODULE(null, null);
END;',
start_date => SYSTIMESTAMP,
enabled => TRUE,
auto_drop => FALSE,
comments => 'Resumable online partition rebuild (Numeric Overflow Fixed).'
);
END;
/Here is the complete suite of DBA_SCHEDULER queries to monitor, troubleshoot, and control the MASS_IDX_REBUILD_ELO_LN job from configuration to execution history.
1. Live Execution: Is the job currently running?
This query joins with V$SESSION to show exactly how long the job has been actively running, its CPU usage, and the specific database session it is occupying.
SQLSELECT
r.job_name,
r.session_id,
s.serial#,
r.status,
r.elapsed_time,
r.cpu_used,
s.sql_id,
s.event AS current_wait_event
FROM
dba_scheduler_running_jobs r
LEFT JOIN
v$session s ON r.session_id = s.sid
WHERE
r.job_name = 'MASS_IDX_REBUILD_ELO_LN';
2. Job Configuration: Is the job enabled and configured correctly?
Use this to verify the job exists, check if it is enabled, and review its defined failover or retry parameters.
SQLSELECT
job_name,
job_type,
job_action,
enabled,
state,
run_count,
failure_count,
last_start_date,
next_run_date,
auto_drop
FROM
dba_scheduler_jobs
WHERE
job_name = 'MASS_IDX_REBUILD_ELO_LN';
3. Execution History: Did previous runs succeed or fail?
This view provides the granular history of every time the job started and stopped, including the exact ORA error codes and text if the PL/SQL block crashed.
SQLSELECT
log_id,
job_name,
status,
req_start_date,
actual_start_date,
run_duration,
error# AS error_code,
additional_info AS error_message
FROM
dba_scheduler_job_run_details
WHERE
job_name = 'MASS_IDX_REBUILD_ELO_LN'
ORDER BY
actual_start_date DESC
FETCH FIRST 20 ROWS ONLY;
4. High-Level Event Log: What state changes occurred?
If a job was manually stopped, dropped, or broken by the system, it will be recorded here rather than in the run details.
SQLSELECT
log_date,
job_name,
operation,
status,
additional_info
FROM
dba_scheduler_job_log
WHERE
job_name = 'MASS_IDX_REBUILD_ELO_LN'
ORDER BY
log_date DESC
FETCH FIRST 20 ROWS ONLY;
5. Operational Commands: Stop or Drop the Job
If archive generation spikes or you need to pause execution, use these commands. Because the script architecture relies on the driver table, stopping the job is completely safe; it will resume from the exact stopping point upon restart.SQL-- Gracefully stop the currently running job
EXEC DBMS_SCHEDULER.STOP_JOB(job_name => 'MASS_IDX_REBUILD_ELO_LN', force => FALSE);
-- Force kill the job immediately (if it is hung on a lock)
EXEC DBMS_SCHEDULER.STOP_JOB(job_name => 'MASS_IDX_REBUILD_ELO_LN', force => TRUE);
-- Drop the job entirely
EXEC DBMS_SCHEDULER.DROP_JOB(job_name => 'MASS_IDX_REBUILD_ELO_LN', force => TRUE);
- Primary
FreeStorageSpaceis a Trailing Casualty, not a Root Cause: When an RDS replica disconnects, Oracle architecture dictates the primary must retain all archive logs. The primary storage alert only triggers after the drive fills up with these retained logs. By the time this capacity threshold is breached, the replication tier has already been compromised for a significant duration. - Diagnostic Ambiguity Inflates MTTR: Operating a 64 TB database at 98% capacity leaves a rigid 2 TB margin. Generating 1.5 TB of archive data is a standard, expected workload. Expecting engineers to manually parse generic capacity alerts—which routinely flag benign data loads or temp segment growth—to deduce a hidden replication failure introduces severe diagnostic latency. Incident management must rely on deterministic telemetry, not manual human inference.
- Tablespace Monitoring is Architecturally Irrelevant Here: Tablespace metrics monitor the logical capacity inside the database (application data/indexes). Archive logs consume physical storage entirely outside the database. A database can have 99% free tablespace and still suffer an immediate outage if the physical archive destination fills up. Monitoring tablespaces to catch a replica failure is equivalent to checking a car's tire pressure to diagnose a broken transmission.
- Decoupled Infrastructure Alarms: Implementing dedicated CloudWatch alarms for
FreeStorageSpaceon both the primary database and the read replica independently. - Deterministic RDS Event Notifications: Subscribing to distinct event categories to trigger immediate, real-time paging specifically for "Read Replica status changes" and "Low Storage" events.
- Updated Operational Procedures (SOP): Effective immediately, any generic primary storage alert automatically mandates a cross-validated health check of read replica synchronization status and archive generation rates.
Executive Summary To address the specific question of whether tablespace monitoring would have provided an early warning or prevented the archive failure, the technical answer is definitively no. Suggesting that tablespace alerts would have caught this issue indicates a fundamental misunderstanding of Oracle database architecture. Tablespaces and archive logs occupy entirely distinct storage domains.
Technical Analysis: Logical Data vs. Physical Recovery Storage It is vital for the engineering teams to understand why tablespace telemetry is completely blind to read replica and archive log failures:
Distinct Storage Domains: Tablespace metrics monitor the internal logical capacity of the database—meaning the space consumed by application data, tables, and indexes inside the datafiles. Conversely, archive logs are physical files generated continuously by the database engine to record transactions. They are stored outside the tablespaces, typically at the file system level or within the Fast Recovery Area (FRA).
Zero Correlation: The accumulation of 800+ GB of archive logs due to the replica disconnect rapidly consumed the underlying physical RDS storage, but it had zero impact on tablespace utilization. The tablespace metrics never changed during this event. A database can have 99% free space in all of its tablespaces and still suffer an immediate catastrophic outage if the external archive destination fills up.
The Wrong Tool for the Job: Monitoring tablespaces to catch a replica synchronization failure is equivalent to checking a car's tire pressure to diagnose a broken transmission. Even if we had real-time, minute-by-minute tablespace monitoring actively scrutinized by the team on September 9, it would have shown the database as completely healthy right up until the exact moment the physical storage filled with archive logs and the system went down.
Conclusion
The assertion that tablespace monitoring would have mitigated this outage is technically invalid. It reinforces our core incident finding: relying on generic capacity metrics—whether primary FreeStorageSpace or internal tablespace utilization—is an ineffective defense against replication failures.
The only technically sound method to prevent this specific failure scenario is through dedicated replica state monitoring and archive generation telemetry, which are exactly the AWS-validated alerting mechanisms we are putting in place.
Operational Noise and Time-to-Resolution:
In a 64 TB tier-1 environment, requiring engineers to investigate every FreeStorageSpace alert across decoupled systems is fragile and unscalable. These alerts are routinely triggered by benign database activities—such as high-volume data loads, index rebuilds, or temporary segment consumption—but can simultaneously mask a critical downstream replication failure. Forcing incident responders to manually parse generic capacity metrics to uncover a hidden replication issue introduces severe diagnostic latency. Enterprise incident management must rely on automated, deterministic telemetry to immediately distinguish routine storage fluctuations from systemic failures, ensuring a rapid Mean Time to Resolution (MTTR).
Hi Team,
I have completed the capacity assessment for the tablespaces currently exceeding 75% utilization.
Based on the current utilization levels, the estimated additional storage requirements are:
To achieve 75% utilization: Approximately 7 TB of additional allocation.
To achieve 90% utilization: Approximately 1,105 GB of additional allocation.
Given our current storage constraints, achieving 75% across all identified tablespaces would require substantial additional capacity.
However, the planned archive tablespace space reclamation may provide sufficient capacity to accommodate the estimated 1,105 GB requirement, subject to confirmation that the reclaimed space is physically available on the appropriate storage volumes.
My recommendation is to prioritize the high-utilization tablespaces and evaluate the 90% sizing option as an interim measure, while continuing to assess space reclamation and optimization opportunities to achieve the longer-term 75% target.
Please note that sizing tablespaces to exactly 90% would leave limited headroom before the existing alert threshold is reached. We should account for anticipated growth and operational reserves before proceeding.
Please let me know your preferred approach so we can finalize the capacity plan and coordinate the implementation.
Best regards,
[Your Name]