Ogg-01184 Expected 4 Bytes But Got 0 Bytes In Trail

For database administrators and data engineers working with Oracle GoldenGate (OGG), few things are as frustrating as a replication process that suddenly abends (abnormally ends) with a cryptic error message. One such notorious error is OGG-01184, accompanied by the phrase expected 4 bytes but got 0 bytes in trail.

This error typically halts the Extract or Replicat process, causing data synchronization delays. Understanding its root cause, implications, and step-by-step resolution is critical for maintaining high availability and data integrity.

In this article, we will break down:


When the filesystem hosting the trail directory runs out of space, GoldenGate cannot write the complete 4-byte header and subsequent data. The file is truncated at the point where the write failed. Replicat later reads this truncated file and encounters 0 bytes instead of the expected header.

alter replicat <rep_name>, extseqno <next_seq>, extrba 0

  • Provide two configurable recovery modes:
  • Instrumentation/logging: structured logs/metrics for occurrences (count, file/URL, offset, bytes_missing) and optional callback/hook for host application to collect telemetry.
  • CLI/Tooling: add a repair tool mode that scans OGG files/streams and either (a) reports all truncated-trail instances, (b) produces a repaired copy using padding/resync, or (c) trims to last good page.
  • Tests: unit + fuzz tests covering:
  • We cannot simply restart the process. The EXT_PROD extract is smart; it checks data integrity. If we restart it, it will re-read the trail, hit the same spot, and crash again with the same error. The trail file is physically corrupt or logically incomplete.

    Here is the surgical procedure to restore order:

    The Oracle GoldenGate error OGG-01184 occurs when a process (typically a Data Pump or Replicat) attempts to read a record from a trail file but encounters an unexpected end-of-file or a corrupted record trailer. Technical Review

    The Cause: This error signifies that the process expected a 4-byte record trailer token but found 0 bytes instead. This usually indicates that the trail file was truncated or not fully written—often due to a disk space issue, a network interruption during file transfer, or a source process (Extract) crashing while writing.

    The Checkpoint Conflict: You may also see a related error, OGG-01705, which occurs when the process's checkpoint position is actually beyond the physical size of the trail file. Recommended Action Plan ogg-01184 expected 4 bytes but got 0 bytes in trail

    Validate Trail Integrity: Use the Logdump utility to inspect the specific Relative Byte Address (RBA) mentioned in the error. This helps determine if the file is truly empty at that point or just corrupted. Repump or Re-extract:

    If the issue is in a remote trail (target side), try deleting the corrupted trail file and restarting the Pump process on the source to re-transmit the data.

    If the local trail (source side) is corrupted, you may need to reposition the Extract process to a previous valid sequence number or RBA.

    Check System Resources: Verify that the destination disk is not full and that there are no "file handle shortages" on the host system.

    Reference Official Support: For detailed recovery steps, Oracle documentation frequently points to Doc ID 1138409.1 on My Oracle Support, which provides specific instructions for handling trail file mismatches. Extract & Pump Abends — oracle-mosc

    The error OGG-01184: Expected 4 bytes but got 0 bytes in trail is a critical Oracle GoldenGate message indicating that a process (usually a Pump or Replicat) failed to read a mandatory 4-byte record trailer token from a trail file. This typically occurs when a record is incomplete or the file has been truncated prematurely. Understanding the Root Causes

    The "expected 4 bytes but got 0" condition signifies that the GoldenGate process reached a Relative Byte Address (RBA) where it expected to find metadata, but instead encountered the end of the file.

    Trail File Corruption: This is the most common cause. A trail file may be corrupted due to underlying disk issues, filesystem failures, or an abrupt system shutdown that prevented the Extract from properly closing the file.

    Abnormal Process Termination: If the source Extract process crashes while writing, it may leave a "short" record at the end of the trail file that lacks the necessary closing tokens. For database administrators and data engineers working with

    Checkpoint Mismatch: Sometimes, the input checkpoint position for a Pump or Replicat is greater than the actual physical size of the trail file, leading the process to seek data that does not exist.

    Network Issues: In remote trail scenarios, network interruptions during a transfer can result in a partial file being written to the target system. Step-by-Step Troubleshooting and Resolution 1. Identify the Corrupted Trail File and RBA

    Check the GoldenGate Error Log (usually ggserr.log) to find the specific sequence number and RBA where the error occurred.

    Example Error: ERROR OGG-01184 Expected 4 bytes, but got 0 bytes, in trail ./dirdat/no000007, seqno 7, reading record trailer token at RBA 246849346.. 2. Verify File Integrity

    Compare the RBA mentioned in the error with the actual size of the trail file on the disk. If the RBA is larger than the file size, the file is definitely truncated. 3. Resolution Strategies

    Option A: Automated Remote Trail Recovery (OGG 12.2+)If you are using Oracle GoldenGate 12.2 or higher, you can often recover remote trails automatically: Stop the Pump process on the source. Delete the corrupted trail file from the target.

    Restart the Pump; it will automatically rebuild and re-send the missing trail files from the source.

    Option B: Repositioning the ProcessIf the corruption is at the very end of a trail file and the next trail file exists, you can skip the corrupted record:

    Use ALTER REPLICAT , EXTTRAILSOURCE , RBA to move past the error. Note that this may result in data loss for that specific record. When the filesystem hosting the trail directory runs

    Option C: Re-extracting DataIf the local trail on the source is corrupted, you must re-position the Extract process to a point in the database logs (SCN or timestamp) prior to the corruption and regenerate the trails. Prevention Best Practices

    Monitor Disk Space: Ensure the dirdat directory has enough space to prevent partial writes.

    Use Proper Shutdowns: Always use the STOP command in GGSCI rather than killing OS processes.

    Filesystem Stability: Host trail files on stable, high-performance filesystems to reduce the risk of I/O related corruption. OGG-01184 - Oracle GoldenGate Error Messages

    Expected 3,number,0 bytes, but got 4,number,0 bytes, in trail 0, seqno 1,number,0, reading record trailer token at RBA {2, Oracle Help Center Extract & Pump Abends - Oracle Communities

    Scenario: A large financial firm replicates a 10TB Oracle database. One night, a backup job fills the /goldengate filesystem to 100%. The Extract continues writing but fails to complete the last record in rt000241.

    Error: OGG-01184 expected 4 bytes but got 0 bytes in trail file /goldengate/dirdat/rt000241, at RBA 104857600.

    Resolution Steps Taken:

    Prevention Implemented: