{"record":{"id":"f74e84d4daf89a71","repo":"apache/seatunnel","slug":"failed-to-resolve-snapshot-offset","errorCode":null,"errorMessage":"Failed to resolve snapshot offset","messagePattern":"Failed to resolve snapshot offset","errorType":"exception","errorClass":"DebeziumException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/io/debezium/connector/oracle/logminer/LogMinerAdapter.java","lineNumber":389,"sourceCode":"                        rs -> {\n                            while (rs.next()) {\n                                final String transactionId =\n                                        HexConverter.convertToHexString(rs.getBytes(\"XID\"));\n                                final String startScnStr = rs.getString(\"START_SCN\");\n                                if (!Strings.isNullOrBlank(startScnStr)) {\n                                    final Scn startScn = Scn.valueOf(rs.getString(\"START_SCN\"));\n                                    if (!pendingTransactions.containsKey(transactionId)) {\n                                        LOGGER.info(\n                                                \"\\tTransaction '{}' started at SCN '{}'\",\n                                                transactionId,\n                                                startScn);\n                                        pendingTransactions.put(transactionId, startScn);\n                                    }\n                                }\n                            }\n                        });\n            } catch (Exception e) {\n                throw new DebeziumException(\"Failed to resolve snapshot offset\", e);\n            } finally {\n                stopSession(connection);\n            }\n        }\n    }\n\n    private List<LogFile> getMostRecentLogFilesForSearch(List<LogFile> allLogFiles) {\n        Map<Integer, List<LogFile>> recentLogsPerThread = new HashMap<>();\n        for (LogFile logFile : allLogFiles) {\n            if (!recentLogsPerThread.containsKey(logFile.getThread())) {\n                if (logFile.isCurrent()) {\n                    recentLogsPerThread.put(logFile.getThread(), new ArrayList<>());\n                    recentLogsPerThread.get(logFile.getThread()).add(logFile);\n                    final Optional<LogFile> maxArchiveLogFile =\n                            allLogFiles.stream()\n                                    .filter(\n                                            f ->\n                                                    logFile.getThread() == f.getThread()","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/io/debezium/connector/oracle/logminer/LogMinerAdapter.java#L371-L407","documentation":"getPendingTransactionsFromLogs starts a LogMiner session to mine redo logs for transactions that were in-flight during the snapshot, so their start SCNs can be recorded in the offset. Any exception thrown during this log-mining pass (JDBC errors, LogMiner session failures, query errors) is wrapped in this DebeziumException, and the caller determineSnapshotOffset then fails the snapshot.","triggerScenarios":"determineSnapshotOffset -> getPendingTransactionsFromLogs executes the LogMiner mining loop over v$logmnr_contents; the underlying query/session throws (invalid STARTSCN, missing archive logs, ORA- errors from LogMiner, insufficient privileges).","commonSituations":"Required redo/archive logs already purged so the mining window is invalid; LogMiner session start fails due to permissions or dictionary issues; long-running snapshot transactions exceed retained logs; Oracle raises ORA-01291 (missing logfile).","solutions":["Read the wrapped cause for the specific ORA- error and fix accordingly (e.g. restore/pin archive logs for the mining window)","Grant the connector user LogMiner-related privileges and access to the log mining dictionary","Ensure archive logs covering the snapshot SCN range are retained (increase RMAN retention / avoid deleting active logs)","Re-run the snapshot after fixing log retention or privilege issues"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"-- Ensure archive logs covering the snapshot window are retained:\nSELECT NAME, FIRST_CHANGE#, NEXT_CHANGE#, DELETED FROM V$ARCHIVED_LOG ORDER BY FIRST_CHANGE#;\n-- RMAN: CONFIGURE RETENTION POLICY ... ; do not delete logs still needed","typeGuard":null,"tryCatchPattern":"try {\n    adapter.determineSnapshotOffset(...);\n} catch (DebeziumException e) {\n    if (e.getMessage().startsWith(\"Failed to resolve snapshot offset\") && e.getCause() != null) {\n        logOraError(e.getCause()); // inspect ORA- code, fix retention/privileges, then retry snapshot\n    } else { throw e; }\n}","preventionTips":["Retain archive logs well beyond expected snapshot + restart windows","Grant LogMiner dictionary and log access to the mining user","Avoid running extremely long snapshots that outrun log retention; use incremental snapshots","Check V$ARCHIVED_LOG for prematurely deleted logs before snapshotting"],"tags":["cdc","oracle","logminer","scn","snapshot","database"],"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-14T05:17:10.506Z"}