{"record":{"id":"d243e8718a49032e","repo":"apache/seatunnel","slug":"failed-to-resolve-current-scn","errorCode":null,"errorMessage":"Failed to resolve current SCN","messagePattern":"Failed to resolve current SCN","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":145,"sourceCode":"            OracleConnection connection)\n            throws SQLException {\n\n        final Scn latestTableDdlScn = getLatestTableDdlScn(ctx, connection).orElse(null);\n        final String tableName = getTransactionTableName(connectorConfig);\n\n        final Map<String, Scn> pendingTransactions = new LinkedHashMap<>();\n\n        final Optional<Scn> currentScn;\n        if (isPendingTransactionSkip(connectorConfig)) {\n            currentScn = getCurrentScn(latestTableDdlScn, connection);\n        } else {\n            currentScn =\n                    getPendingTransactions(\n                            latestTableDdlScn, connection, pendingTransactions, tableName);\n        }\n\n        if (!currentScn.isPresent()) {\n            throw new DebeziumException(\"Failed to resolve current SCN\");\n        }\n\n        // The provided snapshot connection already has an in-progress transaction with a save point\n        // that prevents switching from a PDB to the root CDB and if invoking the LogMiner APIs on\n        // such a connection, the use of commit/rollback by LogMiner will drop/invalidate the save\n        // point as well. A separate connection is necessary to preserve the save point.\n        try (OracleConnection conn =\n                new OracleConnection(\n                        connection.config(), () -> getClass().getClassLoader(), false)) {\n            conn.setAutoCommit(false);\n            if (!Strings.isNullOrEmpty(connectorConfig.getPdbName())) {\n                // The next stage cannot be run within the PDB, reset the connection to the CDB.\n                conn.resetSessionToCdb();\n            }\n            return determineSnapshotOffset(\n                    connectorConfig, conn, currentScn.get(), pendingTransactions, tableName);\n        }\n    }","sourceCodeStart":127,"sourceCodeEnd":163,"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#L127-L163","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the Oracle user has LogMiner privileges (LOGMINING, SELECT ANY TRANSACTION, SELECT ON V_$DATABASE etc.)","Check that the database is in ARCHIVELOG mode and redo/archive logs are being generated and accessible","Re-run snapshot; if the issue persists, enable Debezium debug logging for io.debezium.connector.oracle.logminer to see why SCN resolution returned empty","Confirm correct connection to the right PDB/CDB and that the compatible LogMiner adapter is selected"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"-- Run as the connector user BEFORE snapshot:\nSELECT CURRENT_SCN FROM V$DATABASE; -- must succeed\nSELECT LOG_MODE, ARCHIVELOG_MODE FROM V$DATABASE WHERE LOG_MODE='ARCHIVELOG';\n-- privileges check:\nSELECT * FROM SESSION_PRIVS WHERE PRIVILEGE IN ('LOGMINING','SELECT ANY TRANSACTION');","typeGuard":null,"tryCatchPattern":"try {\n    adapter.determineSnapshotOffset(...);\n} catch (DebeziumException e) {\n    if (\"Failed to resolve current SCN\".equals(e.getMessage())) {\n        // verify privileges/archivelog config, then retry snapshot after fixing\n        retrySnapshotAfterChecks();\n    } else { throw e; }\n}","preventionTips":["Grant LogMiner privileges (LOGMINING, SELECT ANY TRANSACTION, SELECT ON V_$DATABASE/V_$LOG etc.)","Keep the database in ARCHIVELOG mode with healthy redo generation","Test SCN queries with the connector user before launching snapshots","Keep Debezium and Oracle LogMiner dictionaries correctly configured"],"tags":["cdc","oracle","logminer","scn","snapshot"],"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"}