apache/seatunnel · error · ConnectException

Snapshotting of table

Error message

Snapshotting of table ${table.id()} failed

What it means

OracleSnapshotSplitReadTask.createDataEventsForTable executes the snapshot SELECT for a table via JDBC and rethrows any SQLException as a ConnectException ('Snapshotting of table <id> failed'). It means the chunk query against the Oracle table failed during snapshot export. The original SQL error is preserved as the cause.

Solutions

  1. Grant SELECT on the snapshot tables to the CDC user
  2. Check the wrapped SQLException/ORA code for the root cause
  3. Avoid DDL or drops on tables while snapshot is running
  4. Increase undo_retention or reduce fetch size / split size if hitting ORA-01555
  5. Ensure stable network connectivity to the Oracle instance

Example fix

// before (DBA)
-- no grant
// after
GRANT SELECT ON schema.my_table TO seatunnel_user;
Defensive patterns

Strategy: try-catch

Validate before calling

GRANT SELECT ON schema.my_table TO seatunnel_user;
// Java pre-check
try (ResultSet rs = stmt.executeQuery("SELECT COUNT(*) FROM " + tableId + " WHERE ROWNUM = 1")) { rs.next(); }

Try / catch

try {
    snapshotSplitReadTask.execute(ctx, partition, offsetContext);
} catch (ConnectException e) {
    Throwable root = e.getCause(); // SQLException with ORA code
    LOG.error("Snapshot failed for table; root cause: {}", root.getMessage(), root);
    throw e;
}

Prevention

When it happens

Trigger: SQLException while reading snapshot rows: connection lost mid-query, insufficient SELECT privileges, table dropped/truncated concurrently, query timeout, or ORA- errors (e.g., ORA-00942 table or view does not exist, ORA-01555 snapshot too old).

Common situations: CDC user missing SELECT on the table; table renamed/dropped during snapshot; long-running snapshot exceeding undo retention (ORA-01555); network interruption on very large tables.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/7f7ea8607c70aeb5. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/source/reader/fetch/scan/OracleSnapshotSplitReadTask.java:263

                            snapshotSplit.splitId(),
                            Strings.duration(stop - exportStart));
                    snapshotProgressListener.rowsScanned(
                            snapshotContext.partition, table.id(), rows);
                    logTimer = getTableScanLogTimer();
                }
                dispatcher.dispatchSnapshotEvent(
                        snapshotContext.partition,
                        table.id(),
                        getChangeRecordEmitter(snapshotContext, table.id(), row),
                        snapshotReceiver);
            }
            LOG.info(
                    "Finished exporting {} records for split '{}', total duration '{}'",
                    rows,
                    snapshotSplit.splitId(),
                    Strings.duration(clock.currentTimeInMillis() - exportStart));
        } catch (SQLException e) {
            throw new ConnectException("Snapshotting of table " + table.id() + " failed", e);
        }
    }

    protected ChangeRecordEmitter<OraclePartition> getChangeRecordEmitter(
            SnapshotContext<OraclePartition, OracleOffsetContext> snapshotContext,
            TableId tableId,
            Object[] row) {
        snapshotContext.offset.event(tableId, clock.currentTime());
        return new SnapshotChangeRecordEmitter<>(
                snapshotContext.partition, snapshotContext.offset, row, clock);
    }

    private Threads.Timer getTableScanLogTimer() {
        return Threads.timer(clock, LOG_INTERVAL);
    }

    private static class OracleSnapshotContext
            extends RelationalSnapshotChangeEventSource.RelationalSnapshotContext<

View on GitHub (pinned to cf67b549a7)