Oracle to Snowflake Without GoldenGate: Incremental Sync on an updated_at Cursor

2026-12-02来源 dev.toEnglish
Oracle to Snowflake Without GoldenGate: Incremental Sync on an updated_at Cursor

Most Oracle to Snowflake guides open by asking for the redo log. Oracle GoldenGate reads it under a license, and Debezium reads it through LogMiner with a Kafka cluster behind it. If all you were given is a read-only user, neither is on the table.

What is left is usually a nightly spool to CSV and a COPY INTO. It reloads whole tables, and it never shows an update as a change.

The common ways to move Oracle data into Snowflake:

  • Oracle GoldenGate with its Snowflake handler: reads the redo log and lands changes in native Snowflake tables within seconds, deletes included. You need the GoldenGate license, the handler and staging.
  • Debezium's Oracle connector, Kafka and the Snowflake Kafka connector: seconds of latency from LogMiner, with deletes carried through the connector's tombstone handling. You operate Kafka, Kafka Connect, Debezium and a schema registry.
  • Managed extract, load, transform (ELT): Fivetran, Estuary or Airbyte Cloud. Nothing to host and freshness in minutes by plan, but pricing is per row, per GB or per connector, and the rows land as a second copy inside Snowflake.
  • Manual export: a SQL*Plus spool to CSV on a scheduler, then COPY INTO. Hours to daily, and full reloads only.

The route below needs none of that, and it gives something up in return. OLake Go is an open source (Apache 2.0) tool that reads the tables over a plain Java Database Connectivity (JDBC) connection, copies each one in full, then on every later run fetches only the rows whose updated_at moved. It writes them as Apache Iceberg tables into Horizon, the catalog built into every Snowflake account, so Snowsight shows them as Snowflake-managed tables.

What it gives up: OLake Go has no log-based change data capture (CDC) for Oracle. The cursor column carries the changes, so a hard delete in Oracle never reaches Snowflake.

I ran every step on 2026-10-29: Oracle Database 23ai Free in Docker, OLake Go v1.1.0 through OLake UI, and a Snowflake account on AWS ap-south-1. Every timing and row count below is from that run.

What the Oracle to Snowflake pipeline looks like

  • Source: two tables, customers and orders, in a schema named SHOP, read by a user that can only SELECT.
  • Pipeline: OLake UI and OLake Go in Docker Compose. The first sync reads each table in parallel chunks and records the highest cursor value it saw; later syncs select the rows above that value and upsert them.
  • Destination: a Snowflake database on Snowflake's own catalog and storage. No bucket, no stage and no external volume on your side.

You need: Oracle Database 11g or later reachable over JDBC, a Snowflake account where you can run a one-time setup as ACCOUNTADMIN, Docker, and about 30 minutes.

Step 1: Give Oracle a read-only user and a cursor column

Point OLake Go at tables you already have, or create the two from my run. They sit in the SHOP schema of the pluggable database FREEPDB1:

CREATE TABLE shop.customers ( id NUMBER(10) GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR2(100), email VARCHAR2(200), city VARCHAR2(100), tier VARCHAR2(20), created_at TIMESTAMP DEFAULT SYSTIMESTAMP, updated_at TIMESTAMP DEFAULT SYSTIMESTAMP); CREATE TABLE shop.orders ( id NUMBER(10) GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, customer_id NUMBER(10) REFERENCES shop.customers(id), product VARCHAR2(100), amount NUMBER(10,2), status VARCHAR2(20), created_at TIMESTAMP DEFAULT SYSTIMESTAMP, updated_at TIMESTAMP DEFAULT SYSTIMESTAMP); 

Insert whatever rows you like. My run started with 8 customers and 40 orders. To replay step 7 as written, start with exactly 8 customers, two of them named Liam Carter and Zara Ali, so the ids line up.

Three things have to be true before the first sync:

  • A read-only user with CREATE SESSION plus SELECT on each table. Both the snapshot and the incremental syncs read the tables directly.
  • A cursor column that grows with every change, such as updated_at. Incremental syncs select WHERE cursor > last value.
  • A primary key on every table. OLake Go upserts on it, and without one the changed rows are appended instead.

Run this as a database administrator (DBA):

-- 1. A user for OLake Go CREATE USER olake IDENTIFIED BY "<password>"; GRANT CREATE SESSION TO olake; -- 2. Read access to the tables you sync GRANT SELECT ON shop.customers TO olake; GRANT SELECT ON shop.orders TO olake; GRANT SELECT ANY DICTIONARY TO olake; -- lets discovery read the catalog views 

Then check it:

SELECT username FROM all_users WHERE username = 'OLAKE'; SELECT table_name FROM all_tables WHERE owner = 'SHOP'; 

Look at the first query: the user is stored as OLAKE, in upper case, because it was created without double quotes. That detail comes back in step 3.

⚠️ Deletes do not replicate in incremental mode. A deleted row has no cursor value to read, so it stays in the Snowflake table. Soft-delete in Oracle with a deleted_at column that also bumps updated_at, or schedule an occasional full refresh.

Step 2: Prepare Snowflake

Paste this into a Snowsight worksheet as ACCOUNTADMIN, once per account. It creates the database, the role OLake Go writes as, a service user, the network policy and the token.

USE ROLE ACCOUNTADMIN; CREATE WAREHOUSE IF NOT EXISTS OLAKE_WH WAREHOUSE_SIZE = XSMALL AUTO_SUSPEND = 60 AUTO_RESUME = TRUE; CREATE DATABASE IF NOT EXISTS OLAKE_DEMO; ALTER DATABASE OLAKE_DEMO SET CATALOG = 'SNOWFLAKE'; ALTER DATABASE OLAKE_DEMO SET EXTERNAL_VOLUME = 'SNOWFLAKE_MANAGED'; CREATE ROLE IF NOT EXISTS OLAKE_ROLE; GRANT USAGE, CREATE SCHEMA ON DATABASE OLAKE_DEMO TO ROLE OLAKE_ROLE; GRANT USAGE ON WAREHOUSE OLAKE_WH TO ROLE OLAKE_ROLE; GRANT ROLE OLAKE_ROLE TO ROLE SYSADMIN; CREATE USER IF NOT EXISTS OLAKE_SVC TYPE = SERVICE DEFAULT_ROLE = OLAKE_ROLE; GRANT ROLE OLAKE_ROLE TO USER OLAKE_SVC; -- Snowflake issues a token to a service user only under a network policy. USE SCHEMA OLAKE_DEMO.PUBLIC; CREATE NETWORK RULE IF NOT EXISTS olake_ip MODE = INGRESS TYPE = IPV4 VALUE_LIST = ('<OLake Go egress IP>/32'); CREATE NETWORK POLICY IF NOT EXISTS olake_network_policy ALLOWED_NETWORK_RULE_LIST = ('OLAKE_DEMO.PUBLIC.olake_ip'); ALTER USER OLAKE_SVC SET NETWORK_POLICY = olake_network_policy; -- The two values OLake Go asks for. SELECT CURRENT_ORGANIZATION_NAME() || '-' || CURRENT_ACCOUNT_NAME() AS account_identifier, CURRENT_REGION() AS region; -- The token. Snowflake shows the secret once. ALTER USER OLAKE_SVC ADD PROGRAMMATIC ACCESS TOKEN OLAKE_PAT ROLE_RESTRICTION = 'OLAKE_ROLE' DAYS_TO_EXPIRY = 30; 

Copy three things from the output: the account_identifier, the region and the token secret. On a laptop, curl -s https://checkip.amazonaws.com prints the IP that goes into the network rule.

⚠️ Leave out the network policy and the final statement fails with Network Policy is required when creating a programmatic access token for user OLAKE_SVC.

The pair of ALTER DATABASE statements is why nothing has to be registered later: every table OLake Go creates in OLAKE_DEMO becomes a Snowflake-managed Iceberg table on Snowflake's own storage. ROLE_RESTRICTION pins the token to OLAKE_ROLE, so a leaked token cannot act as ACCOUNTADMIN.

Step 3: Start OLake UI and add the Oracle source

curl -sSL https://raw.githubusercontent.com/datazip-inc/olake-ui/master/docker-compose-v1.yml | docker compose -f - up -d 

Open http://localhost:8000 and log in. Go to Sources, click Create Source, pick Oracle and give the source a name.

My values: host host.docker.internal because Oracle ran in another container, port 1521, connection type Service Name with FREEPDB1, and SSL mode disable. A system identifier (SID) works as the connection type too. The Enable CDC toggle is greyed out and labelled not supported, which is the form telling you the same thing as the intro.

Type the username as OLAKE, in upper case. OLake Go quotes the name when it connects, so Oracle compares it case-sensitively and olake is a different user. My first attempt used lower case and the test came back with ORA-01017: invalid credential or not authorized; logon denied.

Click Set up source. OLake Go tests the connection and saves the source.

OLake UI source form for Oracle on OLake Go v1.1.0 with Enable CDC marked not supported, host host.docker.internal, port 1521, connection type Service Name, service name FREEPDB1 and username OLAKE

Step 4: Add the Horizon destination

Go to Destinations, click Create Destination and pick Apache Iceberg. Choose Horizon as the catalog type and Programmatic Access Token (PAT) as the authentication type, then fill in:

Field Value
Horizon Iceberg REST Catalog URI https://<account_identifier>.snowflakecomputing.com/polaris/api/catalog
Snowflake Database OLAKE_DEMO
Session Role Scope session:role:OLAKE_ROLE
Programmatic Access Token the secret from step 2
Cloud Storage Region the region from step 2, for example AWS_AP_SOUTH_1

OLake UI destination form for the Snowflake Horizon catalog showing the programmatic access token authentication fields

Click Create. OLake Go calls the Horizon endpoint and exchanges the token before it saves, so a blocked IP or a wrong scope shows up here and not halfway through a sync.

Step 5: Create the job and run the first sync

Go to Jobs and click Create Job. I named mine oracle_to_snowflake, gave it a schedule and selected the source and destination from the last two steps.

Under Advanced Settings, set Target Query Engines to Snowflake, plus DuckDB and Apache Spark if they will read the tables too. This is the only format decision in the whole setup. OLake Go works out which Iceberg delete format all the listed engines can read and sets it on every stream.

Click Next to reach the Streams page and tick CUSTOMERS and ORDERS under SHOP. Set the sync mode to Full Refresh + Incremental with UPDATED_AT as the cursor field, and the ingestion mode to Upsert. Leave the Upsert Type as resolved, which was Positional Deletes in my run.

OLake UI Streams Selection page with the SHOP schema, CUSTOMERS and ORDERS ticked, sync mode Full Refresh + Incremental, cursor field UPDATED_AT, ingestion mode Upsert and upsert type Positional Deletes

Click Create Job, then open the job's menu and choose Sync Now. The first run copied 8 customers and 40 orders, 48 records in total, and finished in 22 seconds with container start included.

OLake UI Job Logs and History for oracle_to_snowflake with two completed syncs, runtimes 22s and 17s

The destination schema is named after the job and the source schema, lower-cased: oracle_to_snowflake_shop. The Iceberg DB field at the top of the Streams page changes it before the first sync.

Step 6: Query the tables in Snowsight

SHOW ICEBERG TABLES IN SCHEMA OLAKE_DEMO."oracle_to_snowflake_shop"; SELECT "id", "name", "city", "tier" FROM OLAKE_DEMO."oracle_to_snowflake_shop"."customers" ORDER BY "id"; 

There was no CREATE ICEBERG TABLE and no refresh. SHOW ICEBERG TABLES reports catalog_name = SNOWFLAKE, iceberg_table_type = MANAGED and external_volume_name = SNOWFLAKE_MANAGED for both tables.

Snowsight running SHOW ICEBERG TABLES on the oracle_to_snowflake_shop schema and listing customers and orders with owner OLAKE_ROLE, external volume SNOWFLAKE_MANAGED and table type MANAGED

⚠️ Keep the double quotes. OLake Go creates the schema and tables with lowercase names, and Snowflake upper-cases an unquoted identifier. The result is Object 'OLAKE_DEMO.ORACLE_TO_SNOWFLAKE_SHOP.CUSTOMERS' does not exist or not authorized.

Each table also gets four columns from OLake Go: _olake_id (a hash of the primary key), _op_type, _olake_timestamp and _cdc_timestamp. After the first sync every _op_type is r, a snapshot row.

Step 7: Change rows in Oracle and sync again

Between the two syncs I made 12 changes, 7 inserts and 5 updates. Note that every UPDATE also sets updated_at:

INSERT INTO customers (name, email, city, tier) VALUES ('Maya Patel', 'maya@example.com', 'Pune', 'silver'); INSERT INTO customers (name, email, city, tier) VALUES ('Lucas Silva', 'lucas@example.com', 'São Paulo', 'bronze'); INSERT INTO orders (customer_id, product, amount, status) VALUES (9, 'Laptop', 1299.00, 'placed'); INSERT INTO orders (customer_id, product, amount, status) VALUES (9, 'Mouse', 25.50, 'placed'); INSERT INTO orders (customer_id, product, amount, status) VALUES (10, 'Monitor', 349.99, 'placed'); INSERT INTO orders (customer_id, product, amount, status) VALUES (3, 'Keyboard', 89.00, 'placed'); INSERT INTO orders (customer_id, product, amount, status) VALUES (7, 'Webcam', 79.90, 'placed'); UPDATE customers SET tier = 'gold', updated_at = SYSTIMESTAMP WHERE name = 'Liam Carter'; UPDATE customers SET city = 'Abu Dhabi', updated_at = SYSTIMESTAMP WHERE name = 'Zara Ali'; UPDATE orders SET status = 'delivered', updated_at = SYSTIMESTAMP WHERE id IN (1, 4, 7); COMMIT; 

Choose Sync Now again. The second sync fetched 12 rows (598 bytes) above the saved cursor and finished in 17 seconds.

For customers it wrote one data file with 4 rows: the 2 inserts plus the new versions of the 2 updated rows. One small delete file retires the 2 old versions, and orders has the same shape with 8 rows and 3 deletes. The commit report in the sync log says so directly: addedDataFiles=1, addedRecords=4, addedPositionalDeleteFiles=1, addedPositionalDeletes=2.

OLake UI sync log filtered to the Iceberg commit reports for customers and orders, showing addedDataFiles 1, addedPositionalDeleteFiles 1, addedRecords 4 and 8, and totalEqualityDeletes 0

Now add _op_type and updated_at to the query:

SELECT "id", "name", "city", "tier", "_op_type", "updated_at" FROM OLAKE_DEMO."oracle_to_snowflake_shop"."customers" ORDER BY "id"; 

Snowflake returns 10 rows with no refresh. Liam Carter is gold, Zara Ali moved to Abu Dhabi, and the two new customers are there.

Snowsight query on customers after the incremental sync returning 10 rows, with _op_type u for Liam Carter, Zara Ali, Maya Patel and Lucas Silva and r for the untouched snapshot rows

One thing looks odd at first: the two brand-new customers carry u, not c. In incremental mode OLake Go cannot tell an insert from an update, so every row the second sync brought is marked u. The untouched snapshot rows keep r.

Schema changes. A column added in Oracle shows up in Snowflake after the next sync. Narrowing or incompatible type changes fail the sync instead of corrupting the table.

Read the same tables from DuckDB

The files OLake Go wrote are open Iceberg tables behind Horizon's REST endpoint, so a second engine can read them with nothing exported or copied. DuckDB wants a bearer token instead of the raw PAT, so exchange it first:

curl -s -X POST "https://<account_identifier>.snowflakecomputing.com/polaris/api/catalog/v1/oauth/tokens" \ -H 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode grant_type=client_credentials \ --data-urlencode scope=session:role:OLAKE_ROLE \ --data-urlencode client_secret=<your PAT> 
INSTALL iceberg; LOAD iceberg; INSTALL httpfs; LOAD httpfs; CREATE SECRET horizon_secret (TYPE iceberg, TOKEN '<access_token from /v1/oauth/tokens>'); ATTACH 'OLAKE_DEMO' AS horizon ( TYPE iceberg, ENDPOINT 'https://<account_identifier>.snowflakecomputing.com/polaris/api/catalog', SECRET horizon_secret, ACCESS_DELEGATION_MODE 'vended_credentials' ); SELECT id, name, city, tier FROM horizon.oracle_to_snowflake_shop.customers ORDER BY id; 

DuckDB 1.5.5 shell querying horizon.oracle_to_snowflake_shop.customers and returning the same 10 rows as Snowflake

DuckDB 1.5.5 returned the same 10 customers, and so did Spark 3.5.6 with Iceberg 1.10.0. An orders roll-up by status matched Oracle to the cent in all three engines: 16 delivered for 8659.68, 18 placed for 10522.26 and 11 shipped for 6397.25.

The session token lives about an hour, so re-run the exchange when DuckDB reports an authorization error. This path also needs a Snowflake account hosted on AWS or GCP.

Data types worth knowing

Oracle Snowflake shows Note
NUMBER(n,0), n up to 9 NUMBER(10,0)
NUMBER(n,0), n above 9 NUMBER(19,0)
NUMBER(n,m) with a scale, FLOAT, BINARY_DOUBLE FLOAT stored as doubles; round at query time for exact decimal arithmetic
DATE, every TIMESTAMP variant TIMESTAMP_LTZ(6) UTC; an Oracle DATE carries a time
CLOB, RAW, BLOB, INTERVAL types VARCHAR RAW and BLOB arrive as text; keep large binaries out of the sync

The Snowflake side follows Snowflake's Iceberg data types page.

Tips from the run

  • Index the cursor. Each incremental sync is one range scan per table on updated_at, and an index keeps that scan cheap as the table grows.
  • Set the cursor in every write path. An UPDATE that leaves updated_at alone is invisible to the next sync. A trigger that sets it on UPDATE closes the gap.
  • Put the token renewal on a calendar. The setup asks for 30 days and Snowflake allows 365 at most. An expired token fails the next sync at the catalog handshake, before any data moves.
  • The network policy follows the token everywhere. DuckDB or Spark reading through Horizon must also connect from an IP in olake_ip.
  • Plan for small files. Snowflake compacts manifests on these tables at no cost, but data-file compaction is bundled only when Snowflake alone writes the table (Snowflake docs). Spark's rewrite_data_files works through the same Horizon endpoint.
  • Skip this route when hard deletes must replicate, or when a table has no column that only ever increases. Without a cursor, only Full Refresh works.

How the Oracle to Snowflake options compare

Method Freshness Updates and deletes Where the data lands What you run
GoldenGate with the Snowflake handler seconds, from the redo log yes native Snowflake tables GoldenGate (licensed), its handler and staging
Debezium, Kafka and the Snowflake Kafka connector seconds, from LogMiner yes, with tombstone handling Kafka topics, then Snowflake tables Kafka, Kafka Connect, Debezium, a schema registry
Fivetran, Estuary, Airbyte Cloud minutes, by plan yes, on plans with log-based Oracle capture Snowflake tables (a second copy) nothing; per-row, per-GB or per-connector pricing
Spool to CSV plus COPY INTO hours to daily no, full reloads files you control a script and a scheduler
OLake Go into Horizon (this post) incremental, on a schedule down to one minute inserts and updates that move the cursor; deletes need a soft-delete column Iceberg tables that Snowflake, DuckDB, Spark and Trino read one Docker Compose stack, open source

GoldenGate is the pick when you need log-based capture with hard deletes and already hold the license. The cursor route earns its place when a read-only user is all you can get, or when a second engine needs the same rows without a second copy.

FAQ

Which privileges does the Oracle user need?

CREATE SESSION to log in and SELECT on each table you sync. The setup also grants SELECT ANY DICTIONARY, which lets discovery read the catalog views. Nothing in it touches the redo log or LogMiner.

What happens to a table without a primary key?

It still syncs, but OLake Go has no key to upsert on. Changed rows are appended, so the old version of a row stays next to the new one. Add a primary key in Oracle before the first sync if you want one row per key in Snowflake.

How often can the job run, and what does each run cost Oracle?

The schedule goes down to one minute. Each run is one range scan per table on the cursor column, which is why the index on updated_at matters. Writing does not use a Snowflake warehouse, so Snowflake compute is spent only when you query.

Where to go from here

  • Point the source at your real schema, and check that every table you tick has a primary key and a cursor column your application always sets.
  • Want the files in your own S3 bucket? Use AWS Glue as the catalog; Snowflake then reads the tables through a read-only catalog integration that you refresh after each sync.
  • The full guide, with the Glue variant, the Spark connection and the command-line version of every step, is on olake.io.

If a step behaves differently on your Oracle version, post the error text in the comments and I'll update the tutorial.

原文:https://www.a8q9.cn/en/article/oracle-to-snowflake-without-goldengate-incremental-sync-on-an-updated-at-cursor-0934b7.html

相关文章