{"record":{"id":"b24b46b6aea9c07c","repo":"apache/seatunnel","slug":"failed-to-start-oracle-logminer-session-retrying","errorCode":null,"errorMessage":"Failed to start Oracle LogMiner session, retrying...","messagePattern":"Failed to start Oracle LogMiner session, retrying\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/io/debezium/connector/oracle/logminer/LogMinerStreamingChangeEventSource.java","lineNumber":690,"sourceCode":"        LOGGER.trace(\n                \"Starting mining session startScn={}, endScn={}, strategy={}, continuous={}\",\n                startScn,\n                endScn,\n                strategy,\n                isContinuousMining);\n        try {\n            Instant start = Instant.now();\n            // NOTE: we treat startSCN as the _exclusive_ lower bound for mining,\n            // whereas START_LOGMNR takes an _inclusive_ lower bound, hence the increment.\n            connection.executeWithoutCommitting(\n                    SqlUtils.startLogMinerStatement(\n                            startScn.add(Scn.ONE), endScn, strategy, isContinuousMining));\n            streamingMetrics.addCurrentMiningSessionStart(Duration.between(start, Instant.now()));\n            return true;\n        } catch (SQLException e) {\n            if (e.getErrorCode() == 1291 || e.getMessage().startsWith(\"ORA-01291\")) {\n                if (attempts <= MINING_START_RETRIES) {\n                    LOGGER.warn(\"Failed to start Oracle LogMiner session, retrying...\");\n                    return false;\n                }\n                LOGGER.error(\n                        \"Failed to start Oracle LogMiner after '{}' attempts.\",\n                        MINING_START_RETRIES,\n                        e);\n            }\n            LOGGER.error(\"Got exception when starting mining session.\", e);\n            // Capture the database state before throwing the exception up\n            LogMinerDatabaseStateWriter.write(connection);\n            throw e;\n        }\n    }\n\n    /**\n     * End the current Oracle LogMiner session, if one is in progress. If the current session does\n     * not have an active mining session, a log message is recorded and the method is a no-op.\n     *","sourceCodeStart":672,"sourceCodeEnd":708,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/io/debezium/connector/oracle/logminer/LogMinerStreamingChangeEventSource.java#L672-L708","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Cap endScn at the last archived redo (query v$archived_log for max NEXT_CHANGE#) before starting the session.","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>;","Let the connector retry — it is designed to succeed once logs become available; monitor until attempts exceed MINING_START_RETRIES.","Restore missing archive logs from backup if they were deleted and the SCN range is mandatory."],"exampleFix":"// before\nstartMiningSession(startScn, endScn /* endScn beyond last archived log */);\n// after\n// endScn = min(endScn, max NEXT_CHANGE# from v$archived_log)\nstartMiningSession(startScn, cappedEndScn);","handlingStrategy":"retry","validationCode":"-- confirm all logs in range are archived\nSELECT count(*) FROM v$archived_log WHERE first_change# <= :startScn AND next_change# > :endScn;","typeGuard":null,"tryCatchPattern":"for (int attempt = 1; attempt <= MINING_START_RETRIES; attempt++) { if (startMiningSession(attempt)) break; Thread.sleep(3000); }","preventionTips":["Cap endScn to last archived redo before mining.","Keep archive log mode enabled with adequate retention.","For ADG/standby, account for log transport lag."],"tags":["oracle-cdc","logminer","ora-01291","archive-logs","retry"],"backgroundTag":"sql-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}