Diagnose SQL Server OPENQUERY Errors That Stop After Some Rows

When OPENQUERY returns a fixed number of Oracle rows and then raises errors 7330 or 7399, the row count is usually where the provider encounters a conversion, LOB, client-library, or data problem—not a SQL Server row limit. Capture the provider detail and isolate the failing projection.

Last updated: November 2, 2026.

DBCC TRACEON (7300, 3604);

SELECT *
FROM OPENQUERY(ORACLE_LINK, '
    SELECT primary_key, simple_text, created_at
    FROM remote_schema.remote_table
    ORDER BY primary_key
');

DBCC TRACEOFF (7300, 3604);

Trace flag 7300 can expose details returned by the OLE DB provider. Run this only in the troubleshooting session, save the complete message, and turn the flags off afterward. Test from the same SQL Server instance and login that runs the failing workload.

Find the column or row that triggers the failure

Microsoft describes error 7399 as a generic linked-server provider error and recommends trace flag 7300 for more detail. Start with a key and simple scalar columns. Then add one remote column at a time, especially large text, binary, timestamp, numeric, and character-set-sensitive values.

Use an ordered key range in the Oracle SQL to bracket the first failing row. Query that row directly from an Oracle client using the same Oracle client installation. This separates bad or unusual remote data from SQL Server’s provider layer.

Verify the provider stack before changing settings

Record the SQL Server service architecture, Oracle client version, OraOLEDB provider version, and Oracle server version. Confirm that the provider and client have matching bitness and that the SQL Server service account resolves the expected Oracle client and network configuration.

Do not treat AllowInProcess or fetch-size changes as universal fixes. Change one setting at a time only after capturing the underlying provider error, then repeat the same ordered query. If a data type causes the failure, cast it on the Oracle side to a supported, bounded type and verify that truncation cannot occur. Continue with safe SQL Server parameters, finding detailed SQL Server errors, and resolving cross-database text conflicts.

Related Web Cheat Sheet guides

Sergey Kornilov

Sergey Kornilov