apache/seatunnel · error · DebeziumException

Failed to resolve current SCN

Error message

Failed to resolve current SCN

What it means

During snapshot offset determination, LogMinerAdapter.determineSnapshotOffset could not compute a valid current SCN (currentScn Optional was empty) after consulting the database and pending in-progress transactions from logs. Without a current SCN the connector cannot anchor the snapshot offset, so it aborts with a DebeziumException.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/io/debezium/connector/oracle/logminer/LogMinerAdapter.java:145

            OracleConnection connection)
            throws SQLException {

        final Scn latestTableDdlScn = getLatestTableDdlScn(ctx, connection).orElse(null);
        final String tableName = getTransactionTableName(connectorConfig);

        final Map<String, Scn> pendingTransactions = new LinkedHashMap<>();

        final Optional<Scn> currentScn;
        if (isPendingTransactionSkip(connectorConfig)) {
            currentScn = getCurrentScn(latestTableDdlScn, connection);
        } else {
            currentScn =
                    getPendingTransactions(
                            latestTableDdlScn, connection, pendingTransactions, tableName);
        }

        if (!currentScn.isPresent()) {
            throw new DebeziumException("Failed to resolve current SCN");
        }

        // The provided snapshot connection already has an in-progress transaction with a save point
        // that prevents switching from a PDB to the root CDB and if invoking the LogMiner APIs on
        // such a connection, the use of commit/rollback by LogMiner will drop/invalidate the save
        // point as well. A separate connection is necessary to preserve the save point.
        try (OracleConnection conn =
                new OracleConnection(
                        connection.config(), () -> getClass().getClassLoader(), false)) {
            conn.setAutoCommit(false);
            if (!Strings.isNullOrEmpty(connectorConfig.getPdbName())) {
                // The next stage cannot be run within the PDB, reset the connection to the CDB.
                conn.resetSessionToCdb();
            }
            return determineSnapshotOffset(
                    connectorConfig, conn, currentScn.get(), pendingTransactions, tableName);
        }
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the Oracle user has LogMiner privileges (LOGMINING, SELECT ANY TRANSACTION, SELECT ON V_$DATABASE etc.)
  2. Check that the database is in ARCHIVELOG mode and redo/archive logs are being generated and accessible
  3. Re-run snapshot; if the issue persists, enable Debezium debug logging for io.debezium.connector.oracle.logminer to see why SCN resolution returned empty
  4. Confirm correct connection to the right PDB/CDB and that the compatible LogMiner adapter is selected
Defensive patterns

Strategy: validation

Validate before calling

-- Run as the connector user BEFORE snapshot:
SELECT CURRENT_SCN FROM V$DATABASE; -- must succeed
SELECT LOG_MODE, ARCHIVELOG_MODE FROM V$DATABASE WHERE LOG_MODE='ARCHIVELOG';
-- privileges check:
SELECT * FROM SESSION_PRIVS WHERE PRIVILEGE IN ('LOGMINING','SELECT ANY TRANSACTION');

Try / catch

try {
    adapter.determineSnapshotOffset(...);
} catch (DebeziumException e) {
    if ("Failed to resolve current SCN".equals(e.getMessage())) {
        // verify privileges/archivelog config, then retry snapshot after fixing
        retrySnapshotAfterChecks();
    } else { throw e; }
}

Prevention

When it happens

Trigger: determineSnapshotOffset runs during snapshot start; both the direct SCN lookup and getPendingTransactionsFromLogs fail to yield an SCN (e.g. queries returned nothing, no redo/archive logs cover the time, or log mining session could not find any transaction records).

Common situations: Oracle user lacks LogMining/SELECT privileges so SCN queries return empty; database in a state where v$database CURRENT_SCN is unreadable; archive logging misconfigured; very recent DDL/pending transactions with no mineable logs; wrong pdb/db configuration.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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