---
title: Configure Oracle for ingestion into Databricks
description: Configure your Oracle database for ingestion into Databricks using Lakeflow Connect. Enable archive log mode, supplemental logging, and create a replication user.
canonical_url: https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-setup
---

# Configure Oracle for ingestion into Databricks

> [!NOTE]
> **Beta**
>
> This feature is in [Beta](https://docs.databricks.com/aws/en/release-notes/release-types.md).

This page describes the source database tasks required to ingest from Oracle into Databricks Lakeflow Connect.

The Oracle connector uses [LogMiner](https://docs.oracle.com/en/database/oracle/oracle-database/19/sutil/oracle-logminer-utility.html) in uncommitted transaction mode to read changes from online redo logs and archive logs.

## <a id="requirements" />Requirements

* **Oracle version**: 12c or above (12c, 18c, 19c, 21c, 23ai, and 26ai).
* **Archive log mode**: enabled.
* **Supplemental logging**: enabled for the tables that you want to replicate. Primary-key supplemental logging is the minimum; full supplemental logging is required for tables that get `UPDATE` statements on primary-key or unique-key columns. Minimal supplemental logging alone is not sufficient. See [Which supplemental logging method should I choose?](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-faq.md#which-supplemental-logging-method-should-i-choose).
* **Large object (LOB) logging**: If you replicate `BLOB`, `CLOB`, or `NCLOB` columns, their out-of-row values must be logged. See [Enable logging for LOB columns](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-setup.md#lob-logging).
* A primary (not standby) database. Oracle Real Application Clusters (RAC) and data encrypted with Transparent Data Encryption (TDE) with a closed wallet are not supported.
* For multi-tenant databases, a common user in `CDB$ROOT` with the [required privileges](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-privileges.md).

## <a id="overview" />Overview of source setup

Complete the following tasks in Oracle before you ingest data into Databricks. Run each step as the `SYSDBA` user, or as the `ADMIN` user for Amazon RDS databases.

1. [Verify archive log mode and log retention](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-setup.md#archive-log).
2. [Enable supplemental logging](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-setup.md#supplemental-logging).
3. If you replicate LOB columns, [enable logging for LOB columns](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-setup.md#lob-logging).
4. [Create a replication user using the setup script](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-setup.md#setup-script).
5. [Note the connection details](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-setup.md#connection-details), including the service name and database domain.

## <a id="archive-log" />Step 1: Verify archive log mode and log retention

The Oracle integrated CDC connector reads from archive logs. The following query must return `ARCHIVELOG`:

```sql
SELECT LOG_MODE FROM V$DATABASE;
```

If the query returns `NOARCHIVELOG`, enable archive log mode before continuing.

### Steps to enable archive logs

#### Non-RDS database

For standard Oracle databases:

```sql
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
```

#### Amazon RDS database

For Oracle on AWS RDS, [enable automatic backups](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.Enabling.html).

### Ensure archive log retention

Databricks recommends retaining archive logs for at least 48 hours. If Oracle purges archive logs before the pipeline can process them, you must perform a full refresh on the affected tables. Plan your disk capacity accordingly to store the retained archive log files.

#### Non-RDS database

Run the following in Recovery Manager (RMAN).

```sql
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
```

#### Amazon RDS database

For Oracle on AWS RDS, [refer to AWS docs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.CommonDBATasks.RetainRedoLogs.html).

```sql
BEGIN
    rdsadmin.rdsadmin_util.set_configuration(
        name  => 'archivelog retention hours',
        value => '48');
END;
```

## <a id="supplemental-logging" />Step 2: Enable supplemental logging

The connector requires at least **primary-key supplemental logging** on each table that you replicate. **Full supplemental logging** is required for tables that get `UPDATE` statements on primary-key or unique-key columns. For details, see [Which supplemental logging method should I choose?](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-faq.md#which-supplemental-logging-method-should-i-choose).

> [!NOTE]
>
> The connector also requires minimum supplemental logging enabled at the database level. Without it, LogMiner can't build its dictionary, the connector fails validation, and the source database returns `ORA-01354`. Enabling primary-key or full supplemental logging at either the table or database level enables minimum supplemental logging implicitly. If you haven't enabled any of those, enable it explicitly:
>
> ```sql
> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
> ```
>
> Verify that it is enabled with the following query, which must return `YES` or `IMPLICIT`:
>
> ```sql
> SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
> ```

You can enable supplemental logging on each table, or at the database level so that every table inherits it. The commands differ depending on whether your database runs on Amazon RDS.

To enable primary-key supplemental logging at the table level:

```sql
ALTER TABLE <schema>.<table> ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
```

To enable full supplemental logging at the table level:

```sql
ALTER TABLE <schema>.<table> ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
```

To enable primary-key supplemental logging at the database level (optional; every table inherits it):

### Non-RDS database

```sql
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
```

### Amazon RDS database

```sql
BEGIN
  rdsadmin.rdsadmin_util.alter_supplemental_logging(
    p_action => 'ADD',
    p_type   => 'PRIMARY KEY'
  );
END;
```

Refer to [AWS docs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.CommonDBATasks.Log.html) for more details.

## <a id="lob-logging" />Step 3: Enable logging for LOB columns

Skip this step if you don't replicate `BLOB`, `CLOB`, or `NCLOB` columns. Replication of LOB values stored out of row is in [Beta](https://docs.databricks.com/aws/en/release-notes/release-types.md). For more information, contact your Databricks account team.

Oracle writes LOB values that are stored out of row to the redo log only when one of the following is true:

* The database or the pluggable database (PDB) is in `FORCE LOGGING` mode.
* The column's tablespace is in `FORCE LOGGING` mode, and the PDB isn't in `FORCE NOLOGGING` mode.
* The LOB column is set to `LOGGING`, and the PDB isn't in `FORCE NOLOGGING` mode.

To check the logging setting of each LOB column, run the following query in the PDB that contains the tables. The `LOGGING` column must be `YES`:

```sql
SELECT owner, table_name, column_name, logging, in_row FROM DBA_LOBS WHERE owner = '<schema>';
```

Databricks recommends enabling `LOGGING` on the LOB columns that you replicate. Run the following statement one time for each column, and keep the column's current cache setting (`CACHE`, `NOCACHE`, or `CACHE READS`):

```sql
ALTER TABLE <schema>.<table> MODIFY LOB (<column>) (<cache-setting> LOGGING);
```

If you can't change the columns, enable `FORCE LOGGING` as a last resort. `FORCE LOGGING` logs every change in its scope, which can increase redo volume. Use the narrowest scope that covers the columns, which is the tablespace before the database:

```sql
ALTER TABLESPACE <tablespace> FORCE LOGGING;
```

```sql
ALTER DATABASE FORCE LOGGING;
```

For partitioned tables, LOB logging is set for each partition. Make sure that every partition of the LOB column is `LOGGING` (`LOGGING = 'YES'` in `DBA_LOB_PARTITIONS`) or is in a `FORCE LOGGING` tablespace.

`ALTER TABLE ... MODIFY LOB` statements change only LOB storage, so they don't trigger a full refresh.

When you validate a pipeline, Databricks checks the logging of each LOB column that you select:

| Column setting                                                              | Result                                                                                |
| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| Not logged, and every value is stored out of row (`DISABLE STORAGE IN ROW`) | The table fails validation.                                                           |
| Not logged, and values that fit in the row are stored in the row            | Warning. Values stored out of row would be replicated empty. The table is replicated. |
| Column of a partitioned table                                               | Warning. Logging isn't checked for each partition. The table is replicated.           |

## <a id="setup-script" />Step 4: Create a replication user using the setup script

Databricks provides an Oracle PL/SQL setup tool (`dbx_oracle_setup_util`) that automates user creation and privilege grants for change data capture (CDC). The package exposes the following procedures:

| Procedure                       | Description                                                                                                                                                                                     |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `create_user(...)`              | Creates a CDC replication user with a specified default tablespace, temporary tablespace, and unlimited quota on the default tablespace.                                                        |
| `grant_permissions(...)`        | Grants the system and object privileges required for LogMiner CDC. See [Oracle database user requirements](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-privileges.md). |
| `grant_select_permissions(...)` | Grants `SELECT` on every table in a schema.                                                                                                                                                     |
| `grant_select_on_table(...)`    | Grants `SELECT` on a specific table.                                                                                                                                                            |
| `validate_setup(...)`           | Validates the database environment, required database configuration, replication user, and required privileges.                                                                                 |
| `drop_user(...)`                | Drops a previously created replication user. Use this to clean up or to re-create the user.                                                                                                     |

### <a id="install-utility" />Install the setup tool

1. **Download the setup tool: [dbx-oracle-setup-package.sql](https://docs.databricks.com/aws/en/documents/dbx-oracle-setup-package.sql).**
2. Run the script to create the `dbx_oracle_setup_util` PL/SQL package. Run it with `SYSDBA` privileges (or as the `ADMIN` user on Amazon RDS).

   For a multi-tenant database, run the script in the `CDB$ROOT` container.

### <a id="create-user" />Create the replication user

Create a dedicated replication user. The username must be uppercase. For a multi-tenant database (CDB), the username must start with `C##` so that a common user is created. For a non-CDB database, do not use the `C##` prefix.

The following example creates a user named `C##CDCREPL` with default tablespace `USERS` and temporary tablespace `TEMP`:

```sql
BEGIN
  DBX_ORACLE_SETUP_UTIL.CREATE_USER('C##CDCREPL', '<password>', 'USERS', 'TEMP');
END;
/
```

> [!NOTE]
>
> Do not use the `SYS` or `SYSTEM` user for replication.

### <a id="grant-permissions" />Grant database level privileges

Grant the replication user the privileges required for LogMiner CDC. The tool automatically chooses the correct grant method for your environment (standard grants, or Amazon RDS `rdsadmin` grants), and sets `CONTAINER_DATA=ALL` for multi-tenant databases.

```sql
BEGIN
  DBX_ORACLE_SETUP_UTIL.GRANT_PERMISSIONS('C##CDCREPL');
END;
/
```

For the full list of privileges that the tool grants, see [Oracle database user requirements](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-privileges.md).

> [!NOTE]
>
> On Amazon RDS, if preflight fails to read `rdsadmin.rds_configuration` and no snapshot data is published, the replication user is missing `SELECT` on that view, which the connector reads to verify archive log retention. The setup tool grants this automatically. If you provisioned privileges another way, grant it manually as the `ADMIN` user:
>
> ```sql
> GRANT SELECT ON rdsadmin.rds_configuration TO <cdc_user>;
> ```

### <a id="grant-select-on-table" />Grant SELECT privileges on tables

Grant the replication user `SELECT` on every table you replicate. The setup tool provides two procedures for this:

```sql
BEGIN
  -- to grant SELECT on all tables in a schema
  DBX_ORACLE_SETUP_UTIL.GRANT_SELECT_PERMISSIONS('C##CDCREPL', '<schema_to_replicate>', '<container_name>');
  -- to grant SELECT on specific tables in the schema
  DBX_ORACLE_SETUP_UTIL.GRANT_SELECT_ON_TABLE('C##CDCREPL', '<schema_to_replicate>', '<table_name>', '<container_name>');
END;
/
```

For a non-CDB database, omit the `<container_name>` argument.

You can also grant `SELECT` manually on individual tables:

```sql
GRANT SELECT ON <schema>.<table> TO C##CDCREPL;
```

The UI can only show tables that the replication user has `SELECT` permission on.

> [!NOTE]
>
> Oracle's `SELECT ANY TABLE` privilege grants read access to every table in the database in one statement. Avoid it outside of a development database, because it exposes tables that you might not want the replication user to read.

### <a id="validate-setup" />Validate the setup

Validate the database environment, required database configuration, replication user, and required privileges:

```sql
BEGIN
  DBX_ORACLE_SETUP_UTIL.VALIDATE_SETUP('C##CDCREPL');
END;
/
```

## <a id="connection-details" />Step 5: Note the connection details

When you create the Unity Catalog connection, you need the following details about your Oracle database. See [Create an Oracle connection](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-connection.md).

### <a id="service-name" />Service name

The connector connects to Oracle using a **service name**.

* For a **single-tenant (non-CDB)** database, use the service name of the database.
* For a **multi-tenant (CDB)** database, use the `CDB$ROOT` service name. The connector connects to `CDB$ROOT` to read changes for all pluggable databases (PDBs), then resolves PDB service names automatically. See [Multi-tenant (CDB) databases](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-setup.md#multi-tenant).

### <a id="db-domain" />Database domain

If your database has the `DB_DOMAIN` initialization parameter set, Oracle registers each service with the listener using a domain-qualified name (for example, `FREEPDB1.example.com` rather than `FREEPDB1`). This is common in environments fronted by Oracle Connection Manager (CMAN).

When `DB_DOMAIN` is set, the `CDB$ROOT` service name that you provide in the Unity Catalog connection must include the domain suffix (for example, `newcorp.example.com`). To check the current value:

```sql
SELECT value FROM v$parameter WHERE name = 'db_domain';
```

The connector automatically appends the discovered `DB_DOMAIN` to PDB service names. You only need to supply the domain-qualified `CDB$ROOT` service name in the connection. For details, see [Create an Oracle connection](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-connection.md).

## <a id="multi-tenant" />Multi-tenant (CDB) databases

For a multi-tenant database:

* Run the setup script in the `CDB$ROOT` container.
* The replication user must be a common user (the `C##` prefix).
* The setup tool sets `CONTAINER_DATA=ALL` on the user so that it can read change data across all containers.
* In the Unity Catalog connection, use the `CDB$ROOT` service name (domain-qualified if `DB_DOMAIN` is set).

Multi-tenant Amazon RDS for Oracle instances are not supported.

## <a id="case-sensitivity" />Case sensitivity

By default, Oracle treats unquoted identifiers as case-insensitive and converts them to uppercase. If you enclose an identifier in double quotes during creation, Oracle preserves the case.

When you create the Unity Catalog connection, use an uppercase username unless the database stores it in lowercase. When you specify schema, table, and column names in your pipeline, the case must match how Oracle stores the identifier.

## <a id="logminer-limitations" />LogMiner limitations

LogMiner does not support the following data types and storage attributes. If a table contains any of these, LogMiner ignores the entire table:

* `BFILE`
* Nested tables and `VARRAY` collections
* Objects with nested tables
* Tables with identity columns
* Temporal validity columns
* `PKREF` columns
* `PKOID` columns (object type columns)
* Nested table attributes and standalone nested table columns

In addition:

* Table and column names cannot exceed 30 characters.
* Data types and features added after Oracle Database 12c Release 2 (12.2) are not supported. This includes `BOOLEAN`, `VECTOR`, and `JSON`.

## <a id="data-type-mappings" />Data type mappings

For the mapping of Oracle data types to Databricks types, see [Oracle integrated CDC connector reference](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-reference.md).

## <a id="next-steps" />Next steps

* Review the [privilege requirements](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-privileges.md).
* [Create an Oracle connection](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/oracle-integrated-connection.md).
