{"record":{"id":"2a94b6cbc29ef817","repo":"apache/seatunnel","slug":"cannot-read-the-redo-log-position-via-select-curr","errorCode":null,"errorMessage":"Cannot read the redo log position via 'SELECT CURRENT_SCN FROM V$DATABASE'. Make sure your server is correctly configured","messagePattern":"Cannot read the redo log position via 'SELECT CURRENT_SCN FROM V\\$DATABASE'\\. Make sure your server is correctly configured","errorType":"exception","errorClass":"SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/utils/OracleConnectionUtils.java","lineNumber":81,"sourceCode":"\n    /** Fetch current redoLog offsets in Oracle Server. */\n    public static RedoLogOffset currentRedoLogOffset(JdbcConnection jdbc) {\n        try {\n            return jdbc.queryAndMap(\n                    SHOW_CURRENT_SCN,\n                    rs -> {\n                        if (rs.next()) {\n                            final String scn = rs.getString(1);\n                            return new RedoLogOffset(Scn.valueOf(scn).longValue());\n                        } else {\n                            throw new SeaTunnelException(\n                                    \"Cannot read the scn via '\"\n                                            + SHOW_CURRENT_SCN\n                                            + \"'. Make sure your server is correctly configured\");\n                        }\n                    });\n        } catch (SQLException e) {\n            throw new SeaTunnelException(\n                    \"Cannot read the redo log position via '\"\n                            + SHOW_CURRENT_SCN\n                            + \"'. Make sure your server is correctly configured\",\n                    e);\n        }\n    }\n\n    /**\n     * Convert timestamp (milliseconds since epoch) to Oracle SCN.\n     *\n     * @param jdbc JDBC connection\n     * @param timestampMs timestamp in milliseconds since epoch\n     * @param serverTimeZone database server time zone\n     * @return RedoLogOffset with the corresponding SCN\n     */\n    public static RedoLogOffset timestampToScn(\n            JdbcConnection jdbc, long timestampMs, String serverTimeZone) {\n        try {","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/utils/OracleConnectionUtils.java#L63-L99","documentation":"OracleConnectionUtils.currentRedoLogOffset wraps any SQLException from the 'SELECT CURRENT_SCN FROM V$DATABASE' query in a SeaTunnelException with this message. Unlike error 556 (empty result), this is thrown when the query itself fails. It indicates the SCN query could not be executed at all.","triggerScenarios":"SQLException on SELECT CURRENT_SCN FROM V$DATABASE: ORA-00942 (table or view does not exist due to missing privilege), ORA-01017 bad credentials, connection refused/reset, listener down.","commonSituations":"CDC user without SELECT on V_$DATABASE (ORA-00942); wrong service name or credentials; firewall/network blocking the JDBC connection; Oracle instance restarting.","solutions":["Read the wrapped SQLException cause for the exact ORA code","GRANT SELECT ON V_$DATABASE (and SELECT_CATALOG_ROLE) to the CDC user if ORA-00942","Validate JDBC URL, service name, username, and password with a SQL client","Check network reachability to the Oracle listener (port 1521 by default)"],"exampleFix":"// before (DBA)\n-- user cannot query V$DATABASE -> ORA-00942\n// after\nGRANT SELECT ON V_$DATABASE TO seatunnel_user;","handlingStrategy":"validation","validationCode":"// connectivity + privilege pre-check before job submission\ntry (Connection c = DriverManager.getConnection(url, user, pass);\n     Statement s = c.createStatement()) {\n    s.executeQuery(\"SELECT CURRENT_SCN FROM V$DATABASE\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Offset offset = OracleConnectionUtils.currentRedoLogOffset(conn);\n} catch (SeaTunnelException e) {\n    SQLException sql = (SQLException) e.getCause();\n    LOG.error(\"CURRENT_SCN query failed: ORA-{}\", sql != null ? sql.getErrorCode() : -1, e);\n    throw e;\n}","preventionTips":["Grant SELECT ON V_$DATABASE to avoid ORA-00942","Validate JDBC URL/service name/credentials before running","Confirm firewall allows the Oracle listener port","Check database instance is up and not restarting"],"tags":["oracle-cdc","scn","sql","privileges"],"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"}