Search Shortcut cmd + k | ctrl + k
oracle

Connect DuckDB directly to Oracle databases for reading and writing tables, with catalog integration, pushdown, spatial geometry, and vector support

Maintainer(s): cofin

Compatibility Matrix

This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.

Platform 1.4.4 1.4.5 1.5.5 1.5.6 2.0.0
Linux AMD64
Linux ARM64
macOS AMD64
macOS ARM64
Windows AMD64
Windows ARM64
WebAssembly

Installing and Loading

INSTALL oracle FROM community;
LOAD oracle;

Example

INSTALL oracle FROM community;
LOAD oracle;

-- Connect with standard credentials
CREATE SECRET my_oracle (
    TYPE oracle,
    HOST 'localhost',
    PORT 1521,
    SERVICE 'FREEPDB1',
    USER 'scott',
    PASSWORD 'tiger'
);
ATTACH '' AS ora (TYPE oracle, SECRET my_oracle);

-- Or connect with an Oracle Wallet (Autonomous Database or TLS)
CREATE SECRET wallet_oracle (
    TYPE oracle,
    SERVICE 'myadb_high',
    USER 'admin',
    PASSWORD 'secret',
    WALLET_PATH '/path/to/wallet'
);
ATTACH '' AS ora_cloud (TYPE oracle, SECRET wallet_oracle);

-- Query attached tables with filter and projection pushdown
SELECT empno, ename, sal
FROM ora.scott.emp
WHERE deptno = 10;

-- Or run direct Oracle SQL
SELECT * FROM oracle_query('ora', 'SELECT empno, ename FROM scott.emp WHERE sal > 2000');

About oracle

The oracle extension connects DuckDB directly to Oracle databases for reading and writing tables, views, materialized views, and synonyms.

Installing and loading the extension requires no Oracle libraries on the host. When opening a connection, the extension loads Oracle Instant Client (19c, 21c, or 23ai) on demand from OCI_LIB_DIR, ORACLE_HOME, or the system library path. It works with local, on-premises, cloud, and Oracle Autonomous Database instances, including connections authenticated with Oracle Wallets.

Key features:

  • Catalog attachment & direct SQL: Attach an Oracle database via ATTACH ... (TYPE oracle) to query tables directly, or run raw SQL with oracle_query and oracle_execute.
  • Optimizer pushdown: Pushes WHERE filters, column projections, table row-count estimates, and flashback queries (AS OF SCN and AS OF TIMESTAMP) down to Oracle.
  • Rich type mapping: Maps Oracle numeric, temporal, CLOB/BLOB, RAW, JSON, 23ai VECTOR embeddings (LIST(FLOAT)), and SDO_GEOMETRY spatial geometries (GEOMETRY).
  • Batched reads & writes: Uses array fetching for scans and array binding for INSERT INTO writes.

Added Functions

function_name function_type description comment examples
oracle_clear_cache scalar NULL NULL  
oracle_debug_counter scalar NULL NULL  
oracle_debug_last_query scalar NULL NULL  
oracle_debug_partition_metadata scalar NULL NULL  
oracle_debug_reset_stats scalar NULL NULL  
oracle_execute scalar NULL NULL  
oracle_query table NULL NULL  
oracle_scan table NULL NULL  

Overloaded Functions

This extension does not add any function overloads.

Added Types

This extension does not add any types.

Added Settings

name description input_type scope aliases typed_value
oracle_array_size Rows fetched per OCI iteration (used for tuning) UBIGINT GLOBAL [] 256
oracle_call_timeout_ms OCI call timeout in milliseconds (0=disabled) UBIGINT GLOBAL [] 30000
oracle_connection_cache Reuse Oracle connections when possible BOOLEAN GLOBAL [] true
oracle_connection_limit Maximum cached Oracle connections UBIGINT GLOBAL [] 8
oracle_debug_show_queries Log generated Oracle SQL for debugging BOOLEAN GLOBAL [] false
oracle_enable_pushdown Enable Oracle filter/projection pushdown BOOLEAN GLOBAL [] true
oracle_enable_spatial_types Map SDO_GEOMETRY to GEOMETRY type (requires spatial extension) BOOLEAN GLOBAL [] true
oracle_lazy_schema_loading Load only current schema by default BOOLEAN GLOBAL [] true
oracle_metadata_object_types Object types to enumerate (TABLE,VIEW,SYNONYM,MATERIALIZED VIEW) VARCHAR GLOBAL [] TABLE,VIEW,SYNONYM,MATERIALIZED VIEW
oracle_metadata_result_limit Maximum rows returned from metadata queries (0=default bounded limit) UBIGINT GLOBAL [] 10000
oracle_prefetch_memory OCI prefetch memory (bytes, 0=auto) UBIGINT GLOBAL [] 0
oracle_prefetch_rows OCI prefetch row count UBIGINT GLOBAL [] 1024
oracle_stmt_cache_size OCI statement cache size per connection (0=disabled) UBIGINT GLOBAL [] 20
oracle_use_current_schema Resolve unqualified table names to current schema first BOOLEAN GLOBAL [] true
temp_directory Set the directory to which temporary files are written. VARCHAR GLOBAL [] post.db.tmp