apache/seatunnel · error · SeaTunnelException

Cannot read the redo log position via 'SELECT CURRENT_SCN…

Error message

Cannot read the redo log position via 'SELECT CURRENT_SCN FROM V$DATABASE'. Make sure your server is correctly configured

What it means

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.

Solutions

  1. Read the wrapped SQLException cause for the exact ORA code
  2. GRANT SELECT ON V_$DATABASE (and SELECT_CATALOG_ROLE) to the CDC user if ORA-00942
  3. Validate JDBC URL, service name, username, and password with a SQL client
  4. Check network reachability to the Oracle listener (port 1521 by default)

Example fix

// before (DBA)
-- user cannot query V$DATABASE -> ORA-00942
// after
GRANT SELECT ON V_$DATABASE TO seatunnel_user;
Defensive patterns

Strategy: validation

Validate before calling

// connectivity + privilege pre-check before job submission
try (Connection c = DriverManager.getConnection(url, user, pass);
     Statement s = c.createStatement()) {
    s.executeQuery("SELECT CURRENT_SCN FROM V$DATABASE");
}

Try / catch

try {
    Offset offset = OracleConnectionUtils.currentRedoLogOffset(conn);
} catch (SeaTunnelException e) {
    SQLException sql = (SQLException) e.getCause();
    LOG.error("CURRENT_SCN query failed: ORA-{}", sql != null ? sql.getErrorCode() : -1, e);
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: CDC user without SELECT on V_$DATABASE (ORA-00942); wrong service name or credentials; firewall/network blocking the JDBC connection; Oracle instance restarting.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/2a94b6cbc29ef817. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/oracle/utils/OracleConnectionUtils.java:81

    /** Fetch current redoLog offsets in Oracle Server. */
    public static RedoLogOffset currentRedoLogOffset(JdbcConnection jdbc) {
        try {
            return jdbc.queryAndMap(
                    SHOW_CURRENT_SCN,
                    rs -> {
                        if (rs.next()) {
                            final String scn = rs.getString(1);
                            return new RedoLogOffset(Scn.valueOf(scn).longValue());
                        } else {
                            throw new SeaTunnelException(
                                    "Cannot read the scn via '"
                                            + SHOW_CURRENT_SCN
                                            + "'. Make sure your server is correctly configured");
                        }
                    });
        } catch (SQLException e) {
            throw new SeaTunnelException(
                    "Cannot read the redo log position via '"
                            + SHOW_CURRENT_SCN
                            + "'. Make sure your server is correctly configured",
                    e);
        }
    }

    /**
     * Convert timestamp (milliseconds since epoch) to Oracle SCN.
     *
     * @param jdbc JDBC connection
     * @param timestampMs timestamp in milliseconds since epoch
     * @param serverTimeZone database server time zone
     * @return RedoLogOffset with the corresponding SCN
     */
    public static RedoLogOffset timestampToScn(
            JdbcConnection jdbc, long timestampMs, String serverTimeZone) {
        try {

View on GitHub (pinned to cf67b549a7)