apache/seatunnel · warning

Failed to start Oracle LogMiner session, retrying...

Error message

Failed to start Oracle LogMiner session, retrying...

What it means

startMiningSession failed to start the LogMiner session with ORA-01291 (missing logfile) / error 1291. While attempts remain (attempts <= MINING_START_RETRIES) it warns and returns false so the caller can retry after the log situation changes; after exhausting retries it logs an error and fails the session.

Solutions

  1. Cap endScn at the last archived redo (query v$archived_log for max NEXT_CHANGE#) before starting the session.
  2. Ensure archive log mode is on and all required logs are present: verify with SELECT name FROM v$archived_log WHERE first_change# <= <scn> AND next_change# > <scn>;
  3. Let the connector retry — it is designed to succeed once logs become available; monitor until attempts exceed MINING_START_RETRIES.
  4. Restore missing archive logs from backup if they were deleted and the SCN range is mandatory.

Example fix

// before
startMiningSession(startScn, endScn /* endScn beyond last archived log */);
// after
// endScn = min(endScn, max NEXT_CHANGE# from v$archived_log)
startMiningSession(startScn, cappedEndScn);
Defensive patterns

Strategy: retry

Validate before calling

-- confirm all logs in range are archived
SELECT count(*) FROM v$archived_log WHERE first_change# <= :startScn AND next_change# > :endScn;

Try / catch

for (int attempt = 1; attempt <= MINING_START_RETRIES; attempt++) { if (startMiningSession(attempt)) break; Thread.sleep(3000); }

Prevention

When it happens

Trigger: LogMiner START LOGMINING raised ORA-01291: usually the requested SCN range (startScn..endScn) references archive logs that are missing/not yet archived, or a log file was added/removed concurrently.

Common situations: Mining an SCN range whose redo hasn't been archived yet; archive logs deleted mid-mining; standby/ADG setups where logs lag; endScn beyond current archived redo.

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/b24b46b6aea9c07c. Report an issue: GitHub.

Appendix: source

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

        LOGGER.trace(
                "Starting mining session startScn={}, endScn={}, strategy={}, continuous={}",
                startScn,
                endScn,
                strategy,
                isContinuousMining);
        try {
            Instant start = Instant.now();
            // NOTE: we treat startSCN as the _exclusive_ lower bound for mining,
            // whereas START_LOGMNR takes an _inclusive_ lower bound, hence the increment.
            connection.executeWithoutCommitting(
                    SqlUtils.startLogMinerStatement(
                            startScn.add(Scn.ONE), endScn, strategy, isContinuousMining));
            streamingMetrics.addCurrentMiningSessionStart(Duration.between(start, Instant.now()));
            return true;
        } catch (SQLException e) {
            if (e.getErrorCode() == 1291 || e.getMessage().startsWith("ORA-01291")) {
                if (attempts <= MINING_START_RETRIES) {
                    LOGGER.warn("Failed to start Oracle LogMiner session, retrying...");
                    return false;
                }
                LOGGER.error(
                        "Failed to start Oracle LogMiner after '{}' attempts.",
                        MINING_START_RETRIES,
                        e);
            }
            LOGGER.error("Got exception when starting mining session.", e);
            // Capture the database state before throwing the exception up
            LogMinerDatabaseStateWriter.write(connection);
            throw e;
        }
    }

    /**
     * End the current Oracle LogMiner session, if one is in progress. If the current session does
     * not have an active mining session, a log message is recorded and the method is a no-op.
     *

View on GitHub (pinned to cf67b549a7)