Oracle Database
This connector materializes Estuary collections into tables in an Oracle database.
Prerequisites
To use this connector, you'll need:
- An Oracle database to materialize into, and credentials for a database user.
- The connector supports Oracle Database 23ai and later, including 26ai.
- The database character set must be
AL32UTF8. - The user must be able to create tables in the schema you configure, and must have a quota on that schema's tablespace.
- For standard updates, the connector looks up existing documents using
private temporary tables named
ORA$PTT_FLOW_LOAD_<n>. These tables are only visible to the connector's own session. If your database'sPRIVATE_TEMP_TABLE_PREFIXparameter has been changed from its default ofORA$PTT_, also grant the userSELECTonSYS.V_$PARAMETERso the connector can read the prefix.
- At least one Estuary collection.
Setup
-
Connect to the pluggable database as an administrator and create a user for the connector. By default, the connector creates its tables in this user's own schema.
CREATE USER flow_materialize IDENTIFIED BY "secret";GRANT CREATE SESSION, CREATE TABLE TO flow_materialize;ALTER USER flow_materialize QUOTA UNLIMITED ON USERS;If you want to materialize into a different schema, the user needs privileges on that schema instead. For example:
CREATE ANY TABLE,ALTER ANY TABLE,DROP ANY TABLE,SELECT ANY TABLE,INSERT ANY TABLE,UPDATE ANY TABLEandDELETE ANY TABLE. The schema must already exist, because the connector doesn't create schemas. -
Make sure Estuary can reach your database. You can do either of the following:
-
Allowlist the Estuary IP addresses in your firewall rules.
-
Set up an SSH server for tunneling.
When you fill out the endpoint configuration, add the
networkTunnelsection to enable the SSH tunnel. The SSH Known Hosts field is required. Set it to the output ofssh-keyscanfor your SSH server. The connector uses it to confirm that it's talking to the right server before it sends any database traffic through the tunnel. See Connecting to endpoints on secure networks for more details and a sample.
-
Configuration
Use the properties below to configure an Oracle materialization. Each binding writes one Estuary collection to one table in the database.
Properties
Endpoint
| Property | Title | Description | Type | Required/Default |
|---|---|---|---|---|
/address | Address | Host and port of the database. If you leave out the port, the connector uses 1521. | string | Required |
/user | User | Database user to connect as. | string | Required |
/credentials | Credentials | Credentials for authentication. | object | Required |
/credentials/auth_type | Auth Type | Method to use for authentication. | string | UserPassword |
/credentials/password | Password | Password for the user. | string | Required |
/database | Database | Service name of the database (pluggable database) to materialize to. | string | Required |
/schema | Schema | Schema where the connector creates its tables, including flow_checkpoints_v1. Defaults to the user's own schema. | string | |
/sslmode | SSL Mode | verify-full connects over TLS (TCPS) and checks the server's certificate and host name. require connects over TLS but skips those checks. disable connects over plain TCP. | string | verify-full |
/hardDelete | Hard Delete | When a document is deleted in the source, delete its row from the table. When this is off, the row is kept and its _meta/op column is set to d. | boolean | false |
/networkTunnel | Network Tunnel | Connect to the database through an SSH server that acts as a bastion host for your network. | object | |
/networkTunnel/sshForwarding | SSH Forwarding | object | ||
/networkTunnel/sshForwarding/sshEndpoint | SSH Endpoint | Address of the SSH server, in the form ssh://user@hostname[:port]. | string | |
/networkTunnel/sshForwarding/privateKey | SSH Private Key | Private key used to connect to the SSH server. | string | |
/networkTunnel/sshForwarding/knownHosts | SSH Known Hosts | Host keys of the SSH server in OpenSSH known_hosts format, one per line. This is what ssh-keyscan -p <port> <host> prints. The connector refuses to connect to an SSH server that doesn't present one of these keys. | string | Required when using a tunnel |
Bindings
| Property | Title | Description | Type | Required/Default |
|---|---|---|---|---|
/table | Table | Name of the table to materialize to. The connector creates the table if it doesn't exist yet. | string | Required |
/schema | Alternative Schema | Schema for this table, if it should be different from the endpoint's schema. | string | |
/delta_updates | Delta Update | Use delta updates for this table instead of standard updates. | boolean | false |
Sample
materializations:
${PREFIX}/${mat_name}:
endpoint:
connector:
image: ghcr.io/estuary/materialize-oracle:v1
config:
address: oracle.example.com:1521
user: flow_materialize
credentials:
auth_type: UserPassword
password: secret
database: ORCLPDB1
sslmode: verify-full
bindings:
- resource:
table: ${TABLE_NAME}
source: ${PREFIX}/${COLLECTION_NAME}
TLS
Oracle listens for TLS (TCPS) and plain TCP connections on separate ports,
usually 2484 for TLS and 1521 for plain TCP. Make sure the SSL Mode you
choose matches the port in the address.
verify-fullchecks that the server's certificate is signed by a public certificate authority and that it matches the host in the address. This check still applies when you connect through an SSH tunnel.requireuses TLS but doesn't check the certificate.disableconnects over plain TCP. In this mode the connection is only encrypted if the server asks for Oracle native network encryption, which the connector supports.
Changing the schema
The connector tracks its progress in a table named flow_checkpoints_v1, which
lives in the endpoint's schema. If you change the endpoint's schema, the
connector creates a new, empty flow_checkpoints_v1 table there, and the
materialization starts over from the beginning.
Table and column names
Oracle converts unquoted names to upper case. The connector follows the same rule where it can, so that you can query your tables without quoting names:
- A table or field name that is a valid unquoted Oracle identifier and isn't a
reserved word is stored in upper case. For example,
orderIdbecomesORDERID. - Any other name keeps its exact spelling and case, and you need to quote it in
queries. For example,
_meta/opandorder idmust be written as"_meta/op"and"order id".
Oracle doesn't allow double quotes inside a name, so the connector replaces them with underscores.
Names can be at most 128 bytes long. Non-ASCII characters take more than one byte each, so a name that contains them has to be shorter than 128 characters.
Data types
| Collection type | Oracle column type |
|---|---|
| integer | NUMBER(38,0). If the schema allows values that don't fit in 64 bits, the column is a VARCHAR2, like a string. |
number, or string with format: number | BINARY_DOUBLE |
| boolean | BOOLEAN |
| string | VARCHAR2 of the largest size the database allows. Converted to CLOB if a value is too long (see Long strings). |
string with format: integer | NUMBER(38,0). If the field's maxLength is more than 38, the column is a VARCHAR2, like a string. |
string with format: date | DATE |
string with format: date-time | TIMESTAMP(9) WITH TIME ZONE, stored in UTC |
string with contentEncoding: base64 | BLOB |
| object, array, or a field with multiple types | CLOB containing JSON |
the root document (flow_document) | CLOB containing JSON |
Collection keys
Oracle only allows certain types in a primary key, so key fields are mapped differently:
- String keys, including dates and date-times, are
VARCHAR2(1000 CHAR), whatever the field'smaxLength. - Binary keys are
RAW(2000).
The materialization fails if a key value is longer than its column.
Empty strings
Oracle treats an empty string or an empty binary value as NULL. This has two
consequences:
- String and binary columns always allow
NULL, even when the field is required in the collection. - A key can't be
NULL, so the materialization fails if a string or binary key field has an empty value.
Numbers that become strings
If a field's type changes from number to string, the connector converts the
existing values in the column to text. Numbers are written the same way they
appear in JSON, so 0.1 stays 0.1.
Date limits
Oracle has no year 0, so a date in year 0 is stored as 0001-01-01.
Date-times are converted to UTC and must fall between the years 1 and 9999. A date-time outside that range is stored as the earliest or latest moment Oracle supports.
Long strings
A string column that isn't part of the key starts out as the largest VARCHAR2
the database allows. That is 4000 bytes, or 32767 bytes if the database's
MAX_STRING_SIZE parameter is set to EXTENDED. The connector uses VARCHAR2
rather than CLOB because you can filter, group and compare a VARCHAR2
column like any other text.
If a value turns out to be too long for the column, the connector:
- Rolls back the current transaction.
- Converts the column to a
CLOB. This rewrites the column in every row of the table, so it can take a while on a large table. - Stops with an error that names the column.
The materialization then restarts on its own and retries the transaction, which
now succeeds. Once a column has become a CLOB, it stays a CLOB.
Transactions
The connector writes all the rows of one Estuary transaction in a single Oracle transaction. Your database's undo tablespace needs enough room for the largest of these. Transactions are biggest during the first backfill of a large collection, and when the connector removes old rows after a backfill (see Backfills).
Backfills
When you backfill a collection, the table may still contain rows that were written before the backfill and that the backfill didn't write again. Usually these are documents that no longer exist in the source. Once the backfill completes, the connector removes them from tables that use standard updates:
- With hard deletes enabled, the rows are deleted.
- Without hard deletes, the rows are kept and their
_meta/opcolumn is set tod. This only works if the binding includes the_meta/opfield.
Tables that use delta updates aren't affected.
Delta updates
This connector supports both standard (merge) updates and delta updates. Standard updates are the default.
Reserved words
Oracle reserves words such as DATE, NUMBER and ORDER. If a table or field
name is a reserved word, the connector quotes it, which means it keeps its
exact case and you need to quote it in your queries too. See the
Oracle documentation
for the full list.