{"record":{"id":"86fc2600b3b7f2e2","repo":"apache/seatunnel","slug":"failed-to-calculate-oldest-scn-available-in-logs","errorCode":null,"errorMessage":"Failed to calculate oldest SCN available in logs","messagePattern":"Failed to calculate oldest SCN available in logs","errorType":"exception","errorClass":"DebeziumException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/io/debezium/connector/oracle/logminer/LogMinerStreamingChangeEventSource.java","lineNumber":400,"sourceCode":"    }\n\n    /**\n     * Gets the first system change number in both archive and redo logs.\n     *\n     * @param connection database connection, should not be {@code null}\n     * @return the oldest system change number\n     * @throws SQLException if a database exception occurred\n     * @throws DebeziumException if the oldest system change number cannot be found due to no logs\n     *     available\n     */\n    private Scn getFirstScnInLogs(OracleConnection connection) throws SQLException {\n        String oldestScn =\n                connection.singleOptionalValue(\n                        SqlUtils.oldestFirstChangeQuery(\n                                archiveLogRetention, archiveDestinationName),\n                        rs -> rs.getString(1));\n        if (oldestScn == null) {\n            throw new DebeziumException(\"Failed to calculate oldest SCN available in logs\");\n        }\n        LOGGER.trace(\"Oldest SCN in logs is '{}'\", oldestScn);\n        return Scn.valueOf(oldestScn);\n    }\n\n    private void initializeRedoLogsForMining(\n            OracleConnection connection, boolean postEndMiningSession, Scn startScn)\n            throws SQLException {\n        if (!postEndMiningSession) {\n            if (OracleConnectorConfig.LogMiningStrategy.CATALOG_IN_REDO.equals(strategy)) {\n                buildDataDictionary(connection);\n            }\n            if (!isContinuousMining) {\n                currentLogFiles =\n                        setLogFilesForMining(\n                                connection,\n                                startScn,\n                                archiveLogRetention,","sourceCodeStart":382,"sourceCodeEnd":418,"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#L382-L418","documentation":"During LogMiner streaming startup, the connector queries V$ARCHIVED_LOG (via oldestFirstChangeQuery) to find the oldest SCN still available in archived/online redo logs. When the query returns no row (null SCN), the connector cannot determine where mining can safely start, so it throws this DebeziumException in getFirstScnInLogs. It effectively means Oracle has no redo information available from which to compute a starting point.","triggerScenarios":"getFirstScnInLogs runs the oldestFirstChangeQuery against the archive log destination (filtered by archiveLogRetention and archiveDestinationName) and receives null — no archive logs match the retention/destination filters and no usable SCN can be computed, e.g. right after offset-based restart when archived logs were deleted.","commonSituations":"Archive logs purged by RMAN retention before the connector's offset SCN; archive log destination (log_archive_dest) misconfigured so archiveDestinationName doesn't match; archive logging barely used so V$ARCHIVED_LOG has no rows for the destination; archiveLogRetention set smaller than the gap the connector needs to bridge.","solutions":["Verify archived logs exist: SELECT NAME, FIRST_CHANGE# FROM V$ARCHIVED_LOG WHERE DEST_ID=<archiveDestinationName> ORDER BY FIRST_CHANGE#.","Check archive log destination configuration matches connector's archiveDestinationName (query V$ARCHIVE_DEST / log_archive_dest_1).","Increase archiveLogRetention so the query window covers available logs, or lower the connector's starting SCN (reset offsets to an SCN still present in the logs).","If logs were purged, take a fresh consistent snapshot of the database and restart the connector from the new snapshot SCN.","Ensure ARCHIVELOG mode is enabled and archivelogs are actually being generated (ARCHIVE LOG LIST)."],"exampleFix":"// before: connector fails on start because dest mismatched\n\"archive.destination.name\": \"LOG_ARCHIVE_DEST_2\"\n// after: match actual destination label/name in V$ARCHIVED_LOG\n\"archive.destination.name\": \"LOG_ARCHIVE_DEST_1\"","handlingStrategy":"validation","validationCode":"-- run as the log mining user before starting the connector\nSELECT NVL(MAX(FIRST_CHANGE#), 0) FROM V$ARCHIVED_LOG\n WHERE DEST_ID = 1 AND FIRST_CHANGE# > 0;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep archiveLogRetention generous relative to your snapshot/offiset gap","Monitor V$ARCHIVED_LOG for purge activity vs. connector offset SCN","Pin archiveDestinationName to the real V$ARCHIVE_DEST destination","Alert when RMAN backup/delete policies would remove logs still needed by CDC"],"tags":["oracle","cdc","logminer","archived-log","scn"],"backgroundTag":"empty-result-set","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"}