{"record":{"id":"53118c41bb014df4","repo":"apache/seatunnel","slug":"table-is-not-enabled-for-capture","errorCode":null,"errorMessage":"Table  is not enabled for capture","messagePattern":"Table  is not enabled for capture","errorType":"exception","errorClass":"org.apache.seatunnel.api.table.type.SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/Db2Dialect.java","lineNumber":126,"sourceCode":"     * @param tablePath table path from checkpoint schema state\n     * @return Db2 Debezium table identifier\n     */\n    @Override\n    public TableId toTableId(TablePath tablePath) {\n        return new TableId(\"\", tablePath.getSchemaName(), tablePath.getTableName());\n    }\n\n    @Override\n    public void checkAllTablesEnabledCapture(JdbcConnection jdbcConnection, List<TableId> tableIds)\n            throws SQLException {\n        Set<TableId> tables =\n                ((Db2Connection) jdbcConnection)\n                        .listOfChangeTables().stream()\n                                .map(Db2ChangeTable::getSourceTableId)\n                                .collect(java.util.stream.Collectors.toSet());\n        for (TableId tableId : tableIds) {\n            if (!tables.contains(toDb2TableId(tableId))) {\n                throw new SeaTunnelException(\"Table \" + tableId + \" is not enabled for capture\");\n            }\n        }\n    }\n\n    @Override\n    public TableChanges.TableChange queryTableSchema(JdbcConnection jdbc, TableId tableId) {\n        if (db2Schema == null) {\n            db2Schema = new Db2Schema(sourceConfig.getDbzConnectorConfig(), tableMap);\n        }\n        return db2Schema.getTableSchema(jdbc, toDb2TableId(tableId));\n    }\n\n    @Override\n    public Db2SourceFetchTaskContext createFetchTaskContext(\n            SourceSplitBase sourceSplitBase, JdbcSourceConfig taskSourceConfig) {\n\n        return new Db2SourceFetchTaskContext((Db2SourceConfig) taskSourceConfig, this);\n    }","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/Db2Dialect.java#L108-L144","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Enable capture on the table in Db2: ALTER TABLE <schema>.<table> ADD DATA CAPTURE CHANGES.","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.","Verify the table appears in the capture list (query SYSCAT.TABDEP or use Db2Connection.listOfChangeTables()) with the exact schema.table name.","Fix table name typos / schema qualification in the SeaTunnel table-list config to match Db2's identifiers exactly.","Confirm the Db2 ASN capture program (db2crsa / ASNQCAP) is running and healthy."],"exampleFix":"// before (Db2)\n-- nothing: table never enabled\n// after\nALTER TABLE SALES.ORDERS ADD DATA CAPTURE CHANGES;\n-- then restart capture so the change table is created\n// and verify the connector config matches:\n// table-names = [\"SALES.ORDERS\"]  (correct case/qualification)","handlingStrategy":"validation","validationCode":"// Before running the job, confirm every configured table is capture-enabled in Db2\nfor (String table : configTableList) {\n    try (PreparedStatement ps = conn.prepareStatement(\n            \"SELECT COUNT(*) FROM SYSCAT.TABDEP WHERE ... \")) { /* or query the capture change tables */ }\n    // Simplest: use Db2Connection.listOfChangeTables() and assert each TableId is present\n}","typeGuard":null,"tryCatchPattern":"try {\n    dialect.createFetchTask(splitBase);\n} catch (SeaTunnelException e) {\n    if (e.getMessage().contains(\"is not enabled for capture\")) {\n        throw new IllegalStateException(\"Run ALTER TABLE ... ADD DATA CAPTURE CHANGES for: \" + e.getMessage(), e);\n    }\n    throw e;\n}","preventionTips":["Always enable capture (ALTER TABLE ... ADD DATA CAPTURE CHANGES) on every table in the connector's table-list before starting the job.","Match table names exactly (schema and case) between the SeaTunnel config and Db2 identifiers.","Verify the Db2 capture service is running and change tables exist for all target tables.","Re-validate capture settings after DBA changes or table migration."],"tags":["db2","cdc","capture-not-enabled","configuration"],"backgroundTag":"feature-not-enabled","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}