apache/seatunnel · error

Could not query the view

Error message

Could not query the {} view: {}

What it means

LogMinerAdapter.getPendingTransactions queries an Oracle dictionary view (e.g. v$transaction or a configured transaction table) to map pending transaction XIDs to start SCNs. On SQLException it logs 'Could not query the {view} view' with the SQL message, then rethrows — callers (determineSnapshotOffset) treat it as fatal for snapshot offset computation.

Solutions

  1. Grant the connector user: GRANT SELECT ON v_$transaction TO <user>; plus logmining privileges (SELECT ANY TRANSACTION, LOGMINING).
  2. Verify the Oracle user has SELECT_CATALOG_ROLE and the view exists: SELECT * FROM v$transaction;
  3. Check DB connectivity/session validity; reconnect and retry the snapshot.
  4. Confirm transactionTableName matches a view available in your Oracle edition/version.

Example fix

// before (as SYS)
CREATE USER cdc identified by pwd; GRANT create session TO cdc;
// after
GRANT SELECT ON v_$transaction TO cdc;
GRANT SELECT_CATALOG_ROLE TO cdc;
GRANT LOGMINING TO cdc;
Defensive patterns

Strategy: validation

Validate before calling

SELECT count(*) FROM v$transaction; -- must succeed for the CDC user before snapshot

Try / catch

try { adapter.getPendingTransactions(); } catch (SQLException e) { log.error("Grant SELECT on {} to CDC user", transactionTableName, e); throw e; }

Prevention

When it happens

Trigger: getPendingTransactions executing the SELECT against transactionTableName fails: missing privileges on the view, view not present in the Oracle version, LogMiner not configured, or connection dropped mid-query.

Common situations: User lacks SELECT on V_$TRANSACTION grant; Oracle Express or restricted PDB without required dictionary views; network/session timeout during snapshot; wrong transaction view name in connector config.

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/f44ff6bd6eb5966c. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-oracle/src/main/java/io/debezium/connector/oracle/logminer/LogMinerAdapter.java:230

                    LOGGER.info("NOT EMPTY TRSNASSS: {}", results);
                }
                rs2.close();

                while (rs.next()) {
                    if (currentScn == null) {
                        // Only need to set this once per iteration
                        currentScn = Scn.valueOf(rs.getString(1));
                    }
                    final String pendingTxStartScn = rs.getString(3);
                    if (!Strings.isNullOrEmpty(pendingTxStartScn)) {
                        // There is a pending transaction, capture state
                        transactions.put(
                                HexConverter.convertToHexString(rs.getBytes(2)),
                                Scn.valueOf(pendingTxStartScn));
                    }
                }
            } catch (SQLException e) {
                LOGGER.warn(
                        "Could not query the {} view: {}", transactionTableName, e.getMessage(), e);
                throw e;
            }

        } while (areSameTimestamp(latestTableDdlScn, currentScn, connection));

        for (Map.Entry<String, Scn> transaction : transactions.entrySet()) {
            LOGGER.trace(
                    "\tPending Transaction '{}' started at SCN {}",
                    transaction.getKey(),
                    transaction.getValue());
        }

        return Optional.ofNullable(currentScn);
    }

    private OracleOffsetContext determineSnapshotOffset(
            OracleConnectorConfig connectorConfig,

View on GitHub (pinned to cf67b549a7)