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

# 1. Stop Replicat
stop replicat <rep_name>

If trail files are shipped via TCP/IP (e.g., remote trail), verify checksums. Use md5sum or cksum on source and target. Mismatch indicates transfer corruption.

If you want, I can produce a concrete patch or code example for a specific language (C, Rust, Python, or Go).

The error OGG-01184: Expected 4 bytes but got 0 bytes in trail is a critical Oracle GoldenGate failure that occurs when a process (typically a Replicat or Data Pump) attempts to read a record trailer at a specific Relative Byte Address (RBA) but finds an empty or truncated file section. This mismatch between the expected record length and the actual data available usually indicates trail file corruption. Core Causes of OGG-01184

Abrupt System Failures: Unexpected shutdowns, power outages, or OS crashes can lead to "partial writes," where the trail file header is updated but the actual record data or trailer is not flushed to disk.

Disk Space Exhaustion: If the target filesystem runs out of space while a Data Pump is writing, the trail file may be truncated mid-record.

Network Interruptions: Instability during the transfer of trail files from source to target can result in incomplete files at the destination.

Manual File Modification: Manually deleting or moving trail files while GoldenGate processes are active can desynchronize RBA checkpoints. Troubleshooting and Recovery Steps 1. Identify the Point of Failure

Check the process report or ggserr.log to find the exact sequence number and RBA.

# Example error message ERROR OGG-01184 Expected 4 bytes, but got 0 bytes, in trail ./dirdat/et000005, seqno 5, RBA 1234567. Use code with caution.

Use the Logdump Utility to inspect the record at that RBA. If Logdump cannot read the record or reports an unexpected end-of-file, the trail is corrupted. 2. Verify File Sizes ogg-01184 expected 4 bytes but got 0 bytes in trail

Compare the size of the trail file on the source and target. If the target file is smaller than the source file for the same sequence number, the transfer was likely interrupted. 3. Resolution Strategies Oracle Help Centerhttps://docs.oracle.com OGG-01184 - Oracle GoldenGate Error Messages

The Ghost in the Machine: Investigating OGG-01184 The error OGG-01184: Expected 4 bytes, but got 0 bytes, in trail is a classic Oracle GoldenGate "abend" (abnormal end) that usually signals trail file corruption. It occurs when a reader process (like a Pump or Replicat) reaches a point where it expects a specific 4-byte token—typically a record trailer—but finds nothing but an empty void (0 bytes). Common Root Causes

Premature File Termination: The trail file was closed abruptly, often due to a disk full condition, a network glitch during a remote write, or a forced process termination.

Checkpoint Mismatch: The reader's checkpoint position is recorded as being beyond the actual physical end of the file.

Filesystem Corruption: Underlying storage issues or overwriting the OGG installation directory can lead to incomplete data blocks.

Overlapping Extracts: Two Extract groups mistakenly writing to the same trail file name, leading to overwritten and malformed record headers. Troubleshooting and Recovery Strategies

When faced with OGG-01184, the standard action recommended by Oracle is to contact Oracle Support, as the trail may be irrecoverably corrupted. However, seasoned DBAs often use the following manual recovery steps:

Analyze with Logdump:Use the logdump utility to open the failing trail file and navigate to the RBA (Relative Byte Address) mentioned in the error log. This confirms if the record at that position is indeed truncated or invalid.

Repositioning:If the corruption is at the very end of a trail file, you can often "skip" the bad data. Find the last valid LOGBSN or SCN before the error. If the corrupt RBA is mid-transaction (TransInd =

Reposition the Primary Extract to that point and perform an ETROLLOVER to start a fresh, clean trail file.

Automated Recovery (OGG 12.2+):Modern versions of GoldenGate include features for Automated Remote Trail File Recovery. In some cases, deleting the corrupted trail file on the target and bouncing the Pump process will trigger an automatic rebuild from the source.

The "Nuclear" Option:If multiple records are corrupted and data integrity is paramount, the safest route is to back up old trails, recreate the Extract and trail groups, and resynchronize the data entirely to ensure no gaps exist. OGG-01184 - Oracle GoldenGate Error Messages

Action. Contact Oracle Support. The trail file may be corrupted. Oracle Help Center OGG-01184 - Oracle GoldenGate Error Messages

Action. Contact Oracle Support. The trail file may be corrupted. Oracle Help Center OGG-01184 - Oracle GoldenGate Error Messages

Action. Contact Oracle Support. The trail file may be corrupted. Oracle Help Center Extract & Pump Abends — oracle-mosc


If the corrupt RBA is mid-transaction (TransInd = 2, 3, or 4), you cannot skip just one transaction without breaking referential integrity for that transaction’s group of operations.

Step 1: Manually locate the next valid record header after the corruption. In logdump, after hitting EOF at 4820192, try to “bump” forward:

logdump> next
logdump> next

If the trail file is simply truncated, there is no next record. If the trail file is simply truncated, there

Step 2: If the file is partially recoverable, use logdump to write a clean trail:

logdump> open /u01/gg/dirdat/rt000012
logdump> filter include rba < 4820192
logdump> write to /u01/gg/dirdat/rt_clean 0

Then rename rt_clean to rt000012 (back up original first).

Step 3: Alter Replicat to start at the last good RBA before corruption:

ggsci> ALTER REPLICAT rep01, EXTSEQNO 12, EXTRBA 4819000
ggsci> START REPLICAT rep01

Result: You lose all changes after RBA 4819000. Resync required for the missing window.

The best fix is never encountering this error. Implement these hardened practices.

The Replicat may have processed all available data and is attempting to read the next trail file in the sequence. If the Extract process on the source has stopped or is lagging significantly, it might not have created the next trail file yet, or it has created a placeholder file that is currently empty.

For experienced administrators, logdump can sometimes repair minor header corruption. Use with extreme caution.


If you have archive trails enabled (EXTTRAIL with ROLLOVER at source) or a backup of the trail files before corruption:

Step 1: Identify the sequence number before the corrupt file:

Step 2: Stop Pump and Extract temporarily. Step 3: Copy the archived clean trail (rt000011 and clean portion of rt000012 from backup) into place. Step 4: Restart Extract with BEGIN NOW or from a known restart point. Step 5: Restart Pump and Replicat.

Note: This assumes you have file-level backups. If not, implement them immediately after recovery.