apache/seatunnel · error · org.apache.seatunnel.api.table.type.SeaTunnelException

Table is not enabled for capture

Error message

Table  is not enabled for capture

What it means

checkAllTablesEnabledCapture() in Db2Dialect compares the incremental-split table IDs against the set of tables Db2 reports as enabled for CDC capture (via Db2Connection.listOfChangeTables()). If any requested TableId is not present in Db2's capture list, it throws "Table <tableId> is not enabled for capture". The database-side CDC (repl capture) is simply not turned on for that table.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/Db2Dialect.java:126

     * @param tablePath table path from checkpoint schema state
     * @return Db2 Debezium table identifier
     */
    @Override
    public TableId toTableId(TablePath tablePath) {
        return new TableId("", tablePath.getSchemaName(), tablePath.getTableName());
    }

    @Override
    public void checkAllTablesEnabledCapture(JdbcConnection jdbcConnection, List<TableId> tableIds)
            throws SQLException {
        Set<TableId> tables =
                ((Db2Connection) jdbcConnection)
                        .listOfChangeTables().stream()
                                .map(Db2ChangeTable::getSourceTableId)
                                .collect(java.util.stream.Collectors.toSet());
        for (TableId tableId : tableIds) {
            if (!tables.contains(toDb2TableId(tableId))) {
                throw new SeaTunnelException("Table " + tableId + " is not enabled for capture");
            }
        }
    }

    @Override
    public TableChanges.TableChange queryTableSchema(JdbcConnection jdbc, TableId tableId) {
        if (db2Schema == null) {
            db2Schema = new Db2Schema(sourceConfig.getDbzConnectorConfig(), tableMap);
        }
        return db2Schema.getTableSchema(jdbc, toDb2TableId(tableId));
    }

    @Override
    public Db2SourceFetchTaskContext createFetchTaskContext(
            SourceSplitBase sourceSplitBase, JdbcSourceConfig taskSourceConfig) {

        return new Db2SourceFetchTaskContext((Db2SourceConfig) taskSourceConfig, this);
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Enable capture on the table in Db2: ALTER TABLE <schema>.<table> ADD DATA CAPTURE CHANGES.
  2. Run the Db2 system command to apply it: CALL SYSPROC.ADMIN_CMD('REORG TABLE <schema>.<table>') if required, then restart/reinitialize the capture service so change tables are created.
  3. Verify the table appears in the capture list (query SYSCAT.TABDEP or use Db2Connection.listOfChangeTables()) with the exact schema.table name.
  4. Fix table name typos / schema qualification in the SeaTunnel table-list config to match Db2's identifiers exactly.
  5. Confirm the Db2 ASN capture program (db2crsa / ASNQCAP) is running and healthy.

Example fix

// before (Db2)
-- nothing: table never enabled
// after
ALTER TABLE SALES.ORDERS ADD DATA CAPTURE CHANGES;
-- then restart capture so the change table is created
// and verify the connector config matches:
// table-names = ["SALES.ORDERS"]  (correct case/qualification)
Defensive patterns

Strategy: validation

Validate before calling

// Before running the job, confirm every configured table is capture-enabled in Db2
for (String table : configTableList) {
    try (PreparedStatement ps = conn.prepareStatement(
            "SELECT COUNT(*) FROM SYSCAT.TABDEP WHERE ... ")) { /* or query the capture change tables */ }
    // Simplest: use Db2Connection.listOfChangeTables() and assert each TableId is present
}

Try / catch

try {
    dialect.createFetchTask(splitBase);
} catch (SeaTunnelException e) {
    if (e.getMessage().contains("is not enabled for capture")) {
        throw new IllegalStateException("Run ALTER TABLE ... ADD DATA CAPTURE CHANGES for: " + e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: createFetchTask() creating an incremental (transaction-log) split calls checkAllTablesEnabledCapture(); it throws when a table listed in the split's tableIds is missing from Db2's SYSCAT changes/capture tables, i.e. not registered with the Db2 capture service.

Common situations: Forgetting to run ALTER TABLE ... ADD DATA CAPTURE CHANGES (and activate capture / restart the ASN capture program) on a table; typo in schema or table name in the config; capturing a table on the wrong database or in a schema where capture was never enabled; capture service stopped so the table is absent from the change-table list.

Related errors


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