// Category: debezium-using
// Type: assembly
[id="debezium-connector-for-oracle"]
= {prodname} Connector for Oracle

:context: oracle
:data-collection: table
:database-port: 1521
:mbean-name: {context}
:connector-class: Oracle
:connector-file: {context}
:connector-name: Oracle
:include-list-example: PUBLIC.INVENTORY
:collection-container: database.schema

ifdef::community[]
:toc:
:toc-placement: macro
:linkattrs:
:icons: font

toc::[]

[[oracle-overview]]
== Overview
endif::community[]

{prodname}'s Oracle connector captures and records row-level changes that occur in databases on an Oracle server,
including tables that are added while the connector is running.
You can configure the connector to emit change events for specific subsets of schemas and tables, or to ignore, mask, or truncate values in specific columns.

ifdef::community[]
For information about the Oracle Database versions that are compatible with this connector, see the link:https://debezium.io/releases/[{prodname} release overview].
endif::community[]
ifdef::product[]
For information about the Oracle Database versions that are compatible with this connector, see the link:{LinkDebeziumSupportedConfigurations}[{NameDebeziumSupportedConfigurations}].
endif::product[]

{prodname} ingests change events from Oracle by using the native LogMiner database package
ifdef::community[]
, the https://docs.oracle.com/database/121/XSTRM/xstrm_intro.htm#XSTRM72647[XStream API], or https://www.bersler.com/openlogreplicator/[OpenLogReplicator].
endif::community[]
ifdef::product[]
.

Information and procedures for using a {prodname} Oracle connector are organized as follows:

  * xref:how-debezium-oracle-connectors-work[]
  * xref:descriptions-of-debezium-oracle-connector-data-change-events[]
  * xref:how-debezium-oracle-connectors-map-data-types[]
  * xref:setting-up-oracle-to-work-with-debezium[]
  * xref:debezium-oracle-connector-converters[]
  * xref:deployment-of-debezium-oracle-connectors[]
  * xref:descriptions-of-debezium-oracle-connector-configuration-properties[]
  * xref:monitoring-debezium-oracle-connector-performance[]
  * xref:debezium-oracle-connector-frequently-asked-questions[]
endif::product[]

// Type: assembly
// ModuleID: how-debezium-oracle-connectors-work
// Title: How {prodname} Oracle connectors work
[[how-the-oracle-connector-works]]
== How the Oracle connector works

To optimally configure and run a {prodname} Oracle connector, it is helpful to understand how the connector performs snapshots, streams change events, determines Kafka topic names, uses metadata, and implements event buffering.

ifdef::product[]
For more information, see the following topics:

* xref:how-debezium-oracle-connectors-perform-database-snapshots[]
* xref:debezium-oracle-ad-hoc-snapshots[]
* xref:debezium-oracle-incremental-snapshots[]
* xref:default-names-of-kafka-topics-that-receive-debezium-oracle-change-event-records[]
* xref:how-debezium-oracle-connectors-expose-database-schema-changes[]
* xref:debezium-oracle-connector-generated-events-that-represent-transaction-boundaries[]
* xref:how-the-debezium-oracle-connector-uses-event-buffering[]

endif::product[]

// Type: concept
// Title: How {prodname} Oracle connectors perform database snapshots
// ModuleID: how-debezium-oracle-connectors-perform-database-snapshots
[[oracle-snapshots]]
=== Snapshots

Typically, the redo logs on an Oracle server are configured to not retain the complete history of the database.
As a result, the {prodname} Oracle connector cannot retrieve the entire history of the database from the logs.
To enable the connector to establish a baseline for the current state of the database, the first time that the connector starts, it performs an initial _consistent snapshot_ of the database.

[NOTE]
====
If the time needed to complete the initial snapshot exceeds the `UNDO_RETENTION` time that is set for the database (fifteen minutes, by default), an ORA-01555 exception can occur.
For more information about the error, and about the steps that you can take to recover from it, see the xref:what-causes-ora-01555-and-how-to-handle-it[Frequently asked questions].
====

[IMPORTANT]
====
During a table's snapshot, it's possible for Oracle to raise an ORA-01466 exception.
This happens when a user modifies the schema of the table or adds, changes, or drops an index or related object associated with the table being snapshot.
In the event this happens, the connector will stop and the initial snapshot will need to be taken from the beginning.

To remediate the problem, you can configure the xref:oracle-property-snapshot-database-errors-max-retries[`snapshot.database.errors.max.retries`] property with a value greater than `0` so that the specific table's snapshot will restart.
While the entire snapshot will not start from the beginning when retrying, the specific table in question will be re-read from the beginning and the table's topic will contain duplicate snapshot events.
====

ifdef::product[]
You can find more information about snapshots in the following sections:

* xref:debezium-oracle-ad-hoc-snapshots[]
* xref:debezium-oracle-incremental-snapshots[]
endif::product[]

// Type: concept
// ModuleID: default-workflow-that-the-oracle-connector-uses-to-perform-an-initial-snapshot
[[default-workflow-for-performing-an-initial-snapshot]]
==== Default workflow that the Oracle connector uses to perform an initial snapshot

The following workflow lists the steps that {prodname} takes to create a snapshot.
These steps describe the process for a snapshot when the xref:{context}-property-snapshot-mode[`snapshot.mode`]  configuration property is set to its default value, which is `initial`.
You can customize the way that the connector creates snapshots by changing the value of the `snapshot.mode` property.
If you configure a different snapshot mode, the connector completes the snapshot by using a modified version of this workflow.

When the snapshot mode is set to the default, the connector completes the following tasks to create a snapshot:

1. Establish a connection to the database.

2. Determine the tables to be captured.
By default, the connector captures all tables except those with xref:schemas-that-the-debezium-oracle-connector-excludes-when-capturing-change-events[schemas that exclude them from capture].
After the snapshot completes, the connector continues to stream data for the specified tables.
If you want the connector to capture data only from specific tables you can direct the connector to capture the data for only a subset of tables or table elements by setting properties such as xref:{context}-property-table-include-list[`table.include.list`] or xref:{context}-property-table-exclude-list[`table.exclude.list`].

3. Obtain a `ROW SHARE MODE` lock on each of the captured tables to prevent structural changes from occurring during creation of the snapshot.
   {prodname} holds the locks for only a short time.

4. Read the current system change number (SCN) position from the server's redo log.

5. Capture the structure of all database tables, or all tables that are designated for capture.
The connector persists schema information in its internal database schema history topic.
The schema history provides information about the structure that is in effect when a change event occurs. +
+
[NOTE]
====
By default, the connector captures the schema of every table in the database that is in capture mode, including tables that are not configured for capture.
If tables are not configured for capture, the initial snapshot captures only their structure; it does not capture any table data.
For more information about why snapshots persist schema information for tables that you did not include in the initial snapshot, see xref:understanding-why-initial-snapshots-capture-the-schema-history-for-all-tables[Understanding why initial snapshots capture the schema for all tables].
====

6. Release the locks obtained in Step 3.
Other database clients can now write to any previously locked tables.

7. At the SCN position that was read in Step 4, the connector scans the tables that are designated for capture (`SELECT * FROM ... AS OF SCN 123`).
During the scan, the connector completes the following tasks:

.. Confirms that the table was created before the snapshot began.
If the table was created after the snapshot began, the connector skips the table.
After the snapshot is complete, and the connector transitions to streaming, it emits change events for any tables that were created after the snapshot began.

.. Produces a `read` event for each row that is captured from a table.
All `read` events contain the same SCN position, which is the SCN position that was obtained in step 4.

.. Emits each `read` event to the Kafka topic for the source table.

.. Releases data table locks, if applicable.

8. Record the successful completion of the snapshot in the connector offsets.

The resulting initial snapshot captures the current state of each row in the captured tables.
From this baseline state, the connector captures subsequent changes as they occur.

After the snapshot process begins, if the process is interrupted due to connector failure, rebalancing, or other reasons, the process restarts after the connector restarts.
After the connector completes the initial snapshot, it continues streaming from the position that it read in Step 3 so that it does not miss any updates.
If the connector stops again for any reason, after it restarts, it resumes streaming changes from where it previously left off.

[id="oracle-connector-snapshot-mode-options"]
.Settings for `snapshot.mode` connector configuration property
[cols="30%a,70%a",options="header"]
|===
|Setting |Description

|`always`
|Perform snapshot on each connector start.
After the snapshot completes, the connector begins to stream event records for subsequent database changes.

|`initial`
|The connector performs a database snapshot as described in the xref:default-workflow-for-performing-an-initial-snapshot[default workflow for creating an initial snapshot].
After the snapshot completes, the connector begins to stream event records for subsequent database changes.

|`initial_only`
|The connector performs a database snapshot and stops before streaming any change event records, not allowing any subsequent change events to be captured.

|`schema_only`
|Deprecated, see `no_data`.

|`no_data`
|The connector captures the structure of all relevant tables, performing all of the steps described in the xref:default-workflow-for-performing-an-initial-snapshot[default snapshot workflow], except that it does not create `READ` events to represent the data set at the point of the connector's start-up (Step 6).

|`schema_only_recovery`
|Deprecated, see `recovery`.

|`recovery`
|Set this option to restore a database schema history topic that is lost or corrupted.
After a restart, the connector runs a snapshot that rebuilds the topic from the source tables.
You can also set the property to periodically prune a database schema history topic that experiences unexpected growth. +
 +
WARNING: Do not use this mode to perform a snapshot if schema changes were committed to the database after the last connector shutdown.

|`when_needed`
|After the connector starts, it performs a snapshot only if it detects one of the following circumstances:

* It cannot detect any topic offsets.
* A previously recorded offset specifies a log position that is not available on the server.

ifdef::community[]
|`configuration_based`
|Set the snapshot mode to `configuration_based` to control snapshot behavior through the set of connector properties that have the prefix 'snapshot.mode.configuration.based'.
endif::community[]

ifdef::community[]
|`custom`
|The `custom` snapshot mode lets you inject your own implementation of the `io.debezium.spi.snapshot.Snapshotter` interface.
Set the `snapshot.mode.custom.name` configuration property to the name provided by the `name()` method of your implementation.
The name is specified on the classpath of your Kafka Connect cluster.
If you use the {prodname} `EmbeddedEngine`, the name is included in the connector JAR file.
For more information, see xref:connector-custom-snapshot[custom snapshotter SPI].
endif::community[]

|===

For more information, see xref:oracle-property-snapshot-mode[`snapshot.mode`] in the table of connector configuration properties.

// ModuleID: oracle-description-of-why-initial-snapshots-capture-the-schema-history-for-all-tables
// Title: Description of why initial snapshots capture the schema history for all tables
// Type: concept
[id="understanding-why-initial-snapshots-capture-the-schema-history-for-all-tables"]
==== Understanding why initial snapshots capture the schema history for all tables

The initial snapshot that a connector runs captures two types of information:

Table data::
Information about `INSERT`, `UPDATE`, and `DELETE` operations in tables that are named in the connector's xref:{context}-property-table-include-list[`table.include.list`] property.
Schema data::
DDL statements that describe the structural changes that are applied to tables.
Schema data is persisted to both the internal schema history topic, and to the connector's schema change topic, if one is configured.

After you run an initial snapshot, you might notice that the snapshot captures schema information for tables that are not designated for capture.
By default, initial snapshots are designed to capture schema information for every table that is present in the database, not only from tables that are designated for capture.
Connectors require that the table's schema is present in the schema history topic before they can capture a table.
By enabling the initial snapshot to capture schema data for tables that are not part of the original capture set, {prodname} prepares the connector to readily capture event data from these tables should that later become necessary.
If the initial snapshot does not capture a table's schema, you must add the schema to the history topic before the connector can capture data from the table.

In some cases, you might want to limit schema capture in the initial snapshot.
This can be useful when you want to reduce the time required to complete a snapshot.
Or when {prodname} connects to the database instance through a user account that has access to multiple logical databases, but you want the connector to capture changes only from tables in a specific logic database.

.Additional information
* xref:oracle-capturing-data-from-tables-not-captured-by-the-initial-snapshot-no-schema-change[Capturing data from tables not captured by the initial snapshot (no schema change)]
* xref:oracle-capturing-data-from-new-tables-with-schema-changes[Capturing data from tables not captured by the initial snapshot (schema change)]
* Setting the xref:{context}-property-database-history-store-only-captured-tables-ddl[`schema.history.internal.store.only.captured.tables.ddl`] property to specify the tables from which to capture schema information.
* Setting the xref:{context}-property-database-history-store-only-captured-databases-ddl[`schema.history.internal.store.only.captured.databases.ddl`] property to specify the logical databases from which to capture schema changes.

// Type: procedure
[id="oracle-capturing-data-from-tables-not-captured-by-the-initial-snapshot-no-schema-change"]
==== Capturing data from tables not captured by the initial snapshot (no schema change)

In some cases, you might want the connector to capture data from a table whose schema was not captured by the initial snapshot.
Depending on the connector configuration, the initial snapshot might capture the table schema only for specific tables in the database.
If the table schema is not present in the history topic, the connector fails to capture the table, and reports a missing schema error.

You might still be able to capture data from the table, but you must perform additional steps to add the table schema.

.Prerequisites

* You want to capture data from a table with a schema that the connector did not capture during the initial snapshot.
* All entries for the table in the transaction log use the same schema.
For information about capturing data from a new table that has undergone structural changes, see xref:oracle-capturing-data-from-new-tables-with-schema-changes[].

.Procedure
1. Stop the connector.
2. Remove the internal database schema history topic that is specified by the xref:{context}-property-database-history-kafka-topic[`schema.history.internal.kafka.topic property`].
3. In the connector configuration:
.. Set the xref:{context}-property-snapshot-mode[`snapshot.mode`] to `recovery`.
.. (Optional) Set the value of xref:{context}-property-database-history-store-only-captured-tables-ddl[`schema.history.internal.store.only.captured.tables.ddl`] to `false` to ensure that in the future the connector can readily capture data for tables that are not currently designated for capture.
Connectors can capture data from a table only if the table's schema history is present in the history topic.
.. Add the tables that you want the connector to capture to `table.include.list`.
4. Restart the connector.
The snapshot recovery process rebuilds the schema history based on the current structure of the tables.
5. (Optional) After the snapshot completes, initiate an xref:debezium-oracle-incremental-snapshots[incremental snapshot] on the newly added tables.
The incremental snapshot first streams the historical data of the newly added tables, and then resumes reading changes from the redo and archive logs for previously configured tables, including changes that occur while that connector was off-line.
6. (Optional) Reset the `snapshot.mode` back to `no_data` to prevent the connector from initiating recovery after a future restart.

// Type: procedure
[id="oracle-capturing-data-from-new-tables-with-schema-changes"]
==== Capturing data from tables not captured by the initial snapshot (schema change)

If a schema change is applied to a table, records that are committed before the schema change have different structures than those that were committed after the change.
When {prodname} captures data from a table, it reads the schema history to ensure that it applies the correct schema to each event.
If the schema is not present in the schema history topic, the connector is unable to capture the table, and an error results.

If you want to capture data from a table that was not captured by the initial snapshot, and the schema of the table was modified, you must add the schema to the history topic, if it is not already available.
You can add the schema by running a new schema snapshot, or by running an initial snapshot for the table.

.Prerequisites
* You want to capture data from a table with a schema that the connector did not capture during the initial snapshot.
* A schema change was applied to the table so that the records to be captured do not have a uniform structure.

.Procedure

Initial snapshot captured the schema for all tables (`store.only.captured.tables.ddl` was set to `false`)::
1. Edit the xref:oracle-property-table-include-list[`table.include.list`] property to specify the tables that you want to capture.
2. Restart the connector.
3. Initiate an xref:debezium-oracle-incremental-snapshots[incremental snapshot] if you want to capture existing data from the newly added tables.

Initial snapshot did not capture the schema for all tables (`store.only.captured.tables.ddl` was set to `true`)::
If the initial snapshot did not save the schema of the table that you want to capture, complete one of the following procedures:

Procedure 1: Schema snapshot, followed by incremental snapshot:::
In this procedure, the connector first performs a schema snapshot.
You can then initiate an incremental snapshot to enable the connector to synchronize data.
1. Stop the connector.
2. Remove the internal database schema history topic that is specified by the xref:{context}-property-database-history-kafka-topic[`schema.history.internal.kafka.topic property`].
3. Clear the offsets in the configured Kafka Connect link:{link-kafka-docs}/#connectconfigs_offset.storage.topic[`offset.storage.topic`].
For more information about how to remove offsets, see the link:https://debezium.io/documentation/faq/#how_to_remove_committed_offsets_for_a_connector[{prodname} community FAQ].
+
[WARNING]
====
Removing offsets should be performed only by advanced users who have experience in manipulating internal Kafka Connect data.
This operation is potentially destructive, and should be performed only as a last resort.
====
4. Set values for properties in the connector configuration as described in the following steps:
.. Set the value of the xref:oracle-property-snapshot-mode[`snapshot.mode`] property to `no_data`.
.. Edit the xref:oracle-property-table-include-list[`table.include.list`] to add the tables that you want to capture.
5. Restart the connector.
6. Wait for {prodname} to capture the schema of the new and existing tables.
Data changes that occurred any tables after the connector stopped are not captured.
7. To ensure that no data is lost, initiate an xref:debezium-oracle-incremental-snapshots[incremental snapshot].

Procedure 2: Initial snapshot, followed by optional incremental snapshot:::
In this procedure the connector performs a full initial snapshot of the database.
As with any initial snapshot, in a database with many large tables, running an initial snapshot can be a time-consuming operation.
After the snapshot completes, you can optionally trigger an incremental snapshot to capture any changes that occur while the connector is off-line.

1. Stop the connector.
2. Remove the internal database schema history topic that is specified by the xref:oracle-property-database-history-kafka-topic[`schema.history.internal.kafka.topic property`].
3. Clear the offsets in the configured Kafka Connect link:{link-kafka-docs}/#connectconfigs_offset.storage.topic[`offset.storage.topic`].
For more information about how to remove offsets, see the link:https://debezium.io/documentation/faq/#how_to_remove_committed_offsets_for_a_connector[{prodname} community FAQ].
+
[WARNING]
====
Removing offsets should be performed only by advanced users who have experience in manipulating internal Kafka Connect data.
This operation is potentially destructive, and should be performed only as a last resort.
====
4. Edit the xref:{context}-property-table-include-list[`table.include.list`] to add the tables that you want to capture.
5. Set values for properties in the connector configuration as described in the following steps:
.. Set the value of the xref:{context}-property-snapshot-mode[`snapshot.mode`] property to `initial`.
.. (Optional) Set xref:{context}-property-database-history-store-only-captured-tables-ddl[`schema.history.internal.store.only.captured.tables.ddl`] to `false`.
6. Restart the connector.
The connector takes a full database snapshot.
After the snapshot completes, the connector transitions to streaming.
7. (Optional) To capture any data that changed while the connector was off-line, initiate an xref:debezium-oracle-incremental-snapshots[incremental snapshot].

// Type: concept
// ModuleID: debezium-oracle-ad-hoc-snapshots
[id="oracle-ad-hoc-snapshots"]
=== Ad hoc snapshots
include::{partialsdir}/modules/all-connectors/con-connector-ad-hoc-snapshots.adoc[leveloffset=+3]

// Type: assembly
// ModuleID: debezium-oracle-incremental-snapshots
[id="debezium-oracle-incremental-snapshots"]
=== Incremental snapshots
include::{partialsdir}/modules/all-connectors/con-connector-incremental-snapshot.adoc[leveloffset=+3]

[WARNING]
====
The {prodname} connector for Oracle does not support schema changes while an incremental snapshot is running.
====

// Type: procedure
[id="oracle-triggering-an-incremental-snapshot"]
==== Triggering an incremental snapshot

include::{partialsdir}/modules/all-connectors/proc-triggering-an-incremental-snapshot-sql.adoc[leveloffset=+3]

// Type: procedure
[id="oracle-incremental-snapshots-additional-conditions"]
==== Running an ad hoc incremental snapshots with `additional-conditions`

include::{partialsdir}/modules/all-connectors/proc-running-an-ad-hoc-snapshot-with-additional-conditions.adoc[leveloffset=+1]


// Type: procedure
[id="oracle-triggering-an-incremental-snapshot-kafka"]
==== Using the Kafka signaling channel to trigger an incremental snapshot

include::{partialsdir}/modules/all-connectors/proc-triggering-an-incremental-snapshot-kafka.adoc[leveloffset=+1]

// Type: procedure
[id="oracle-stopping-an-incremental-snapshot"]
==== Stopping an incremental snapshot

include::{partialsdir}/modules/all-connectors/proc-stopping-an-incremental-snapshot-sql.adoc[leveloffset=+3]

// Type: procedure
[id="oracle-stopping-an-incremental-snapshot-kafka"]
==== Using the Kafka signaling channel to stop an incremental snapshot

include::{partialsdir}/modules/all-connectors/proc-stopping-an-incremental-snapshot-kafka.adoc[leveloffset=+1]

ifdef::community[]
[[connector-custom-snapshot]]
=== Custom snapshotter SPI
include::{partialsdir}/modules/all-connectors/custom-snapshotter-spi.adoc[leveloffset=+3]
endif::community[]

// Type: concept
[id="oracle-blocking-snapshots"]
=== Blocking snapshots

include::{partialsdir}/modules/all-connectors/con-connector-blocking-snapshot.adoc[leveloffset=+3]

// Type: concept
// ModuleID: default-names-of-kafka-topics-that-receive-debezium-oracle-change-event-records
// Title: Default names of Kafka topics that receive {prodname} Oracle change event records
[[oracle-topic-names]]
=== Topic names

By default, the Oracle connector writes change events for all `INSERT`, `UPDATE`, and `DELETE` operations that occur in a table to a single Apache Kafka topic that is specific to that table.
The connector uses the following convention to name change event topics:

_topicPrefix.schemaName.tableName_

The following list provides definitions for the components of the default name:

_topicPrefix_:: The topic prefix as specified by the xref:oracle-property-topic-prefix[`topic.prefix`] connector configuration property.

_schemaName_:: The name of the schema in which the operation occurred.

_tableName_:: The name of the table in which the operation occurred.

For example, if `fulfillment` is the server name, `inventory` is the schema name, and the database contains tables with the names `orders`, `customers`, and `products`,
the {prodname} Oracle connector emits events to the following Kafka topics, one for each table in the database:

----
fulfillment.inventory.orders
fulfillment.inventory.customers
fulfillment.inventory.products
----

The connector applies similar naming conventions to label its internal database schema history topics, xref:oracle-schema-change-topic[schema change topics], and xref:oracle-transaction-metadata[transaction metadata topics].

If the default topic name do not meet your requirements, you can configure custom topic names.
To configure custom topic names, you specify regular expressions in the logical topic routing SMT.
For more information about using the logical topic routing SMT to customize topic naming, see {link-prefix}:{link-topic-routing}#topic-routing[Topic routing].

// Type: concept
// ModuleID: how-debezium-oracle-connectors-handle-database-schema-changes
// Title: How {prodname} Oracle connectors handle database schema changes
[[oracle-schema-history-topic]]
=== Schema history topic

When a database client queries a database, the client uses the database’s current schema.
However, the database schema can be changed at any time, which means that the connector must be able to identify what the schema was at the time each insert, update, or delete operation was recorded.
Also, a connector cannot necessarily apply the current schema to every event.
If an event is relatively old, it's possible that it was recorded before the current schema was applied.

To ensure correct processing of events that occur after a schema change, Oracle includes in the redo log not only the row-level changes that affect the data, but also the DDL statements that are applied to the database.
As the connector encounters these DDL statements in the redo log, it parses them and updates an in-memory representation of each table’s schema.
The connector uses this schema representation to identify the structure of the tables at the time of each insert, update, or delete operation and to produce the appropriate change event.
In a separate database schema history Kafka topic, the connector records all DDL statements along with the position in the redo log where each DDL statement appeared.

When the connector restarts after either a crash or a graceful stop, it starts reading the redo log from a specific position, that is, from a specific point in time.
The connector rebuilds the table structures that existed at this point in time by reading the database schema history Kafka topic and parsing all DDL statements up to the point in the redo log where the connector is starting.

This database schema history topic is internal for internal connector use only.
Optionally, the connector can also xref:oracle-schema-change-topic[emit schema change events to a different topic that is intended for consumer applications].

.Additional resources

* xref:oracle-topic-names[Default names for topics] that receive {prodname} event records.

// Type: concept
// ModuleID: how-debezium-oracle-connectors-expose-database-schema-changes
// Title: How {prodname} Oracle connectors expose database schema changes
[[oracle-schema-change-topic]]
=== Schema change topic

You can configure a {prodname} Oracle connector to produce schema change events that describe structural changes that are applied to tables in the database.
The connector writes schema change events to a Kafka topic named `_<serverName>_`, where `_serverName_` is the namespace that is specified in the xref:oracle-property-topic-prefix[`topic.prefix`] configuration property.

{prodname} emits a new message to the schema change topic whenever it streams data from a new table, or when the structure of the table is altered.

ifdef::community[]
[NOTE]
====
Following a change in table structure, you must follow (the xref:surrogate-schema-evolution[schema evolution procedure]).
====
endif::community[]

Messages that the connector sends to the schema change topic contain a payload, and, optionally, also contain the schema of the change event message.

The schema for the schema change event has the following elements:

`name`:: The name of the schema change event message.
`type`:: The type of the change event message.
`version`:: The version of the schema. The version is an integer that is incremented each time the schema is changed.
`fields`:: The fields that are included in the change event message.

.Example: Schema of the Oracle connector schema change topic
The following example shows a typical schema in JSON format.

[source,json,indent=0,subs="+attributes"]
----
{
  "schema": {
    "type": "struct",
    "fields": [
      {
        "type": "string",
        "optional": false,
        "field": "databaseName"
      }
    ],
    "optional": false,
    "name": "io.debezium.connector.oracle.SchemaChangeKey",
    "version": 1
  },
  "payload": {
    "databaseName": "inventory"
  }
}
----

The payload of a schema change event message includes the following elements:

`ddl`:: Provides the SQL `CREATE`, `ALTER`, or `DROP` statement that results in the schema change.
`databaseName`:: The name of the database to which the statements are applied.
The value of `databaseName` serves as the message key.
`tableChanges`::  A structured representation of the entire table schema after the schema change.
The `tableChanges` field contains an array that includes entries for each column of the table.
Because the structured representation presents data in JSON or Avro format, consumers can easily read messages without first processing them through a DDL parser.

[IMPORTANT]
====
By default, the connector uses the `ALL_TABLES` database view to identify the table names to store in the schema history topic.
Within that view, the connector can access data only from tables that are available to the user account through which it connects to the database.

You can modify settings so that the schema history topic stores a different subset of tables.
Use one of the following methods to alter the set of tables that the topic stores:

* Change the permissions of the account that {prodname} uses to access the database so that a different set of tables are visible in the `ALL_TABLES` view.
* Set the connector property link:#oracle-property-database-history-store-only-captured-tables-ddl[`schema.history.internal.store.only.captured.tables.ddl`] to `true`.
====

[IMPORTANT]
====
When the connector is configured to capture a table, it stores the history of the table's schema changes not only in the schema change topic, but also in an internal database schema history topic.
The internal database schema history topic is for connector use only and it is not intended for direct use by consuming applications.
Ensure that applications that require notifications about schema changes consume that information only from the schema change topic.
====

[IMPORTANT]
====
Never partition the database schema history topic.
For the database schema history topic to function correctly, it must maintain a consistent, global order of the event records that the connector emits to it.

To ensure that the topic is not split among partitions, set the partition count for the topic by using one of the following methods:

* If you create the database schema history topic manually, specify a partition count of `1`.
* If you use the Apache Kafka broker to create the database schema history topic automatically, the topic is created, set the value of the link:{link-kafka-docs}/#brokerconfigs_num.partitions[Kafka `num.partitions`] configuration option to `1`.
====

ifdef::community[]
[WARNING]
====
The schema change topic message format is in an incubating state and might change without notice.
====
endif::community[]


.Example: Message emitted to the Oracle connector schema change topic
The following example shows a typical schema change message in JSON format.
The message contains a logical representation of the table schema.

[source,json,indent=0,subs="+attributes"]
----
{
  "schema": {
  ...
  },
  "payload": {
    "source": {
      "version": "{debezium-version}",
      "connector": "oracle",
      "name": "server1",
      "ts_ms": 1588252618953,
      "ts_us": 1588252618953000,
      "ts_ns": 1588252618953000000,
      "snapshot": "true",
      "db": "ORCLPDB1",
      "schema": "DEBEZIUM",
      "table": "CUSTOMERS",
      "txId" : null,
      "scn" : "1513734",
      "commit_scn": "1513754",
      "lcr_position" : null,
      "rs_id": "001234.00012345.0124",
      "ssn": 1,
      "redo_thread": 1,
      "user_name": "user",
      "row_id": "AAASgjAAMAAAACnAAA"
    },
    "ts_ms": 1588252618953, // <1>
    "ts_us": 1588252618953987, // <1>
    "ts_ns": 1588252618953987512, // <1>
    "databaseName": "ORCLPDB1", // <2>
    "schemaName": "DEBEZIUM", //
    "ddl": "CREATE TABLE \"DEBEZIUM\".\"CUSTOMERS\" \n   (    \"ID\" NUMBER(9,0) NOT NULL ENABLE, \n    \"FIRST_NAME\" VARCHAR2(255), \n    \"LAST_NAME" VARCHAR2(255), \n    \"EMAIL\" VARCHAR2(255), \n     PRIMARY KEY (\"ID\") ENABLE, \n     SUPPLEMENTAL LOG DATA (ALL) COLUMNS\n   ) SEGMENT CREATION IMMEDIATE \n  PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 \n NOCOMPRESS LOGGING\n  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645\n  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1\n  BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)\n  TABLESPACE \"USERS\" ", // <3>
    "tableChanges": [ // <4>
      {
        "type": "CREATE", // <5>
        "id": "\"ORCLPDB1\".\"DEBEZIUM\".\"CUSTOMERS\"", // <6>
        "table": { // <7>
          "defaultCharsetName": null,
          "primaryKeyColumnNames": [ // <8>
            "ID"
          ],
          "columns": [ // <9>
            {
              "name": "ID",
              "jdbcType": 2,
              "nativeType": null,
              "typeName": "NUMBER",
              "typeExpression": "NUMBER",
              "charsetName": null,
              "length": 9,
              "scale": 0,
              "position": 1,
              "optional": false,
              "autoIncremented": false,
              "generated": false
            },
            {
              "name": "FIRST_NAME",
              "jdbcType": 12,
              "nativeType": null,
              "typeName": "VARCHAR2",
              "typeExpression": "VARCHAR2",
              "charsetName": null,
              "length": 255,
              "scale": null,
              "position": 2,
              "optional": false,
              "autoIncremented": false,
              "generated": false
            },
            {
              "name": "LAST_NAME",
              "jdbcType": 12,
              "nativeType": null,
              "typeName": "VARCHAR2",
              "typeExpression": "VARCHAR2",
              "charsetName": null,
              "length": 255,
              "scale": null,
              "position": 3,
              "optional": false,
              "autoIncremented": false,
              "generated": false
            },
            {
              "name": "EMAIL",
              "jdbcType": 12,
              "nativeType": null,
              "typeName": "VARCHAR2",
              "typeExpression": "VARCHAR2",
              "charsetName": null,
              "length": 255,
              "scale": null,
              "position": 4,
              "optional": false,
              "autoIncremented": false,
              "generated": false
            }
          ],
          "attributes": [ // <10>
            {
              "customAttribute": "attributeValue"
            }
          ]
        }
      }
    ]
  }
}
----

.Descriptions of fields in messages emitted to the schema change topic
[cols="1,4,5",options="header"]
|===
|Item |Field name |Description

|1
|`ts_ms`, `ts_us`, `ts_ns`
|Optional field that displays the time at which the connector processed the event.
The time is based on the system clock in the JVM running the Kafka Connect task.

In the source object, ts_ms indicates the time that the change was made in the database. By comparing the value for payload.source.ts_ms with the value for payload.ts_ms, you can determine the lag between the source database update and Debezium.

|2
|`databaseName` +
`schemaName`
|Identifies the database and the schema that contains the change.

|3
|`ddl`
|This field contains the DDL that is responsible for the schema change.

|4
|`tableChanges`
|An array of one or more items that contain the schema changes generated by a DDL command.

|5
|`type`
a|Describes the kind of change. The `type` can be set to one of the following values:

`CREATE`:: Table created.
`ALTER`:: Table modified.
`DROP`:: Table deleted.

|6
|`id`
|Full identifier of the table that was created, altered, or dropped.
In the case of a table rename, this identifier is a concatenation of `_<old>_,_<new>_` table names.

|7
|`table`
|Represents table metadata after the applied change.

|8
|`primaryKeyColumnNames`
|List of columns that compose the table's primary key.

|9
|`columns`
|Metadata for each column in the changed table.

|10
|`attributes`
|Custom attribute metadata for each table change.

|===

In messages that the connector sends to the schema change topic, the message key is the name of the database that contains the schema change.
In the following example, the `payload` field contains the `databaseName` key:

[source,json,indent=0,subs="+attributes"]
----
{
  "schema": {
    "type": "struct",
    "fields": [
      {
        "type": "string",
        "optional": false,
        "field": "databaseName"
      }
    ],
    "optional": false,
    "name": "io.debezium.connector.oracle.SchemaChangeKey",
    "version": 1
  },
  "payload": {
    "databaseName": "ORCLPDB1"
  }
}
----

// Type: assembly
// ModuleID: debezium-oracle-connector-generated-events-that-represent-transaction-boundaries
// Title: {prodname} Oracle connector-generated events that represent transaction boundaries
[[oracle-transaction-metadata]]
=== Transaction Metadata

{prodname} can generate events that represent transaction metadata boundaries and that enrich data change event messages.

[NOTE]
.Limits on when {prodname} receives transaction metadata
====
{prodname} registers and receives metadata only for transactions that occur after you deploy the connector.
Metadata for transactions that occur before you deploy the connector is not available.
====

Database transactions are represented by a statement block that is enclosed between the `BEGIN` and `END` keywords.
{prodname} generates transaction boundary events for the `BEGIN` and `END` delimiters in every transaction.
Transaction boundary events contain the following fields:

`status`:: `BEGIN` or `END`.
`id`:: String representation of the unique transaction identifier.
`ts_ms`:: The time of a transaction boundary event (`BEGIN` or `END` event) at the data source.
If the data source does not provide {prodname} with the event time, then the field instead represents the time at which {prodname} processes the event.
`event_count` (for `END` events):: Total number of events emmitted by the transaction.
`data_collections` (for `END` events):: An array of pairs of `data_collection` and `event_count` elements that indicates the number of events that the connector emits for changes that originate from a data collection.

The following example shows a typical transaction boundary message:

.Example: Oracle connector transaction boundary event

[source,json,indent=0,subs="attributes"]
----
{
  "status": "BEGIN",
  "id": "5.6.641",
  "ts_ms": 1486500577125,
  "event_count": null,
  "data_collections": null
}

{
  "status": "END",
  "id": "5.6.641",
  "ts_ms": 1486500577691,
  "event_count": 2,
  "data_collections": [
    {
      "data_collection": "ORCLPDB1.DEBEZIUM.CUSTOMER",
      "event_count": 1
    },
    {
      "data_collection": "ORCLPDB1.DEBEZIUM.ORDER",
      "event_count": 1
    }
  ]
}
----

Unless overridden via the xref:oracle-property-topic-transaction[`topic.transaction`] option,
the connector emits transaction events to the xref:oracle-property-topic-prefix[`_<topic.prefix>_`]`.transaction` topic.

// Type: concept
// ModuleID: how-the-debezium-oracle-connector-enriches-change-event-messages-with-transaction-metadata
// Title: How the {prodname} Oracle connector enriches change event messages with transaction metadata
==== Change data event enrichment

When transaction metadata is enabled, the data message `Envelope` is enriched with a new `transaction` field.
This field provides information about every event in the form of a composite of fields:

`id`:: String representation of unique transaction identifier.
`total_order`:: The absolute position of the event among all events generated by the transaction.
`data_collection_order`:: The per-data collection position of the event among all events that were emitted by the transaction.

The following example shows a typical transaction event message:

[source,json,indent=0,subs="attributes"]
----
{
  "before": null,
  "after": {
    "pk": "2",
    "aa": "1"
  },
  "source": {
...
  },
  "op": "c",
  "ts_ms": "1580390884335",
  "ts_us": "1580390884335741",
  "ts_ns": "1580390884335741963",
  "transaction": {
    "id": "5.6.641",
    "total_order": "1",
    "data_collection_order": "1"
  }
}
----

[[oracle-logminer-mining-strategies]]
=== LogMiner Mining Strategies

Entries in the Oracle redo logs do not store the original SQL statements that users submit to make DML changes.
Instead, a redo entry holds a set of change vectors and a set of object identifiers that represent the tablespace, table, and columns related to these vectors.
In other words, redo log entries don't include the names of the schemas, tables, or columns affected by DML changes.

The {prodname} Oracle connector uses the xref:oracle-property-log-mining-strategy[`log.mining.strategy`] configuration property to control how Oracle LogMiner handles the lookup of the object identifiers in the change vectors.
In certain situations, one log mining strategy might prove more reliable than another with regard to schema changes.
However, before you choose a log mining strategy, it's important to consider the implications it might have on performance and overhead.

==== Writing the data dictionary to redo logs

The `redo_log_catalog` mining strategy instructs the database to flush a copy of the data dictionary to the redo logs immediately after each redo log switch.
This is the most reliable strategy for tracking schema changes that are interwoven with data changes, because Oracle LogMiner has a way to interpolate between the starting and ending data dictionary states across a series of change vectors.

However, the `redo_log_catalog` mode is also the most expensive, because it requires several key steps to function.
First, this mode requires the data dictionary to be flushed to the redo logs after every log switch.
Flushing the logs after each switch can quickly consume valuable space in the archive log, and the high volume of archive logs might exceed the number that database administrators prepared for.
If you intend to use this mode, coordinate with your database administrators to ensure that the database is configured appropriately.

[IMPORTANT]
====
If you configure the connector to use the `redo_log_catalog` mode, do not use multiple {prodname} Oracle connectors to capture changes from the same logical database.
====

==== Using the online catalog directly

The default strategy mode, `online_catalog`, works differently from the `redo_log_catalog` mode.
When the strategy is set to `online_catalog`, the database never flushes the data dictionary to the redo logs.
Instead, Oracle LogMiner always uses the most current data dictionary state to perform comparisons.
By always using the current dictionary, and eliminating flushing to the redo logs, this strategy requires less overhead, and operates more efficiently.
However, these benefits are offset by the inability to parse interwoven schema changes and data changes.
As a result, this strategy can sometimes result in event failures.

If LogMiner was unable to reconstruct the SQL reliability after a schema change, check the redo logs for evidence.
Look for references to tables with names like `OBJ# 123456` (where the number is the table's object identifier), or for columns with names like `COL1` or `COL2`.
When you configure the connector to use the `online_catalog` strategy, take steps to ensure that the table schema and its indices remain static and free from change.
If the {prodname} connector is configured to use the `online_catalog` mode, and you must apply a schema change, perform the following steps:

1. Wait for the connector to capture all existing data changes (DML).
2. Perform the schema (DDL) change, and then wait for the connector to capture the change.
3. Resume data changes (DML) on the table.

Following this procedure helps to ensure that Oracle LogMiner can safely reconstruct the SQL for all data changes.

ifdef::community[]
==== Hybrid approach

This is a new, experimental strategy that can be enabled by setting the strategy to `hybrid`.
The goal of this strategy is to provide the reliability of the `redo_log_catalog` strategy with the performance and low overhead of the `online_catalog` strategy, without incurring the disadvantages of either strategy.

The `hybrid` strategy works by primarily operating in the `online_catalog` mode, meaning that the {prodname} Oracle connector first delegates event reconstruction to Oracle LogMiner.
If Oracle LogMiner successfully reconstructs the SQL, {prodname} processes the event normally, as if it were configured to use the `online_catalog` strategy.
If the connector detects that Oracle LogMiner could not reconstruct the SQL, the connector attempts to reconstruct the SQL directly by using the schema history for that table object.
The connector reports a failure only if both Oracle LogMiner and the connector are unable to reconstruct the SQL.

[IMPORTANT]
====
You cannot use the `hybrid` mining strategy if the xref:oracle-property-lob-enabled[`lob.enabled`] property is set to `true`.
If you require streaming `CLOB`, `BLOB`, or `XML` data, only the `online_catalog` or `redo_log_catalog` strategies can be used.
====
endif::community[]

[[oracle-logminer-query-modes]]
=== Query Modes

The {prodname} Oracle connector integrates with Oracle LogMiner by default.
This integration requires a specialized set of steps which includes generating a complex JDBC SQL query to ingest the changes recorded in the transaction logs as change events.
The `V$LOGMNR_CONTENTS` view used by the JDBC SQL query does not have any indices to improve the query's performance, and so there are different query modes that can be used that control how the SQL query is generated as a way to improve the query's execution.

The xref:oracle-property-log-mining-query-filter-mode[`log.mining.query.filter.mode`] connector property can be configured with one of the following to influence how the JDBC SQL query is generated:


`none`:: (Default) This mode creates a JDBC query that only filters based on the different operation types, such as inserts, updates, or deletes, at the database level.
When filtering the data based on the schema, table, or username include/exclude lists, this is done during the processing loop within the connector. +
 +
This mode is often useful when capturing a small number of tables from a database that is not heavily saturated with changes.
The generated query is quite simple, and focuses primarily on reading as quickly as possible with low database overhead.

`in`:: This mode creates a JDBC query that filters not only operation types at the database level, but also schema, table, and username include/exclude lists.
The query's predicates are generated using a SQL in-clause based on the values specified in the include/exclude list configuration properties. +
 +
This mode is often useful when capturing a large number of tables from a database that is heavily saturated with changes.
The generated query is much more complex than the `none` mode, and focuses on reducing network overhead and performing as much filtering at the database level as possible. +
 +
Finally, **do not** specify regular expressions as part of schema and table include/exclude configuration properties.
Using regular expressions will cause the connector to not match changes based on these configuration properties, causing changes to be missed.

`regex`:: This mode creates a JDBC query that filters not only operation types at the database level, but also schema, table, and username include/exclude lists.
However, unlike the `in` mode, this mode generates a SQL query using the Oracle `REGEXP_LIKE` operator using a conjunction or disjunction depending on whether include or excluded values are specified. +
 +
This mode is often useful when capturing a variable number of tables that can be identified using a small number of regular expressions.
The generated query is much more complex than any other mode, and focuses on reducing network overhead and performing as much filtering at the database level as possible. +

// Type: concept
// ModuleID: how-the-debezium-oracle-connector-uses-event-buffering
// Title: How the {prodname} Oracle connector uses event buffering
[[oracle-event-buffering]]
=== Event buffering

Oracle writes all changes to the redo logs in the order in which they occur, including changes that are later discarded by a rollback.
As a result, concurrent changes from separate transactions are intertwined.
When the connector first reads the stream of changes, because it cannot immediately determine which changes are committed or rolled back, it temporarily stores the change events in an internal buffer.
After a change is committed, the connector writes the change event from the buffer to Kafka.
The connector drops change events that are discarded by a rollback.

You can configure the buffering mechanism that the connector uses by setting the property xref:oracle-property-log-mining-buffer-type[`log.mining.buffer.type`].

==== Heap
The default buffer type is configured using `memory`.
Under the default `memory` setting, the connector uses the heap memory of the JVM process to allocate and manage buffered event records.
If you use the `memory` buffer setting, be sure that the amount of memory that you allocate to the Java process can accommodate long-running and large transactions in your environment.

ifdef::community[]
[[oracle-event-buffering-infinispan]]
==== Infinispan
The {prodname} Oracle connector can also be configured to use Infinispan as its cache provider, supporting cache stores both locally with embedded mode or remotely on a server cluster.
In order to use Infinispan, the xref:oracle-property-log-mining-buffer-type[`log.mining.buffer.type`] must be configured using either `infinispan_embedded` or `infinispan_remote`.

In order to allow flexibility with Infinispan cache configurations, the connector expects a series of cache configuration properties to be supplied when using Infinispan to buffer event data.
See the xref:oracle-connector-properties[configuration properties] in the `log.mining.buffer.infinispan.cache` namespace.
The contents of these configuration properties depend on whether the connector is to integrate with a remote Infinispan cluster or to use the embedded engine.

For example, the following illustrates what an embedded configuration would look like for the transaction cache property when using Infinispan in embedded mode:

[source,xml]
----
<local-cache name="transactions">
  <persistence passivation="false">
    <file-store read-only="false" preload="true" shared="false">
      <data path="./data"/>
      <index path="./index"/>
    </file-store>
  </persistence>
</local-cache>
----

Looking at the configuration in-depth, the cache is configured to be persistent.
All caches should be configured this way to avoid loss of transaction events across connector restarts if a transaction is in-progress.
Additionally, the location where the cache is kept is defined by the `path` attribute and this should be a shared location accessible all possible runtime environments.

[IMPORTANT]
====
The Infinispan buffer implementation utilizes multiple cache configurations with different names.
There should be a cache defined for `transactions`, `events`, `processed-transactions`, and `schema-changes`.
Each configuration can be tuned to your performance needs or be identical other than the cache name.
====

[NOTE]
====
When supplying XML configuration as a JSON connector property value, line breaks must be omitted or replaced with a `\n` character.
====

Another example, the following illustrates the same cache configured with an Infinispan cluster:

[source,xml]
----
<distributed-cache name="transactions" statistics="true">
  <encoding media-type="application/x-protostream" />
  <persistence passivation="false">
   <file-store read-only="false" preload="true" shared="false">
     <data path="./data"/>
     <index path="./index"/>
   </file-store>
  </persistence>
</distributed-cache>
----

Just like the embedded local-cache configuration from the previous example, this configuration is also defined to be persistent.
All caches should be configured this way to avoid loss of transaction events across connector restarts if a transaction is in-progress.

However, there are a few differences with noting.
First, the cache is defined as a distributed cache rather than a local-cache.
Secondly, the cache is defined to use the `application/x-protostream` encoding, which is required for all Debezium caches.
And lastly, no `path` attribute is necessary on the file store definition since the Infinispan cluster will handle this automatically.

[IMPORTANT]
====
The Infinispan buffer type is considered incubating; the cache formats may change between versions and may require a re-snapshot.
The migration notes will indicate whether this is needed.

Additionally, when removing a {prodname} Oracle connector that uses the Infinispan buffer, the persisted cache files are not removed from disk automatically.
If the same buffer location will be used by a new connector deployment, the files should be removed manually before deploying the new connector.
====

===== Infinispan Hotrod client integration

The {prodname} Oracle connector utilizes the Hotrod client to communicate with the Infinispan cluster.
Any connector property that is prefixed with `log.mining.buffer.infinispan.client.` will be passed directly to the Hotrod client using the `infinispan.client.` namespace, allowing for complete customization of how the client is to interact with the cluster.

There is at least one required configuration property that must be supplied when using this Infinspan mode:

`log.mining.buffer.infinispan.client.hotrod.server_list`::
Specifies the list of Infinispan server hostname and port combinations, using `<hostname>:<port>` format.
endif::community[]

// Type: concept
// ModuleID: debezium-oracle-connector-scn-gap-detection
// Title: How the {prodname} Oracle connector detects gaps in SCN values
[[scn-jumps]]
=== SCN gap detection

When the {prodname} Oracle connector is configured to use LogMiner, it collects change events from Oracle by using a start and end range that is based on system change numbers (SCNs).
The connector manages this range automatically, increasing or decreasing the range depending on whether the connector is able to stream changes in near real-time, or must process a backlog of changes due to the volume of large or bulk transactions in the database.

Under certain circumstances, the Oracle database advances the SCN by an unusually high amount, rather than increasing the SCN value at a constant rate.
Such a jump in the SCN value can occur because of the way that a particular integration interacts with the database, or as a result of events such as hot backups.

The {prodname} Oracle connector relies on the following configuration properties to detect the SCN gap and adjust the mining range.

`log.mining.scn.gap.detection.gap.size.min`:: Specifies the minimum gap size.
`log.mining.scn.gap.detection.time.interval.max.ms`:: Specifies the maximum time interval.

The connector first compares the difference in the number of changes between the current SCN and the highest SCN in the current mining range.
If the difference between the current SCN value and the highest SCN value is greater than the minimum gap size, then the connector has potentially detected a SCN gap.
To confirm whether a gap exists, the connector next compares the timestamps of the current SCN and the SCN at the end of the previous mining range.
If the difference between the timestamps is less than the maximum time interval, then the existence of an SCN gap is confirmed.

When an SCN gap occurs, the {prodname} connector automatically uses the current SCN as the end point for the range of the current mining session.
This allows the connector to quickly catch up to the real-time events without mining smaller ranges in between that return no changes because the SCN value was increased by an unexpectedly large number.
When the connector performs the preceding steps in response to an SCN gap, it ignores the value that is specified by the xref:oracle-property-log-mining-batch-size-max[log.mining.batch.size.max] property.
After the connector finishes the mining session and catches back up to real-time events, it resumes enforcement of the maximum log mining batch size.

[WARNING]
====
SCN gap detection is available only if the large SCN increment occurs while the connector is running and processing near real-time events.
====

// Type: concept
// ModuleID: how-debezium-manages-offsets-in-databases-that-change-infrequently
// Title: How {prodname} manages offsets in databases that change infrequently
[[low-change-frequency-offset-management]]
=== Low change frequency offset management

The {prodname} Oracle connector tracks system change numbers in the connector offsets so that when the connector is restarted, it can begin where it left off.
These offsets are part of each emitted change event; however, when the frequency of database changes are low (every few hours or days), the offsets can become stale and prevent the connector from successfully restarting if the system change number is no longer available in the transaction logs.

For connectors that use non-CDB mode to connect to Oracle, you can enable xref:oracle-property-heartbeat-interval-ms[`heartbeat.interval.ms`] to force the connector to emit a heartbeat event at regular intervals so that offsets remain synchronized.

For connectors that use CDB mode to connect to Oracle, maintaining synchronization is more complicated.
Not only must you set xref:oracle-property-heartbeat-interval-ms[`heartbeat.interval.ms`], but it's also necessary to set xref:oracle-property-heartbeat-action-query[`heartbeat.action.query`].
Specifying both properties is required, because in CDB mode, the connector specifically tracks changes inside the PDB only.
A supplementary mechanism is needed to trigger change events from within the pluggable database.
At regular intervals, the heartbeat action query causes the connector to insert a new table row, or update an existing row in the pluggable database.
{prodname} detects the table changes and emits change events for them, ensuring that offsets remain synchronized, even in pluggable databases that process changes infrequently.

[NOTE]
====
For the connector to use the `heartbeat.action.query` with tables that are not owned by the xref:creating-users-for-the-connector[connector user account], you must grant the connector user permission to run the necessary `INSERT` or `UPDATE` queries on those tables.
====

// Type: assembly
// ModuleID: descriptions-of-debezium-oracle-connector-data-change-events
// Title: Descriptions of {prodname} Oracle connector data change events
[[oracle-events]]
== Data change events

Every data change event that the Oracle connector emits has a key and a value.
The structures of the key and value depend on the table from which the change events originate.
For information about how {prodname} constructs topic names, see xref:oracle-topic-names[Topic names].

[WARNING]
====
The {prodname} Oracle connector ensures that all Kafka Connect _schema names_ are http://avro.apache.org/docs/current/spec.html#names[valid Avro schema names].
This means that the logical server name must start with alphabetic characters or an underscore ([a-z,A-Z,\_]),
and the remaining characters in the logical server name and all characters in the schema and table names must be alphanumeric characters or an underscore ([a-z,A-Z,0-9,\_]).
The connector automatically replaces invalid characters with an underscore character.

Unexpected naming conflicts can result when the only distinguishing characters between multiple logical server names, schema names, or table names are not valid characters, and those characters are replaced with underscores.
====

{prodname} and Kafka Connect are designed around _continuous streams of event messages_.
However, the structure of these events might change over time, which can be difficult for topic consumers to handle.
To facilitate the processing of mutable event structures, each event in Kafka Connect is self-contained.
Every message key and value has two parts: a _schema_ and _payload_.
The schema describes the structure of the payload, while the payload contains the actual data.

[WARNING]
====
Changes that are performed by the `SYS` or `SYSTEM` user accounts are not captured by the connector.
====
ifdef::product[]
The following topics contain more details about data change events:

* xref:about-keys-in-debezium-oracle-connector-change-events[]
* xref:about-values-in-debezium-oracle-connector-change-events[]
endif::product[]

// Type: concept
// ModuleID: about-keys-in-debezium-oracle-connector-change-events
// Title: About keys in {prodname} Oracle connector change events
[[oracle-change-event-keys]]
=== Change event keys

For each changed table, the change event key is structured such that a field exists for each column in the primary key (or unique key constraint) of the table at the time when the event is created.

For example, a `customers` table that is defined in the `inventory` database schema, might have the following change event key:

[source,sql,indent=0]
----
CREATE TABLE customers (
  id NUMBER(9) GENERATED BY DEFAULT ON NULL AS IDENTITY (START WITH 1001) NOT NULL PRIMARY KEY,
  first_name VARCHAR2(255) NOT NULL,
  last_name VARCHAR2(255) NOT NULL,
  email VARCHAR2(255) NOT NULL UNIQUE
);
----

If the value of the xref:oracle-property-topic-prefix[`_<topic.prefix>_`]`.transaction` configuration property is set to `server1`,
the JSON representation for every change event that occurs in the `customers` table in the database features the following key structure:

[source,json,indent=0,sub="attributes"]
----
{
    "schema": {
        "type": "struct",
        "fields": [
            {
                "type": "int32",
                "optional": false,
                "field": "ID"
            }
        ],
        "optional": false,
        "name": "server1.INVENTORY.CUSTOMERS.Key"
    },
    "payload": {
        "ID": 1004
    }
}
----

The `schema` portion of the key contains a Kafka Connect schema that describes the content of the key portion.
In the preceding example, the `payload` value is not optional, the structure is defined by a schema named `server1.DEBEZIUM.CUSTOMERS.Key`, and there is one required field named `id` of type `int32`.
The value of the key's `payload` field indicates that it is indeed a structure (which in JSON is just an object) with a single `id` field, whose value is `1004`.

Therefore, you can interpret this key as describing the row in the `inventory.customers` table (output from the connector named `server1`) whose `id` primary key column had a value of `1004`.

////
[NOTE]
====
Although the `column.exclude.list` configuration property allows you to remove columns from the event values, all columns in a primary or unique key are always included in the event's key.
====

[WARNING]
====
If the table does not have a primary or unique key, then the change event's key is null. This makes sense since the rows in a table without a primary or unique key constraint cannot be uniquely identified.
====
////

// Type: concept
// ModuleID: about-values-in-debezium-oracle-connector-change-events
// Title: About values in {prodname} Oracle connector change events
[[oracle-change-event-values]]
=== Change event values

The structure of a value in a change event message mirrors the structure of the xref:oracle-change-event-keys[message key in the change event] in the message, and contains both a _schema_ section and a _payload_ section.

.Payload of a change event value
An _envelope_ structure in the payload sections of a change event value contains the following fields:

`op`:: A mandatory field that contains a string value describing the type of operation.
The `op` field in the payload of an Oracle connector change event value contains one of the following values: `c` (create or insert), `u` (update), `d` (delete), or `r` (read, which indicates a snapshot).
`before`:: An optional field that, if present, describes the state of the row _before_ the event occurred.
The structure is described by the `server1.INVENTORY.CUSTOMERS.Value` Kafka Connect schema, which the `server1` connector uses for all rows in the `inventory.customers` table.

// [WARNING]
// ====
// Whether or not this field and its elements are available is highly dependent on the https://docs.oracle.com/database/121/SUTIL/GUID-D2DDD67C-E1CC-45A6-A2A7-198E4C142FA3.htm#SUTIL1583[Supplemental Logging] configuration applying to the table.
// ====

`after`:: An optional field that, if present, contains the state of a row _after_ a change occurs.
The structure is described by the same `server1.INVENTORY.CUSTOMERS.Value` Kafka Connect schema that is used for the `before` field.
`source`:: A mandatory field that contains a structure that describes the source metadata for the event.
In the case of the Oracle connector, the structure includes the following fields:
+
* The {prodname} version.
* The connector name.
* Whether the event is part of an ongoing snapshot or not.
* The transaction id (not includes for snapshots).
* The SCN of the change.
* A timestamp that indicates when the record in the source database changed (for snapshots, the timestamp indicates when the snapshot occurred).
* Username who made the change
* The ROWID associated with the row
+
[TIP]
====
The `commit_scn` field is optional and describes the SCN of the transaction commit that the change event participates within.
ifdef::community[]
This field is only present when using the LogMiner connection adapter.
endif::community[]
====
ifdef::community[]
+
[TIP]
====
The `user_name` field is only populated when using the LogMiner connection adapter.
====
endif::community[]

`ts_ms`:: An optional field that, if present, contains the time (based on the system clock in the JVM that runs the Kafka Connect task) at which the connector processed the event.

.Schema of a change event value
The _schema_ portion of the event message's value contains a schema that describes the envelope structure of the payload and the nested fields within it.

ifdef::product[]
For more information about change event values, see the following topics:

* xref:oracle-create-events[_create_ events]
* xref:oracle-update-events[_update_ events]
* xref:oracle-delete-events[_delete_ events]
* xref:oracle-truncate-events[_truncate_ events]
endif::product[]


// Type: continue
[[oracle-create-events]]
=== _create_ events

The following example shows the value of a _create_ event value from the `customers` table that is described in the xref:oracle-change-event-keys[change event keys] example:

[source,json,indent=0,subs="+attributes"]
----
{
    "schema": {
        "type": "struct",
        "fields": [
            {
                "type": "struct",
                "fields": [
                    {
                        "type": "int32",
                        "optional": false,
                        "field": "ID"
                    },
                    {
                        "type": "string",
                        "optional": false,
                        "field": "FIRST_NAME"
                    },
                    {
                        "type": "string",
                        "optional": false,
                        "field": "LAST_NAME"
                    },
                    {
                        "type": "string",
                        "optional": false,
                        "field": "EMAIL"
                    }
                ],
                "optional": true,
                "name": "server1.DEBEZIUM.CUSTOMERS.Value",
                "field": "before"
            },
            {
                "type": "struct",
                "fields": [
                    {
                        "type": "int32",
                        "optional": false,
                        "field": "ID"
                    },
                    {
                        "type": "string",
                        "optional": false,
                        "field": "FIRST_NAME"
                    },
                    {
                        "type": "string",
                        "optional": false,
                        "field": "LAST_NAME"
                    },
                    {
                        "type": "string",
                        "optional": false,
                        "field": "EMAIL"
                    }
                ],
                "optional": true,
                "name": "server1.DEBEZIUM.CUSTOMERS.Value",
                "field": "after"
            },
            {
                "type": "struct",
                "fields": [
                    {
                        "type": "string",
                        "optional": true,
                        "field": "version"
                    },
                    {
                        "type": "string",
                        "optional": false,
                        "field": "name"
                    },
                    {
                        "type": "int64",
                        "optional": true,
                        "field": "ts_ms"
                    },
                    {
                        "type": "int64",
                        "optional": true,
                        "field": "ts_us"
                    },
                    {
                        "type": "int64",
                        "optional": true,
                        "field": "ts_ns"
                    },
                    {
                        "type": "string",
                        "optional": true,
                        "field": "txId"
                    },
                    {
                        "type": "string",
                        "optional": true,
                        "field": "scn"
                    },
                    {
                        "type": "string",
                        "optional": true,
                        "field": "commit_scn"
                    },
                    {
                        "type": "string",
                        "optional": true,
                        "field": "rs_id"
                    },
                    {
                        "type": "int64",
                        "optional": true,
                        "field": "ssn"
                    },
                    {
                        "type": "int32",
                        "optional": true,
                        "field": "redo_thread"
                    },
                    {
                        "type": "string",
                        "optional": true,
                        "field": "user_name"
                    },
                    {
                        "type": "boolean",
                        "optional": true,
                        "field": "snapshot"
                    },
                    {
                        "type": "string",
                        "optional": true,
                        "field": "row_id"
                    }
                ],
                "optional": false,
                "name": "io.debezium.connector.oracle.Source",
                "field": "source"
            },
            {
                "type": "string",
                "optional": false,
                "field": "op"
            },
            {
                "type": "int64",
                "optional": true,
                "field": "ts_ms"
            },
            {
                "type": "int64",
                "optional": true,
                "field": "ts_us"
            },
            {
                "type": "int64",
                "optional": true,
                "field": "ts_ns"
            }
        ],
        "optional": false,
        "name": "server1.DEBEZIUM.CUSTOMERS.Envelope"
    },
    "payload": {
        "before": null,
        "after": {
            "ID": 1004,
            "FIRST_NAME": "Anne",
            "LAST_NAME": "Kretchmar",
            "EMAIL": "annek@noanswer.org"
        },
        "source": {
            "version": "{debezium-version}",
            "name": "server1",
            "ts_ms": 1520085154000,
            "ts_us": 1520085154000000,
            "ts_ns": 1520085154000000000,
            "txId": "6.28.807",
            "scn": "2122185",
            "commit_scn": "2122185",
            "rs_id": "001234.00012345.0124",
            "ssn": 1,
            "redo_thread": 1,
            "user_name": "user",
            "snapshot": false,
            "row_id": "AAASgjAAMAAAACnAAA"
        },
        "op": "c",
        "ts_ms": 1532592105975,
        "ts_us": 1532592105975741,
        "ts_ns": 1532592105975741582
    }
}
----

In the preceding example, notice how the event defines the following schema:

* The _envelope_ (`server1.DEBEZIUM.CUSTOMERS.Envelope`).
* The `source` structure (`io.debezium.connector.oracle.Source`, which is specific to the Oracle connector and reused across all events).
* The table-specific schemas for the `before` and `after` fields.

[TIP]
====
The names of the schemas for the `before` and `after` fields are of the form `_<logicalName>_._<schemaName>_._<tableName>_.Value`, and thus are entirely independent from the schemas for all other tables.
As a result, when you use the {link-prefix}:{link-avro-serialization}#avro-serialization[Avro converter], the Avro schemas for tables in each logical source have their own evolution and history.
====

The `payload` portion of this event's _value_, provides information about the event.
It describes that a row was created (`op=c`), and shows that the `after` field value contains the values that were inserted into the `ID`, `FIRST_NAME`, `LAST_NAME`, and `EMAIL` columns of the row.

[TIP]
====
By default, the JSON representations of events are much larger than the rows that they describe.
The larger size is due to the JSON representation including both the schema and payload portions of a message.
You can use the {link-prefix}:{link-avro-serialization}#avro-serialization[Avro Converter] to decrease the size of messages that the connector writes to Kafka topics.
====

// Type: continue
[[oracle-update-events]]
=== _update_ events

The following example shows an _update_ change event that the connector captures from the same table as the preceding _create_ event.

[source,json,indent=0,subs="+attributes"]
----
{
    "schema": { ... },
    "payload": {
        "before": {
            "ID": 1004,
            "FIRST_NAME": "Anne",
            "LAST_NAME": "Kretchmar",
            "EMAIL": "annek@noanswer.org"
        },
        "after": {
            "ID": 1004,
            "FIRST_NAME": "Anne",
            "LAST_NAME": "Kretchmar",
            "EMAIL": "anne@example.com"
        },
        "source": {
            "version": "{debezium-version}",
            "name": "server1",
            "ts_ms": 1520085811000,
            "ts_us": 1520085811000000,
            "ts_ns": 1520085811000000000,
            "txId": "6.9.809",
            "scn": "2125544",
            "commit_scn": "2125544",
            "rs_id": "001234.00012345.0124",
            "ssn": 1,
            "redo_thread": 1,
            "user_name": "user",
            "snapshot": false,
            "row_id": "AAASgjAAMAAAACnAAA"
        },
        "op": "u",
        "ts_ms": 1532592713485,
        "ts_us": 1532592713485152,
        "ts_ns": 1532592713485152954,
    }
}
----

The payload has the same structure as the payload of a _create_ (insert) event, but the following values are different:

* The value of the `op` field is `u`, signifying that this row changed because of an update.
* The `before` field shows the former state of the row with the values that were present before the `update` database commit.
* The `after` field shows the updated state of the row, with the `EMAIL` value now set to `anne@example.com`.
* The structure of the `source` field includes the same fields as before, but the values are different, because the connector captured the event from a different position in the redo log.
* The `ts_ms` field shows the timestamp that indicates when {prodname} processed the event.

The `payload` section reveals several other useful pieces of information.
For example, by comparing the `before` and `after` structures, we can determine how a row changed as the result of a commit.
The `source` structure provides information about Oracle's record of this change, providing traceability.
It also gives us insight into when this event occurred in relation to other events in this topic and in other topics.
Did it occur before, after, or as part of the same commit as another event?

[NOTE]
====
When the columns for a row's primary/unique key are updated, the value of the row's key changes.
As a result, {prodname} emits _three_ events after such an update:

* A `DELETE` event.
* A xref:oracle-tombstone-events[tombstone event] with the old key for the row.
* An `INSERT` event that provides the new key for the row.
====

// Type: continue
[[oracle-delete-events]]
=== _delete_ events

The following example shows a _delete_ event for the table that is shown in the preceding _create_ and _update_ event examples.
The `schema` portion of the _delete_ event is identical to the `schema` portion for those events.

[source,json,indent=0,subs="+attributes"]
----
{
    "schema": { ... },
    "payload": {
        "before": {
            "ID": 1004,
            "FIRST_NAME": "Anne",
            "LAST_NAME": "Kretchmar",
            "EMAIL": "anne@example.com"
        },
        "after": null,
        "source": {
            "version": "{debezium-version}",
            "name": "server1",
            "ts_ms": 1520085153000,
            "ts_us": 1520085153000000,
            "ts_ns": 1520085153000000000,
            "txId": "6.28.807",
            "scn": "2122184",
            "commit_scn": "2122184",
            "rs_id": "001234.00012345.0124",
            "ssn": 1,
            "redo_thread": 1,
            "user_name": "user",
            "snapshot": false,
            "row_id": "AAASgjAAMAAAACnAAA"
        },
        "op": "d",
        "ts_ms": 1532592105960,
        "ts_us": 1532592105960854,
        "ts_ns": 1532592105960854693
    }
}
----

The `payload` portion of the event reveals several differences when compared to the payload of a _create_ or _update_ event:

* The value of the `op` field is `d`, signifying that the row was deleted.
* The `before` field shows the former state of the row that was deleted with the database commit.
* The value of the `after` field is `null`, signifying that the row no longer exists.
* The structure of the `source` field includes many of the keys that exist in _create_ or _update_ events, but the values in the `ts_ms`, `scn`, and `txId` fields are different.
* The `ts_ms` shows a timestamp that indicates when {prodname} processed this event.

The _delete_ event provides consumers with the information that they require to process the removal of this row.

The Oracle connector's events are designed to work with https://cwiki.apache.org/confluence/display/KAFKA/Log+Compaction[Kafka log compaction],
which allows for the removal of some older messages as long as at least the most recent message for every key is kept.
This allows Kafka to reclaim storage space while ensuring the topic contains a complete dataset and can be used for reloading key-based state.

[[oracle-tombstone-events]]
When a row is deleted, the _delete_ event value shown in the preceding example still works with log compaction, because Kafka is able to remove all earlier messages that use the same key.
The message value must be set to `null` to instruct Kafka to remove _all messages_ that share the same key.
To make this possible, by default, {prodname}'s Oracle connector always follows a _delete_ event with a special _tombstone_ event that has the same key but `null` value.
You can change the default behavior by setting the connector property xref:oracle-property-tombstones-on-delete[`tombstones.on.delete`].

// Type: continue
[[oracle-truncate-events]]
=== _truncate_ events

A  _truncate_ change event signals that a table has been truncated.
The message key is `null` in this case, the message value looks like this:

[source,json,indent=0,subs="+attributes"]
----
{
    "schema": { ... },
    "payload": {
        "before": null,
        "after": null,
        "source": { // <1>
            "version": "{debezium-version}",
            "connector": "oracle",
            "name": "oracle_server",
            "ts_ms": 1638974535000,
            "ts_us": 1638974535000000,
            "ts_ns": 1638974535000000000,
            "snapshot": "false",
            "db": "ORCLPDB1",
            "sequence": null,
            "schema": "DEBEZIUM",
            "table": "TEST_TABLE",
            "txId": "02000a0037030000",
            "scn": "13234397",
            "commit_scn": "13271102",
            "lcr_position": null,
            "rs_id": "001234.00012345.0124",
            "ssn": 1,
            "redo_thread": 1,
            "user_name": "user"
        },
        "op": "t", // <2>
        "ts_ms": 1638974558961, // <3>
        "ts_us": 1638974558961987, // <3>
        "ts_ns": 1638974558961987251, // <3>
        "transaction": null
    }
}
----

.Descriptions of _truncate_ event value fields
[cols="1,2,7",options="header"]
|===
|Item |Field name |Description

|1
|`source`
a|Mandatory field that describes the source metadata for the event. In a _truncate_ event value, the `source` field structure is the same as for _create_, _update_, and _delete_ events for the same table, provides this metadata:

* {prodname} version
* Connector type and name
* Database and table that contains the new row
* Schema name
* If the event was part of a snapshot (always `false` for _truncate_ events)
* ID of the transaction in which the operation was performed
* SCN of the operation
* Timestamp for when the change was made in the database
* Username who performed the change

|2
|`op`
a|Mandatory string that describes the type of operation. The `op` field value is `t`, signifying that this table was truncated.

|3
|`ts_ms`, `ts_us`, `ts_ns`
a|Optional field that displays the time at which the connector processed the event.
The time is based on the system clock in the JVM running the Kafka Connect task. +

In the `source` object, `ts_ms` indicates the time that the change was made in the database. By comparing the value for `payload.source.ts_ms` with the value for `payload.ts_ms`, you can determine the lag between the source database update and {prodname}.

|===

If a single `TRUNCATE` operation affects multiple tables, the connector emits one _truncate_ change event record for each truncated table.

[NOTE]
====
A _truncate_ event represents a change that is made to an entire table and it has no message key.
As a result, for topics with multiple partitions, there is no ordering guarantee for the change events (_create_, _update_, and so forth), or _truncate_ events that pertain to a table.
For example, if a consumer reads events for a table from multiple partitions, it might receive an _update_ event for a table from one partition after it receives a _truncate_ event that deletes all of the data in the table from another partition.
Ordering is guaranteed only for topics that use a single partition.
====

If you do not want the connector to capture _truncate_ events, use the xref:oracle-property-skipped-operations[`skipped.operations`] option to filter them out.

// Type: reference
// ModuleID: how-debezium-oracle-connectors-map-data-types
// Title: How {prodname} Oracle connectors map data types
[[oracle-data-type-mappings]]
== Data type mappings

When the {prodname} {connector-name} connector detects a change in the value of a table row, it emits a change event that represents the change.
Each change event record is structured in the same way as the original table, with the event record containing a field for each column value.
The data type of a table column determines how the connector represents the column's values in change event fields, as shown in the tables in the following sections.

For each column in a table, {prodname} maps the source data type to a _literal type_ and, and in some cases, a _semantic type_, in the corresponding event field.

Literal types:: Describe how the value is literally represented, using one of the following Kafka Connect schema types: `INT8`, `INT16`, `INT32`, `INT64`, `FLOAT32`, `FLOAT64`, `BOOLEAN`, `STRING`, `BYTES`, `ARRAY`, `MAP`, and `STRUCT`.

Semantic types:: Describe how the Kafka Connect schema captures the _meaning_ of the field, by using the name of the Kafka Connect schema for the field.

If the default data type conversions do not meet your needs, you can {link-prefix}:{link-custom-converters}#custom-converters[create a custom converter] for the connector.

For some Oracle large object (CLOB, NCLOB, and BLOB) and numeric data types, you can manipulate the way that the connector performs the type mapping by changing default configuration property settings.
For more information about how {prodname} properties control mappings for these data types, see xref:oracle-binary-character-lob-types[Binary and Character LOB types] and xref:oracle-numeric-types[Numeric types].

ifdef::product[]
For more information about how the {prodname} connector maps Oracle data types, see the following topics:

* xref:oracle-character-types[]
* xref:oracle-binary-character-lob-types[]
* xref:oracle-numeric-types[]
* xref:oracle-boolean-types[]
* xref:oracle-temporal-types[]
* xref:oracle-rowid-types[]
* xref:oracle-user-defined-types[]
* xref:oracle-supplied-types[]
* xref:oracle-default-values[]

endif::product[]

ifdef::community[]
Support for further data types is planned for subsequent releases.
Please file a {jira-url}/browse/DBZ[JIRA issue] for any specific types that might be missing.
endif::community[]

[id="oracle-character-types"]
=== Character types

The following table describes how the connector maps basic character types.

.Mappings for Oracle basic character types
[cols="20%a,15%a,55%a",options="header"]
|===
|Oracle data type
|Literal type (schema type)
|Semantic type (schema name) and Notes

|`CHAR[(M)]`
|`STRING`
|n/a

|`NCHAR[(M)]`
|`STRING`
|n/a

|`NVARCHAR2[(M)]`
|`STRING`
|n/a

|`VARCHAR[(M)]`
|`STRING`
|n/a

|`VARCHAR2[(M)]`
|`STRING`
|n/a

|===

[id="oracle-binary-character-lob-types"]
=== Binary and Character LOB types
ifdef::community[]
[NOTE]
====
Support for `BLOB`, `CLOB`, and `NCLOB` is currently in incubating state, that is, the exact semantics, configuration options and so forth might change in future revisions, based on feedback we receive.
Please let us know if you encounter any problems while using these data types.
====
endif::community[]
ifdef::product[]
[IMPORTANT]
====
Use of the `BLOB`, `CLOB`, and `NCLOB` with the {prodname} Oracle connector is a Technology Preview feature only.
Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete.
Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see link:https://access.redhat.com/support/offerings/techpreview[https://access.redhat.com/support/offerings/techpreview].
====
endif::product[]
The following table describes how the connector maps binary and character large object (LOB) data types.

.Mappings for Oracle binary and character LOB types
[cols="20%a,15%a,55%a",options="header"]
|===
|Oracle data type
|Literal type (schema type)
|Semantic type (schema name) and Notes

|`BFILE`
|n/a
|_This data type is not supported_

|`BLOB`
|`BYTES`
|Depending on the setting of the xref:oracle-property-binary-handling-mode[`binary.handling.mode`] property in the connector configuration, the connector maps LOB values of this type to one of the following semantic types:

* Raw bytes (the default)
* A base64-encoded string
* A base64-url-safe-encoded string
* A hex-encoded string

|`CLOB`
|`STRING`
|n/a

|`LONG`
|n/a
|_This data type is not supported._

|`LONG RAW`
|n/a
|_This data type is not supported._

|`NCLOB`
|`STRING`
|n/a

|`RAW`
|n/a
|Depending on the setting of the xref:oracle-property-binary-handling-mode[`binary.handling.mode`] property in the connector configuration, the connector maps LOB values of this type to one of the following semantic types:

* Raw bytes (the default)
* A base64-encoded string
* A base64-url-safe-encoded string
* A hex-encoded string

|===

[NOTE]
====
Oracle only supplies column values for `CLOB`, `NCLOB`, and `BLOB` data types if they're explicitly set or changed in a SQL statement.
As a result, change events never contain the value of an unchanged `CLOB`, `NCLOB`, or `BLOB` column.
Instead, they contain placeholders as defined by the connector property, `unavailable.value.placeholder`.

If the value of a `CLOB`, `NCLOB`, or `BLOB` column is updated, the new value is placed in the `after` element of the corresponding update change event.
The `before` element contains the unavailable value placeholder.
====

[id="oracle-numeric-types"]
=== Numeric types

The following table describes how the {prodname} Oracle connector maps numeric types.

[NOTE]
====
You can modify the way that the connector maps the Oracle `DECIMAL`, `NUMBER`, `NUMERIC`, and `REAL` data types by changing the value of the connector's xref:oracle-property-decimal-handling-mode[`decimal.handling.mode`] configuration property.
When the property is set to its default value of `precise`, the connector maps these Oracle data types to the Kafka Connect `org.apache.kafka.connect.data.Decimal` logical type, as indicated in the table.
When the value of the property is set to `double` or `string`, the connector uses alternate mappings for some Oracle data types.
For more information, see the _Semantic type and Notes_ column in the following table.
====
.Mappings for Oracle numeric data types
[cols="20%a,15%a,55%a",options="header"]
|===
|Oracle data type
|Literal type (schema type)
|Semantic type (schema name) and Notes

|`BINARY_FLOAT`
|`FLOAT32`
|n/a

|`BINARY_DOUBLE`
|`FLOAT64`
|n/a

|`DECIMAL[(P, S)]`
|`BYTES` / `INT8` / `INT16` / `INT32` / `INT64`
|`org.apache.kafka.connect.data.Decimal` if using `BYTES` +
 +
Handled equivalently to `NUMBER` (note that S defaults to 0 for `DECIMAL`).

When the `decimal.handling.mode` property is set to `double`, the connector represents `DECIMAL` values as Java `double` values with schema type `FLOAT64`.

When the `decimal.handling.mode` property is set to `string`, the connector represents DECIMAL values as their formatted string representation with schema type `STRING`.

|`DOUBLE PRECISION`
|`STRUCT`
|`io.debezium.data.VariableScaleDecimal` +
 +
Contains a structure with two fields: `scale` of type `INT32` that contains the scale of the transferred value and `value` of type `BYTES` containing the original value in an unscaled form.

|`FLOAT[(P)]`
|`STRUCT`
|`io.debezium.data.VariableScaleDecimal` +
 +
Contains a structure with two fields: `scale` of type `INT32` that contains the scale of the transferred value and `value` of type `BYTES` containing the original value in an unscaled form.

|`INTEGER`, `INT`
|`BYTES`
|`org.apache.kafka.connect.data.Decimal` +
 +
`INTEGER` is mapped in Oracle to NUMBER(38,0) and hence can hold values larger than any of the `INT` types could store

|`NUMBER[(P[, *])]`
|`STRUCT`
|`io.debezium.data.VariableScaleDecimal` +
 +
Contains a structure with two fields: `scale` of type `INT32` that contains the scale of the transferred value and `value` of type `BYTES` containing the original value in an unscaled form.

When the `decimal.handling.mode` property is set to `double`, the connector represents `NUMBER` values as Java `double` values with schema type `FLOAT64`.

When the `decimal.handling.mode` property is set to `string`, the connector represents `NUMBER` values as their formatted string representation with schema type `STRING`.

|`NUMBER(P, S \<= 0)`
|`INT8` / `INT16` / `INT32` / `INT64`
|`NUMBER` columns with a scale of 0 represent integer numbers.
A negative scale indicates rounding in Oracle, for example, a scale of -2 causes rounding to hundreds. +
 +
Depending on the precision and scale, one of the following matching Kafka Connect integer type is chosen: +

 * P - S < 3, `INT8` +
 * P - S < 5, `INT16` +
 * P - S < 10, `INT32` +
 * P - S < 19, `INT64` +
 * P - S >= 19, `BYTES` (`org.apache.kafka.connect.data.Decimal`)

When the `decimal.handling.mode` property is set to `double`, the connector represents `NUMBER` values as Java `double` values with schema type `FLOAT64`.

When the `decimal.handling.mode` property is set to `string`, the connector represents `NUMBER` values as their formatted string representation with schema type `STRING`.


|`NUMBER(P, S > 0)`
|`BYTES`
|`org.apache.kafka.connect.data.Decimal`

|`NUMERIC[(P, S)]`
|`BYTES` / `INT8` / `INT16` / `INT32` / `INT64`
|`org.apache.kafka.connect.data.Decimal` if using `BYTES` +
 +
Handled equivalently to `NUMBER` (note that S defaults to 0 for `NUMERIC`).

When the `decimal.handling.mode` property is set to `double`, the connector represents `NUMERIC` values as Java `double` values with schema type `FLOAT64`.

When the `decimal.handling.mode` property is set to `string`, the connector represents `NUMERIC` values as their formatted string representation with schema type `STRING`.

|`SMALLINT`
|`BYTES`
|`org.apache.kafka.connect.data.Decimal` +
 +
`SMALLINT` is mapped in Oracle to NUMBER(38,0) and hence can hold values larger than any of the `INT` types could store

|`REAL`
|`STRUCT`
|`io.debezium.data.VariableScaleDecimal` +
 +
Contains a structure with two fields: `scale` of type `INT32` that contains the scale of the transferred value and `value` of type `BYTES` containing the original value in an unscaled form.

When the `decimal.handling.mode` property is set to `double`, the connector represents `REAL` values as Java `double` values with schema type `FLOAT64`.

When the `decimal.handling.mode` property is set to `string`, the connector represents `REAL` values as their formatted string representation with schema type `STRING`.

|===

As mention above, Oracle allows negative scales in `NUMBER` type.
This can cause an issue during conversion to the Avro format when the number is represented as the `Decimal`.
`Decimal` type includes scale information, but https://avro.apache.org/docs/1.11.1/specification/#decimal[Avro specification] allows only positive values for the scale.
Depending on the schema registry used, it may result into Avro serialization failure.
To avoid this issue, you can use `NumberToZeroScaleConverter`, which converts sufficiently high numbers (P - S >= 19) with negative scale into `Decimal` type with zero scale.
It can be configured as follows:
[source]
----
converters=zero_scale
zero_scale.type=io.debezium.connector.oracle.converters.NumberToZeroScaleConverter
zero_scale.decimal.mode=precise
----

By default, the number is converted to `Decimal` type (`zero_scale.decimal.mode=precise`), but for completeness remaining two supported types (`double` and `string`) are supported as well.

[id="oracle-boolean-types"]
=== Boolean types

Oracle does not provide native support for a `BOOLEAN` data type.
However, it is common practice to use other data types with certain semantics to simulate the concept of a logical `BOOLEAN` data type.

To enable you to convert source columns to Boolean data types, {prodname} provides a `NumberOneToBooleanConverter` {link-prefix}:{link-custom-converters}#custom-converters[custom converter] that you can use in one of the following ways:

* Map all `NUMBER(1)` columns to a `BOOLEAN` type.
* Enumerate a subset of columns by using a comma-separated list of regular expressions. +
To use this type of conversion, you must set the xref:oracle-property-converters[`converters`] configuration property with the `selector` parameter, as shown in the following example:
+
[source]
----
converters=boolean
boolean.type=io.debezium.connector.oracle.converters.NumberOneToBooleanConverter
boolean.selector=.*MYTABLE.FLAG,.*.IS_ARCHIVED
----

[id="oracle-temporal-types"]
=== Temporal types

Other than the Oracle `INTERVAL`, `TIMESTAMP WITH TIME ZONE`, and `TIMESTAMP WITH LOCAL TIME ZONE` data types, the way that the connector converts temporal types depends on the value of the `time.precision.mode` configuration property.

When the `time.precision.mode` configuration property is set to `adaptive` (the default), then the connector determines the literal and semantic type for the temporal types based on the column's data type definition so that events _exactly_ represent the values in the database:

[cols="25%a,20%a,55%a",options="header"]
|===
|Oracle data type |Literal type (schema type) |Semantic type (schema name) and Notes

|`DATE`
|`INT64`
|`io.debezium.time.Timestamp` +
 +
Represents the number of milliseconds since the UNIX epoch, and does not include timezone information.

|`INTERVAL DAY[(M)] TO SECOND`
|`FLOAT64`
|`io.debezium.time.MicroDuration` +
 +
The number of micro seconds for a time interval using the `365.25 / 12.0` formula for days per month average. +
 +
`io.debezium.time.Interval` (when `interval.handling.mode` is set to `string`) +
 +
The string representation of the interval value that follows the pattern `P<years>Y<months>M<days>DT<hours>H<minutes>M<seconds>S`, for example,  `P1Y2M3DT4H5M6.78S`.

|`INTERVAL YEAR[(M)] TO MONTH`
|`FLOAT64`
|`io.debezium.time.MicroDuration` +
 +
The number of micro seconds for a time interval using the `365.25 / 12.0` formula for days per month average. +
 +
`io.debezium.time.Interval` (when `interval.handling.mode` is set to `string`) +
 +
The string representation of the interval value that follows the pattern `P<years>Y<months>M<days>DT<hours>H<minutes>M<seconds>S`, for example,  `P1Y2M3DT4H5M6.78S`.

|`TIMESTAMP(0 - 3)`
|`INT64`
|`io.debezium.time.Timestamp` +
 +
Represents the number of milliseconds since the UNIX epoch, and does not include timezone information.

|`TIMESTAMP, TIMESTAMP(4 - 6)`
|`INT64`
|`io.debezium.time.MicroTimestamp` +
 +
Represents the number of microseconds since the UNIX epoch, and does not include timezone information.

|`TIMESTAMP(7 - 9)`
|`INT64`
|`io.debezium.time.NanoTimestamp` +
 +
Represents the number of nanoseconds since the UNIX epoch, and does not include timezone information.

|`TIMESTAMP WITH TIME ZONE`
|`STRING`
|`io.debezium.time.ZonedTimestamp` +
 +
A string representation of a timestamp with timezone information.

|`TIMESTAMP WITH LOCAL TIME ZONE`
|`STRING`
|`io.debezium.time.ZonedTimestamp` +
 +
A string representation of a timestamp in UTC.

|===

When the `time.precision.mode` configuration property is set to `connect`, then the connector uses the predefined Kafka Connect logical types.
This can be useful when consumers only know about the built-in Kafka Connect logical types and are unable to handle variable-precision time values.
Because the level of precision that Oracle supports exceeds the level that the logical types in Kafka Connect support, if you set `time.precision.mode` to `connect`, *a loss of precision* results when the _fractional second precision_ value of a database column is greater than 3:

[cols="25%a,20%a,55%a",options="header"]
|===
|Oracle data type |Literal type (schema type) |Semantic type (schema name) and Notes

|`DATE`
|`INT32`
|`org.apache.kafka.connect.data.Date` +
 +
Represents the number of days since the UNIX epoch.

|`INTERVAL DAY[(M)] TO SECOND`
|`FLOAT64`
|`io.debezium.time.MicroDuration` +
 +
The number of micro seconds for a time interval using the `365.25 / 12.0` formula for days per month average. +
 +
`io.debezium.time.Interval` (when `interval.handling.mode` is set to `string`) +
 +
The string representation of the interval value that follows the pattern `P<years>Y<months>M<days>DT<hours>H<minutes>M<seconds>S`, for example,  `P1Y2M3DT4H5M6.78S`.

|`INTERVAL YEAR[(M)] TO MONTH`
|`FLOAT64`
|`io.debezium.time.MicroDuration` +
 +
The number of micro seconds for a time interval using the `365.25 / 12.0` formula for days per month average. +
 +
`io.debezium.time.Interval` (when `interval.handling.mode` is set to `string`) +
 +
The string representation of the interval value that follows the pattern `P<years>Y<months>M<days>DT<hours>H<minutes>M<seconds>S`, for example,  `P1Y2M3DT4H5M6.78S`.

|`TIMESTAMP(0 - 3)`
|`INT64`
|`org.apache.kafka.connect.data.Timestamp` +
 +
Represents the number of milliseconds since the UNIX epoch, and does not include timezone information.

|`TIMESTAMP(4 - 6)`
|`INT64`
|`org.apache.kafka.connect.data.Timestamp` +
 +
Represents the number of milliseconds since the UNIX epoch, and does not include timezone information.

|`TIMESTAMP(7 - 9)`
|`INT64`
|`org.apache.kafka.connect.data.Timestamp` +
 +
Represents the number of milliseconds since the UNIX epoch, and does not include timezone information.

|`TIMESTAMP WITH TIME ZONE`
|`STRING`
|`io.debezium.time.ZonedTimestamp` +
 +
A string representation of a timestamp with timezone information.

|`TIMESTAMP WITH LOCAL TIME ZONE`
|`STRING`
|`io.debezium.time.ZonedTimestamp` +
 +
A string representation of a timestamp in UTC.

|===

[id="oracle-rowid-types"]
=== ROWID types

The following table describes how the connector maps ROWID (row address) data types.

.Mappings for Oracle ROWID data types
[cols="20%a,15%a,55%a",options="header"]
|===
|Oracle data type
|Literal type (schema type)
|Semantic type (schema name) and Notes

|`ROWID`
|`STRING`
|
ifdef::community[]
_This data type is not supported when using Oracle XStream._
endif::community[]
ifdef::product[]
n/a
endif::product[]

|`UROWID`
|n/a
|_This data type is not supported_.

|===

[id="oracle-xml-types"]
=== XML types
ifdef::community[]
[NOTE]
====
Support for `XMLTYPE` is currently in an incubating state.
Depending on the feedback that we receive, the exact semantics, configuration options, and so forth might change in future revisions.
Please let us know if you encounter any problems while using these data types.
====
endif::community[]
ifdef::product[]
[IMPORTANT]
====
Use of the `XMLTYPE` with the {prodname} Oracle connector is a Technology Preview feature only.
Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete.
Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see link:https://access.redhat.com/support/offerings/techpreview[https://access.redhat.com/support/offerings/techpreview].
====
endif::product[]
The following table describes how the connector maps XMLTYPE data types.

.Mappings for Oracle XMLTYPE data types
[cols="20%a,15%a,55%a",options="header"]
|===
|Oracle data type
|Literal type (schema type)
|Semantic type (schema name) and Notes

|`XMLTYPE`
|`STRING`
|`io.debezium.data.Xml`

|===

[id="oracle-user-defined-types"]
=== User-defined types

Oracle enables you to define custom data types to provide flexibility when the built-in data types do not satisfy your requirements.
There are a several user-defined types such as Object types, REF data types, Varrays, and Nested Tables.
At this time, you cannot use the {prodname} Oracle connector with any of these user-defined types.

[id="oracle-supplied-types"]
=== Oracle-supplied types

Oracle provides SQL-based interfaces that you can use to define new types when the built-in or ANSI-supported types are insufficient.
Oracle offers several commonly used data types to serve a broad array of purposes such as *Any* or *Spatial* types.
At this time, you cannot use the {prodname} Oracle connector with any of these data types.

[[oracle-default-values]]
=== Default Values
If a default value is specified for a column in the database schema, the Oracle connector will attempt to propagate this value to the schema of the corresponding Kafka record field.
Most common data types are supported, including:

* Character types (`CHAR`, `NCHAR`, `VARCHAR`, `VARCHAR2`, `NVARCHAR`, `NVARCHAR2`)
* Numeric types (`INTEGER`, `NUMERIC`, etc.)
* Temporal types (`DATE`, `TIMESTAMP`, `INTERVAL`, etc.)

If a temporal type uses a function call such as `TO_TIMESTAMP` or `TO_DATE` to represent the default value, the connector will resolve the default value by making an additional database call to evaluate the function.
For example, if a `DATE` column is defined with the default value of `TO_DATE('2021-01-02', 'YYYY-MM-DD')`, the column's default value will be the number of days since the UNIX epoch for that date or `18629` in this case.

If a temporal type uses the `SYSDATE` constant to represent the default value, the connector will resolve this based on whether the column is defined as `NOT NULL` or `NULL`.
If the column is nullable, no default value will be set; however, if the column isn't nullable then the default value will be resolved as either `0` (for `DATE` or `TIMESTAMP(n)` data types) or `1970-01-01T00:00:00Z` (for `TIMESTAMP WITH TIME ZONE` or `TIMESTAMP WITH LOCAL TIME ZONE` data types).
The default value type will be numeric except if the column is a `TIMESTAMP WITH TIME ZONE` or `TIMESTAMP WITH LOCAL TIME ZONE` in which case its emitted as a string.

[[debezium-oracle-connector-converters]]
== Custom converters

By default, the {prodname} Oracle connector provides several `CustomConverter` implementations specific to Oracle data types.
These custom converters provide alternative mappings for specific data types based on the connector configuration.
To add a `CustomConverter` to the connector, follow the instructions in the link:../development/converters.adoc[Custom Converters documentation].

The {prodname} Oracle connector provides the following custom converters:

* xref:debezium-oracle-connector-custom-converters-number-to-boolean[`NUMBER(1)` to Boolean]
* xref:debezium-oracle-connector-custom-converters-number-to-zero-scale[`NUMBER` To Zero Scale]
* xref:debezium-oracle-connector-custom-converters-raw-to-string[`RAW` to String]


[id="debezium-oracle-connector-custom-converters-number-to-boolean"]
=== `NUMBER(1)` to Boolean

Beginning with version 23, Oracle database provides a `BOOLEAN` logical data type.
In earlier versions, the database simulates a `BOOLEAN` type by using a `NUMBER(1)` data type, constrained with a value of `0` for false, or a value of `1` for true.

By default, when {prodname} emits change events for source columns that use the `NUMBER(1)` data type, it converts the data to the `INT8` literal type.
If the default mapping for `NUMBER(1)` data types does not meet your needs, you can configure the connector to use the logical `BOOL` type when it emits these columns by configuring the `NumberOneToBooleanConverter`, as shown in the following example:

.Example: `NumberOneToBooleanConverter` configuration
[source]
----
converters=number-to-boolean
number-to-boolean.type=io.debezium.connector.oracle.converters.NumberOneToBooleanConverter
number-to-boolean.selector=.*.MY_TABLE.DATA
----

In the preceding example, the `selector` property is optional.
The `selector` property specifies a regular expression that designates which tables or columns the converter applies to.
If you omit the `selector` property, when {prodname} emits an event, every column with the `NUMBER(1)` data type is converted to a field that uses the logical `BOOL` type.

[id="debezium-oracle-connector-custom-converters-number-to-zero-scale"]
=== `NUMBER` To Zero Scale

Oracle supports creating `NUMBER` based columns with negative scale, that is, `NUMBER(-2)`.
Not all systems can process negative scale values, so these values can result in processing problems in your pipeline.
For example, because Apache Avro does not support these values, problems can occur if {prodname} converts events to Avro format.
Similarly, downstream consumers that do not support these values can also encounter errors.

.Example configuration
[source]
----
converters=number-zero-scale
number-zero-scale.type=io.debezium.connector.oracle.converters.NumberToZeroScaleConverter
number-zero-scale.decimal.mode=precise
----

In the preceding example, the `decimal.mode` property specifies how the connector emits decimal values.
This property is optional.
If you omit the `decimal.mode` property, the converter defaults to using the `PRECISE` decimal handling mode.

[id="debezium-oracle-connector-custom-converters-raw-to-string"]
=== `RAW` to String

Although Oracle recommends against the use of certain data types, such as `RAW`, legacy systems might continue to use such types.
By default, {prodname} emits `RAW` column types as logical `BYTES`, a type that enables the storage of binary or text-based data.

In some cases, `RAW` columns might store character data as a series of bytes.
To facilitate consumption by consumers, you can configure {prodname} to use the `RawToStringConverter`.
The `RawToStringConverter` provides a way to easily target such `RAW` columns and emit values as strings, rather than bytes.
The following example shows how to add the `RawToStringConverter` to the connector configuration:

.Example: `RawToStringConverter` configuration
[source]
----
converters=raw-to-string
raw-to-string.type=io.debezium.connector.oracle.converters.RawToStringConverter
raw-to-string.selector=.*.MY_TABLE.DATA
----

In the preceding example, the `selector` property enables you to define a regular expression that specifies the tables or columns that the converter processes.
If you omit the `selector` property, the converter maps all `RAW` column types to logical `STRING` field types.

// Type: assembly
// ModuleID: setting-up-oracle-to-work-with-debezium
//Title: Setting up Oracle to work with {prodname}
[[setting-up-oracle]]
== Setting up Oracle

The following steps are necessary to set up Oracle for use with the {prodname} Oracle connector.
These steps assume the use of the multi-tenancy configuration with a container database and at least one pluggable database.
If you do not intend to use a multi-tenant configuration, it might be necessary to adjust the following steps.

ifdef::community[]
For information about using Vagrant to set up Oracle in a virtual machine, see the https://github.com/debezium/oracle-vagrant-box/[Debezium Vagrant Box for Oracle database] GitHub repository.
endif::community[]
ifdef::product[]

For details about setting up Oracle for use with the {prodname} connector, see the following sections:

* xref:compatibility-of-the-debezium-oracle-connector-with-oracle-installation-types[]
* xref:schemas-that-the-debezium-oracle-connector-excludes-when-capturing-change-events[]
* xref:preparing-oracle-databases-for-use-with-debezium[]
* xref:resizing-oracle-redo-logs-to-accommodate-the-data-dictionary[]
* xref:creating-an-oracle-user-for-the-debezium-oracle-connector[]
* xref:running-the-connector-with-an-oracle-standby-database[]

endif::product[]

// Type: concept
// Title: Compatibility of the {prodname} Oracle connector with Oracle installation types
[id="compatibility-of-the-debezium-oracle-connector-with-oracle-installation-types"]
=== Compatibility with Oracle installation types

An Oracle database can be installed either as a standalone instance or using Oracle Real Application Cluster (RAC).
The {prodname} Oracle connector is compatible with both types of installation.

// Type: concept
// Title: Schemas that the {prodname} Oracle connector excludes when capturing change events
[id="schemas-that-the-debezium-oracle-connector-excludes-when-capturing-change-events"]
=== Schemas excluded from capture

When the {prodname} Oracle connector captures tables, it automatically excludes tables from the following schemas:

* `appqossys`
* `audsys`
* `ctxsys`
* `dvsys`
* `dbsfwuser`
* `dbsnmp`
* `qsmadmin_internal`
* `lbacsys`
* `mdsys`
* `ojvmsys`
* `olapsys`
* `orddata`
* `ordsys`
* `outln`
* `sys`
* `system`
* `vecsys` (Oracle 23+)
* `wmsys`
* `xdb`

To enable the connector to capture changes from a table, the table must use a schema that is not named in the preceding list.

// Type: concept
// Title: Tables that the {prodname} Oracle connector excludes when capturing change events
[id="tables-that-the-debezium-oracle-connector-excludes-when-capturing-change-events"]
=== Tables excluded from capture

When the {prodname} Oracle connector captures tables, it automatically excludes tables that match the following rules:

* Compression Advisor tables matching the pattern `CMP[3|4]$[0-9]+`.
* Index-organized tables matching the pattern `SYS_IOT_OVER_%`.
* Spatial tables matching the patterns `MDRT_%`, `MDRS_%`, or `MDXT_%`.
* Nested tables

To enable the connector to capture a table with a name that matches any of the preceding rules, you must rename the table.

// Type: procedure
// ModuleID: preparing-oracle-databases-for-use-with-debezium
// Title: Preparing Oracle databases for use with {prodname}
=== Preparing the database

.Configuration needed for Oracle LogMiner
[source,indent=0]
----
ORACLE_SID=ORACLCDB dbz_oracle sqlplus /nolog

CONNECT sys/top_secret AS SYSDBA
alter system set db_recovery_file_dest_size = 10G;
alter system set db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' scope=spfile;
shutdown immediate
startup mount
alter database archivelog;
alter database open;
-- Should now "Database log mode: Archive Mode"
archive log list

exit;
----

Oracle AWS RDS does not allow you to execute the commands above nor does it allow you to log in as sysdba. AWS provides these alternative commands to configure LogMiner. Before executing these commands, ensure that your Oracle AWS RDS instance is enabled for backups.

To confirm that Oracle has backups enabled, execute the command below first. The LOG_MODE should say ARCHIVELOG. If it does not, you may need to reboot your Oracle AWS RDS instance.

.Configuration needed for Oracle AWS RDS LogMiner
[source,indent=0]
----
SQL> SELECT LOG_MODE FROM V$DATABASE;

LOG_MODE
------------
ARCHIVELOG
----

Once LOG_MODE is set to ARCHIVELOG, execute the commands to complete LogMiner configuration. The first command set the database to archivelogs and the second adds supplemental logging.

.Configuration needed for Oracle AWS RDS LogMiner
[source,indent=0]
----
exec rdsadmin.rdsadmin_util.set_configuration('archivelog retention hours',24);

exec rdsadmin.rdsadmin_util.alter_supplemental_logging('ADD');
----

To enable {prodname} to capture the _before_ state of changed database rows, you must also enable supplemental logging for captured tables or for the entire database.
The following example illustrates how to configure supplemental logging for all columns in a single `inventory.customers` table.

[source,indent=0]
----
ALTER TABLE inventory.customers ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
----

Enabling supplemental logging for all table columns increases the volume of the Oracle redo logs.
To prevent excessive growth in the size of the logs, apply the preceding configuration selectively.

Minimal supplemental logging must be enabled at the database level and can be configured as follows.

[source,indent=0]
----
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
----

// Type: concept
// Title: Resizing Oracle redo logs to accommodate the data dictionary
// ModuleID: resizing-oracle-redo-logs-to-accommodate-the-data-dictionary
[id="oracle-redo-log-sizing"]
=== Redo log sizing

Depending on the database configuration, the size and number of redo logs might not be sufficient to achieve acceptable performance.
Before you set up the {prodname} Oracle connector, ensure that the capacity of the redo logs is sufficient to support the database.

The capacity of the redo logs for a database must be sufficient to store its data dictionary.
In general, the size of the data dictionary increases with the number of tables and columns in the database.
If the redo log lacks sufficient capacity, both the database and the {prodname} connector might experience performance problems.

Consult with your database administrator to evaluate whether the database might require increased log capacity.

// Type: procedure
// ModuleID: oracle-connector-specifying-the-archive-log-destination
// Title: Specifying the archive log destination that the {prodname} Oracle connector uses
=== Archive log destinations

Oracle database administrators can configure up to 31 different destinations for archive logs.
Administrators can set parameters for each destination to designate it for a specific use, for example, log shipping for physical standbys, or external storage to allow for extended log retention.
Oracle reports details about archive log destinations in the `V$ARCHIVE_DEST_STATUS` view.

The {prodname} Oracle connector only uses destinations that have a status of `VALID` and a type of `LOCAL`.
If your Oracle environment includes multiple destinations that satisfy that criteria, consult with your Oracle administrator to determine which archive log destination {prodname} should use.

.Procedure
* To specify the archive log destination that you want {prodname} to use, set the xref:oracle-property-archive-destination-name[`archive.destination.name`] property in the connector configuration. +
 +
For example, suppose that a database is configured with two archive destination paths, `/path/one` and `/path/two`, and that the `V$ARCHIVE_DEST_STATUS` table associates these paths with destination names that are specified in the column `DEST_NAME`.
If both destinations satisfy the criteria for {prodname} -- that is, their `status` is `VALID` and their `type` is `LOCAL` -- to configure the connector to use the archive logs that the database writes to `/path/two`, set the value of `archive.destination.name` to the value in the `DEST_NAME` column that is associated with `/path/two` in the `V$ARCHIVE_DEST_STATUS` table.
For example, if the `DEST_NAME` is `LOG_ARCHIVE_DEST_3` for `/path/two`, you would configure Debezium as follows:

[source,json]
----
{
  "archive.destination.name": "LOG_ARCHIVE_DEST_3"
}
----

[NOTE]
====
Do not set the value of `archive.destination.name` to the path that the database uses for the archive logs.
Set the property to the name of an archive log destination in the `DEST_NAME` column for a row in the `V$ARCHIVE_DEST_STATUS` table that satisfies your archive log retention policy.
====

[WARNING]
====
If your Oracle environment includes multiple destinations that satisfy that criteria, and you fail to specify the preferred destination, the {prodname} Oracle connector selects the destination path at random.
Because the retention policy that is configured for each destination might differ, this can lead to errors if the connector selects a path from which the requested log data was deleted.
====

// Type: procedure
// ModuleID: creating-an-oracle-user-for-the-debezium-oracle-connector
// Title: Creating an Oracle user for the {prodname} Oracle connector
[id="creating-users-for-the-connector"]
=== Creating users for the connector

For the {prodname} Oracle connector to capture change events, it must run as an Oracle LogMiner user that has specific permissions.
The following example shows the SQL for creating an Oracle user account for the connector in a multi-tenant database model.

[WARNING]
====
The connector captures database changes that are made by its own Oracle user account.
However, it does not capture changes that are made by the `SYS` or `SYSTEM` user accounts.
====

[[oracle-create-users-logminer]]
.Creating the connector's LogMiner user
[source,sql,indent=0]
----
sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba
  CREATE TABLESPACE logminer_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/logminer_tbs.dbf'
    SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
  exit;

sqlplus sys/top_secret@//localhost:1521/ORCLPDB1 as sysdba
  CREATE TABLESPACE logminer_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/logminer_tbs.dbf'
    SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
  exit;

sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba

  CREATE USER c##dbzuser IDENTIFIED BY dbz
    DEFAULT TABLESPACE logminer_tbs
    QUOTA UNLIMITED ON logminer_tbs
    CONTAINER=ALL;

  GRANT CREATE SESSION TO c##dbzuser CONTAINER=ALL; <1>
  GRANT SET CONTAINER TO c##dbzuser CONTAINER=ALL; <2>
  GRANT SELECT ON V_$DATABASE to c##dbzuser CONTAINER=ALL; <3>
  GRANT FLASHBACK ANY TABLE TO c##dbzuser CONTAINER=ALL; <4>
  GRANT SELECT ANY TABLE TO c##dbzuser CONTAINER=ALL; <5>
  GRANT SELECT_CATALOG_ROLE TO c##dbzuser CONTAINER=ALL; <6>
  GRANT EXECUTE_CATALOG_ROLE TO c##dbzuser CONTAINER=ALL; <7>
  GRANT SELECT ANY TRANSACTION TO c##dbzuser CONTAINER=ALL; <8>
  GRANT LOGMINING TO c##dbzuser CONTAINER=ALL; <9>

  GRANT CREATE TABLE TO c##dbzuser CONTAINER=ALL; <10>
  GRANT LOCK ANY TABLE TO c##dbzuser CONTAINER=ALL; <11>
  GRANT CREATE SEQUENCE TO c##dbzuser CONTAINER=ALL; <12>

  GRANT EXECUTE ON DBMS_LOGMNR TO c##dbzuser CONTAINER=ALL; <13>
  GRANT EXECUTE ON DBMS_LOGMNR_D TO c##dbzuser CONTAINER=ALL; <14>

  GRANT SELECT ON V_$LOG TO c##dbzuser CONTAINER=ALL; <15>
  GRANT SELECT ON V_$LOG_HISTORY TO c##dbzuser CONTAINER=ALL; <16>
  GRANT SELECT ON V_$LOGMNR_LOGS TO c##dbzuser CONTAINER=ALL; <17>
  GRANT SELECT ON V_$LOGMNR_CONTENTS TO c##dbzuser CONTAINER=ALL; <18>
  GRANT SELECT ON V_$LOGMNR_PARAMETERS TO c##dbzuser CONTAINER=ALL; <19>
  GRANT SELECT ON V_$LOGFILE TO c##dbzuser CONTAINER=ALL; <20>
  GRANT SELECT ON V_$ARCHIVED_LOG TO c##dbzuser CONTAINER=ALL; <21>
  GRANT SELECT ON V_$ARCHIVE_DEST_STATUS TO c##dbzuser CONTAINER=ALL; <22>
  GRANT SELECT ON V_$TRANSACTION TO c##dbzuser CONTAINER=ALL; <23>

  GRANT SELECT ON V_$MYSTAT TO c##dbzuser CONTAINER=ALL; <24>
  GRANT SELECT ON V_$STATNAME TO c##dbzuser CONTAINER=ALL; <25>

  exit;
----

.Descriptions of permissions / grants
[cols="1,4,5",options="header"]
|===
|Item |Role name |Description

|1
|CREATE SESSION
|Enables the connector to connect to Oracle.

|2
|SET CONTAINER
|Enables the connector to switch between pluggable databases.
This is only required when the Oracle installation has container database support (CDB) enabled.

|3
|SELECT ON V_$DATABASE
|Enables the connector to read the `V$DATABASE` table.

|4
|FLASHBACK ANY TABLE
|Enables the connector to perform Flashback queries, which is how the connector performs the initial snapshot of data.
Optionally, rather than granting `FLASHBACK` permission on all tables, you can grant the FLASHBACK privilege for specific tables only.

|5
|SELECT ANY TABLE
|Enables the connector to read any table.
Optionally, rather than granting `SELECT` permission on all tables, you can grant the `SELECT` privilege for specific tables only.

|6
|SELECT_CATALOG_ROLE
|Enables the connector to read the data dictionary, which is needed by Oracle LogMiner sessions.

|7
|EXECUTE_CATALOG_ROLE
|Enables the connector to write the data dictionary into the Oracle redo logs, which is needed to track schema changes.

|8
|SELECT ANY TRANSACTION
|Enables the snapshot process to perform a Flashback snapshot query against any transaction.
When `FLASHBACK ANY TABLE` is granted, this should also be granted.

|9
|LOGMINING
|This role was added in newer versions of Oracle as a way to grant full access to Oracle LogMiner and its
packages.  On older versions of Oracle that don't have this role, you can ignore this grant.

|10
|CREATE TABLE
|Enables the connector to create its flush table in its default tablespace.
The flush table allows the connector to explicitly control flushing of the LGWR internal buffers to disk.

|11
|LOCK ANY TABLE
|Enables the connector to lock tables during schema snapshot.
If snapshot locks are explicitly disabled via configuration, this grant can be safely ignored.

|12
|CREATE SEQUENCE
|Enables the connector to create a sequence in its default tablespace.

|13
|EXECUTE ON DBMS_LOGMNR
|Enables the connector to run methods in the `DBMS_LOGMNR` package.
This is required to interact with Oracle LogMiner.
On newer versions of Oracle this is granted via the `LOGMINING` role but on older versions, this must be explicitly granted.

|14
|EXECUTE ON DBMS_LOGMNR_D
|Enables the connector to run methods in the `DBMS_LOGMNR_D` package.
This is required to interact with Oracle LogMiner.
On newer versions of Oracle this is granted via the `LOGMINING` role but on older versions, this must be explicitly granted.

|15 to 25
|SELECT ON V_$....
|Enables the connector to read these tables.
The connector must be able to read information about the Oracle redo and archive logs, and the current transaction state, to prepare the Oracle LogMiner session.
Without these grants, the connector cannot operate.

|===

// Type: assembly
// Title: Running the connector with an Oracle standby database
// ModuleID: running-the-connector-with-an-oracle-standby-database
[id="support-for-oracle-standby-databases"]
=== Standby databases

A standby database provides a synchronized copy of the primary instance.
In the event of a primary database failure, standby databases provide for continuous availability, and disaster recovery.
Oracle makes use of both physical and logical standby databases.

.Physical standbys
A physical standby is an exact, block-for-block copy of the primary production database, and its system change number (SCN) values are identical to those of the primary.
The {prodname} Oracle connector cannot capture change events directly from a physical standby database, because physical standbys do not accept external connections.
The connector can capture events from a physical standby only after the standby is converted to the primary database.
The connector then connects to the former standby as if it were any primary database.

.Logical standbys
A logical standby contains the same logical data as the primary, but data might be stored in a different physical manner.
SCN offsets in a logical standby differ from the offsets in the primary database.
You can xref:configuring-the-debezium-oracle-connector-to-capture-events-from-a-logical-standby[configure the {prodname} Oracle connector to capture changes from a logical standby database].


// Type: concept
// Title: Capturing data from an Oracle failover database
// ModuleID: capturing-data-from-an-oracle-failover-database
==== Failover databases

When you set up a failover database, it is generally best practice to use a physical standby database rather than a logical standby database.
A physical standby maintains a more consistent state with the primary database than does a logical standby.
Physical standbys contain an exact replica of the primary data, and the system change number (SCN) values of the standby are identical to those of the primary.
In a {prodname} environment, after the database fails over to physical standby, the presence of consistent SCN values ensure that the connector can find the last processed SCN value.

A physical standby is locked in a read-only mode, with managed recovery running to maintain synchronization.
When a database is in standby mode, it does not accept external JDBC connections from clients, and it cannot be accessed by external application.

After a failure event, to permit {prodname} to connect to the former physical standby,a DBA must perform several actions to enable failover to the standby, and promote it the the primary database.
The following list identifies some of the key actions:

* Cancel managed recovery on the standby.
* Complete the active recovery process.
* Convert the standby to the primary role.
* Open the new primary to client read and write operations.

After the former physical standby is available for normal use, you can configure the {prodname} Oracle connector to connect to it.
To enable the connector to capture from the new primary, edit the database hostname in the connector configuration, replacing the hostname of the original primary with the hostname of the new primary.

// Type: procedure
[id="configuring-the-debezium-oracle-connector-to-capture-events-from-a-logical-standby"]
==== Configuring the {prodname} Oracle connector to capture events from a logical standby

When the {prodname} connector for Oracle connects to a primary database, it uses an internal flush table to manage the flush cycles of the Oracle Log Writer Buffer (LGWR) process.
The flush process requires that the user account through which the connector accesses the database has permission to create and write to this flush table.
However, a logical stand-by database typically permits read-only access, preventing the connector from writing to the database.
You can modify the connector configuration to enable the connector to capture events from a logical standby, or the DBA can create a new writable tablespace in which the connector can store the flush table.

ifdef::product[]
[IMPORTANT]
====
The ability for the {prodname} Oracle connector to ingest changes from a read-only logical standby database is a Developer Preview feature.
Developer Preview features are not supported by Red{nbsp}Hat in any way and are not functionally complete or production-ready.
Do not use Developer Preview software for production or business-critical workloads.
Developer Preview software provides early access to upcoming product software in advance of its possible inclusion in a Red{nbsp}Hat product offering.
Customers can use this software to test functionality and provide feedback during the development process.
This software might not have any documentation, is subject to change or removal at any time, and has received limited testing.
Red{nbsp}Hat might provide ways to submit feedback on Developer Preview software without an associated SLA.

For more information about the support scope of Red{nbsp}Hat Developer Preview software, see link:https://access.redhat.com/support/offerings/devpreview/[Developer Preview Support Scope].
====
endif::product[]

ifdef::community[]
[WARNING]
====
The ability to use the connector with a logical standby in an incubating state and can change without notice.
There is an open https://issues.redhat.com/browse/DBZ-3866[Jira issue] to investigate support for capturing changes from a physical standby.
====
endif::community[]

.Procedure

* To enable {prodname} to capture events from an Oracle read-only logical standby database, add the following property to the connector configuration, to disable creation and management of the flush table:
+
```
internal.log.mining.read.only=true
```
The preceding setting prevents the database from creating and updating the `LOG_MINING_FLUSH` table.
You can use the `internal.log.mining.read.only` property with an Oracle Standalone database, or with an Oracle RAC installation.

[id="support-for-extended-max-string-size"]
=== Extended max string size

The database parameter `max_string_size` controls how the Oracle database, and by extension, Debezium, interprets values for `VARCHAR2`, `NVARCHAR2`, and `RAW` fields.
The default, `STANDARD`, means the lengths for these data types align with the same limits with releases prior to Oracle 12c (4000 bytes for `VARCHAR2` and `NVARCHAR2` and 2000 bytes for `RAW`).
When configured as `EXTENDED`, these columns now allow up to 32767 bytes of data to be stored.

[WARNING]
====
While a database administrator can change the `max_string_size` from `STANDARD` to `EXTENDED`, the opposite isn't allowed.
Once the database is updated to `EXTENDED` string support, that cannot be undone.
====

For the {prodname} Oracle connector, when the database parameter `max_string_size` is `EXTENDED`, the `lob.enabled` connector configuration option should be set to `true` to capture changes made to `VARCHAR2` and `NVARCHAR2` fields that have string lengths that exceed 4000 bytes or `RAW` fields with more than 2000 bytes.

When set to `EXTENDED`, Oracle performs an implicit conversion of the character data in-flight when the byte length of the string data exceeds the legacy maximums.
This implicit conversion means that Oracle internally treats the string data as though it is a `CLOB`, so you get the benefit of treating the field as a regular string to the outside world, but with all the pitfalls and concerns about storage at the database tier level.

Since Oracle treats these strings as `CLOB` internally, the redo logs also reflect several unique operation types that the {prodname} Oracle connector needs to be aware that it should mine.
And because these operation types very closely resemble `CLOB` operations, the redo log entries must be mined in the same way as any other LOB type, which is why `lob.enabled` must be set to `true` to capture changes from the redo logs regardless of the string data's byte length.

[WARNING]
====
When storing strings when `EXTENDED` is enabled that contain apostrophe. (`'`) characters and the byte length does not exceed the legacy maximum lengths.
In this use case, Oracle LogMiner does not properly escape the single apostrophe characters in the reconstructed SQL, which leads to invalid SQL that cannot be handled by the {prodname} Oracle connector.
Please see https://issues.redhat.com/browse/DBZ-8034[DBZ-8034] for more details.
====

// Type: assembly
// ModuleID: deployment-of-debezium-oracle-connectors
// Title: Deployment of {prodname} Oracle connectors
[[oracle-deploying-a-connector]]
== Deployment

ifdef::community[]
To deploy a {prodname} Oracle connector, you install the {prodname} Oracle connector archive, configure the connector, and start the connector by adding its configuration to Kafka Connect.

.Prerequisites
* link:https://zookeeper.apache.org/[Apache ZooKeeper], link:http://kafka.apache.org/[Apache Kafka], and link:{link-kafka-docs}.html#connect[Kafka Connect] are installed.
* Oracle Database is installed, and is xref:setting-up-oracle[configured to work with the {prodname} connector].

.Procedure

. Download the {prodname} https://repo1.maven.org/maven2/io/debezium/debezium-connector-oracle/{debezium-version}/debezium-connector-oracle-{debezium-version}-plugin.tar.gz[Oracle connector plug-in archive].
. Extract the files into your Kafka Connect environment.
. Download the link:https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc11/{ojdbc-version}/ojdbc11-{ojdbc-version}.jar[JDBC driver for Oracle] from Maven Central and extract the downloaded driver file to the directory that contains the {prodname} Oracle connector JAR file.
+
NOTE: If you use the {prodname} Oracle connector with Oracle XStream, obtain the JDBC driver as part of the Oracle Instant Client package.
For more information, see xref:obtaining-oracle-jdbc-driver-and-xstreams-api-files[].
. Download the link:https://repo1.maven.org/maven2/com/oracle/database/xml/xdb/{ojdbc-version}/xdb-{ojdbc-version}.jar[XDB library for Oracle] from Maven Central and extract the downloaded file to the directory that contains the {prodname} Oracle connector JAR file.
. Add the directory with the JAR files to {link-kafka-docs}/#connectconfigs[Kafka Connect's `plugin.path`].
. Restart your Kafka Connect process to pick up the new JAR files.

.Next steps

* xref:oracle-example-configuration[Configure the connector] and xref:oracle-adding-connector-configuration[add the configuration to your Kafka Connect cluster.]

endif::community[]

ifdef::product[]
You can use either of the following methods to deploy a {prodname} Oracle connector:

* xref:openshift-streams-oracle-connector-deployment[Use {StreamsName} to automatically create an image that includes the connector plug-in].
+
This is the preferred method.
* xref:deploying-debezium-oracle-connectors[Build a custom Kafka Connect container image from a Dockerfile].

[IMPORTANT]
====
Due to licensing requirements, the {prodname} Oracle connector archive does not include the Oracle JDBC driver that the connector requires to connect to an Oracle database.
To enable the connector to access the database, you must add the driver to your connector environment.
For more information, see xref:obtaining-the-oracle-jdbc-driver[Obtaining the Oracle JDBC driver].
====

.Additional resources

* xref:descriptions-of-debezium-oracle-connector-configuration-properties[Oracle connector configuration properties]

// Type: procedure
[id="obtaining-the-oracle-jdbc-driver"]
=== Obtaining the Oracle JDBC driver

Due to licensing requirements, the Oracle JDBC driver file that {prodname} requires to connect to an Oracle database is not included in the {prodname} Oracle connector archive.
The driver is available for download from Maven Central.
Depending on the deployment method that you use, you retrieve the driver by adding a command to the Kafka Connect custom resource or to the Dockerfile that you use to build the connector image.

* If you use {StreamsName} to add the connector to your Kafka Connect image, add the Maven Central location for the driver to `builds.plugins.artifact.url` in the `KafkaConnect` custom resource as shown in xref:using-streams-to-deploy-debezium-oracle-connectors[].
* If you use a Dockerfile to build a container image for the connector, insert a `curl` command in the Dockerfile to specify the URL for downloading the required driver file from Maven Central.
For more information, see xref:deploying-debezium-oracle-connectors[Deploying a {prodname} Oracle connector by building a custom Kafka Connect container image from a Dockerfile].

// Type: concept
[id="openshift-streams-oracle-connector-deployment"]
=== {prodname} Oracle connector deployment using {StreamsName}

include::{partialsdir}/modules/all-connectors/con-connector-streams-deployment.adoc[leveloffset=+1]

// Type: procedure
[id="using-streams-to-deploy-debezium-oracle-connectors"]
=== Using {StreamsName} to deploy a {prodname} Oracle connector
include::{partialsdir}/modules/all-connectors/proc-using-streams-to-deploy-a-debezium-db2-ora-pg-connector.adoc[leveloffset=+1]

// Type: procedure
[id="deploying-debezium-oracle-connectors"]
=== Deploying a {prodname} Oracle connector by building a custom Kafka Connect container image from a Dockerfile

To deploy a {prodname} Oracle connector, you must build a custom Kafka Connect container image that contains the {prodname} connector archive, and then push this container image to a container registry.
You then need to create the following custom resources (CRs):

* A `KafkaConnect` CR that defines your Kafka Connect instance.
  The `image` property in the CR specifies the name of the container image that you create to run your {prodname} connector.
  You apply this CR to the OpenShift instance where link:https://access.redhat.com/products/red-hat-amq#streams[Red Hat {StreamsName}] is deployed.
  {StreamsName} offers operators and images that bring Apache Kafka to OpenShift.

* A `KafkaConnector` CR that defines your {prodname} Oracle connector.
  Apply this CR to the same OpenShift instance where you apply the `KafkaConnect` CR.

.Prerequisites

* Oracle Database is running and you completed the steps to xref:setting-up-oracle-to-work-with-debezium[set up Oracle to work with a {prodname} connector].

* {StreamsName} is deployed on OpenShift and is running Apache Kafka and Kafka Connect.
  For more information, see link:{LinkDeployManageStreamsOpenShift}[{NameDeployManageStreamsOpenShift}]

* Podman or Docker is installed.

* You have an account and permissions to create and manage containers in the container registry (such as `quay.io` or `docker.io`) to which you plan to add the container that will run your {prodname} connector.

* The Kafka Connect server has access to Maven Central to download the required JDBC driver for Oracle.
  You can also use a local copy of the driver, or one that is available from a local Maven repository or other HTTP server.
+
For more information, see xref:obtaining-the-oracle-jdbc-driver[Obtaining the Oracle JDBC driver].

.Procedure

. Create the {prodname} Oracle container for Kafka Connect:

.. Create a Dockerfile that uses `{DockerKafkaConnect}` as the base image.
For example, from a terminal window, enter the following command:
+
=====================================================================

[source,shell,subs="+attributes,+quotes"]
----
cat <<EOF >debezium-container-for-{context}.yaml // <1>
FROM {DockerKafkaConnect}
USER root:root
RUN mkdir -p /opt/kafka/plugins/debezium // <2>
RUN cd /opt/kafka/plugins/debezium/ \
&& curl -O {red-hat-maven-repository}debezium/debezium-connector-{connector-file}/{debezium-version}-redhat-{debezium-build-number}/debezium-connector-{connector-file}-{debezium-version}-redhat-{debezium-build-number}-plugin.zip \
&& unzip debezium-connector-{connector-file}-{debezium-version}-redhat-{debezium-build-number}-plugin.zip \
&& rm debezium-connector-{connector-file}-{debezium-version}-redhat-{debezium-build-number}-plugin.zip
RUN cd /opt/kafka/plugins/debezium/ \
&& curl -O https://repo1.maven.org/maven2/com/oracle/ojdbc/ojdbc11/{ojdbc-version}/ojdbc11-{ojdbc-version}.jar
USER 1001
EOF
----
=====================================================================
+
[cols="1,7",options="header"]
|===
|Item |Description

|1
|You can specify any file name that you want.

|2
|Specifies the path to your Kafka Connect plug-ins directory.
If your Kafka Connect plug-ins directory is in a different location, replace this path with the actual path of your directory.

|===
+
The command creates a Dockerfile with the name `debezium-container-for-oracle.yaml` in the current directory.

.. Build the container image from the `debezium-container-for-oracle.yaml` Docker file that you created in the previous step.
From the directory that contains the file, open a terminal window and enter one of the following commands:
+
[source,shell,options="nowrap"]
----
podman build -t debezium-container-for-oracle:latest .
----
+
[source,shell,options="nowrap"]
----
docker build -t debezium-container-for-oracle:latest .
----
The preceding commands build a container image with the name `debezium-container-for-oracle`.

.. Push your custom image to a container registry, such as quay.io or an internal container registry.
The container registry must be available to the OpenShift instance where you want to deploy the image.
Enter one of the following commands:
+
[source,shell,subs="+quotes"]
----
podman push _<myregistry.io>_/debezium-container-for-oracle:latest
----
+
[source,shell,subs="+quotes"]
----
docker push _<myregistry.io>_/debezium-container-for-oracle:latest
----

.. Create a new {prodname} Oracle KafkaConnect custom resource (CR).
For example, create a `KafkaConnect` CR with the name `dbz-connect.yaml` that specifies `annotations` and `image` properties.
The following example shows an excerpt from a `dbz-connect.yaml` file that describes a `KafkaConnect` custom resource. +
+
=====================================================================
[source,yaml,subs="+attributes"]
----
apiVersion: {KafkaConnectApiVersion}
kind: KafkaConnect
metadata:
  name: my-connect-cluster
  annotations:
    strimzi.io/use-connector-resources: "true" // <1>
spec:
  image: debezium-container-for-oracle // <2>

  ...
----
=====================================================================
+
[cols="1,7",options="header"]
|===
|Item |Description

|1
|`metadata.annotations` indicates to the Cluster Operator that `KafkaConnector` resources are used to configure connectors in this Kafka Connect cluster.

|2
|`spec.image` specifies the name of the image that you created to run your Debezium connector.
This property overrides the `STRIMZI_DEFAULT_KAFKA_CONNECT_IMAGE` variable in the Cluster Operator.

|===

.. Apply the `KafkaConnect` CR to the OpenShift Kafka Connect environment by entering the following command:
+
[source,shell,options="nowrap"]
----
oc create -f dbz-connect.yaml
----
+
The command adds a Kafka Connect instance that specifies the name of the image that you created to run your {prodname} connector.

. Create a `KafkaConnector` custom resource that configures your {prodname} Oracle connector instance.
+
You configure a {prodname} Oracle connector in a `.yaml` file that specifies the configuration properties for the connector.
The connector configuration might instruct {prodname} to produce events for a subset of the schemas and tables, or it might set properties so that {prodname} ignores, masks, or truncates values in specified columns that are sensitive, too large, or not needed.
+
The following example configures a {prodname} connector that connects to an Oracle host IP address, on port `1521`.
This host has a database named `ORCLCDB`, and `server1` is the server's logical name.
+
.Oracle `inventory-connector.yaml`
[source,yaml,subs="+attributes,+quotes",options="nowrap"]
----
apiVersion: {KafkaConnectorApiVersion}
kind: KafkaConnector
metadata:
  name: inventory-connector-{context} // <1>
  labels:
    strimzi.io/cluster: my-connect-cluster
  annotations:
    strimzi.io/use-connector-resources: 'true'
spec:
  class: io.debezium.connector.oracle.OracleConnector // <2>
  config:
    database.hostname: _<oracle_ip_address>_ // <3>
    database.port: 1521 // <4>
    database.user: c##dbzuser // <5>
    database.password: dbz // <6>
    database.dbname: ORCLCDB // <7>
    database.pdb.name : ORCLPDB1, <8>
    topic.prefix: inventory-connector-{context} // <9>
    schema.history.internal.kafka.bootstrap.servers: kafka:9092 // <10>
    schema.history.internal.kafka.topic: schema-changes.inventory // <11>
----
+
.Descriptions of connector configuration settings
[cols="1,7",options="header",subs="+attributes"]
|===
|Item |Description

|1
|The name of our connector when we register it with a Kafka Connect service.

|2
|The name of this Oracle connector class.

|3
|The address of the Oracle instance.

|4
|The port number of the Oracle instance.

|5
|The name of the Oracle user, as specified in xref:creating-users-for-the-connector[Creating users for the connector].

|6
|The password for the Oracle user, as specified in xref:creating-users-for-the-connector[Creating users for the connector].

|7
|The name of the database to capture changes from.

|8
|The name of the Oracle pluggable database that the connector captures changes from. Used in container database (CDB) installations only.

|9
|Topic prefix identifies and provides a namespace for the Oracle database server from which the connector captures changes.

|10
|The list of Kafka brokers that this connector uses to write and recover DDL statements to the database schema history topic.

|11
|The name of the database schema history topic where the connector writes and recovers DDL statements. This topic is for internal use only and should not be used by consumers.

|===

. Create your connector instance with Kafka Connect.
  For example, if you saved your `KafkaConnector` resource in the `inventory-connector.yaml` file, you would run the following command:
+
[source,shell,options="nowrap"]
----
oc apply -f inventory-connector.yaml
----
+
The preceding command registers `inventory-connector` and the connector starts to run against the `server1` database as defined in the `KafkaConnector` CR.
endif::product[]

ifdef::community[]
[[oracle-example-configuration]]
=== {prodname} Oracle connector configuration

Typically, you register a {prodname} Oracle connector by submitting a JSON request that specifies the configuration properties for the connector.
The following example shows a JSON request for registering an instance of the {prodname} Oracle connector with logical name `server1` at port 1521:

You can choose to produce events for a subset of the schemas and tables in a database.
Optionally, you can ignore, mask, or truncate columns that contain sensitive data, that are larger than a specified size, or that you do not need.

.Example: {prodname} Oracle connector configuration
[source,json,indent=0,subs="+quotes"]
----
{
    "name": "inventory-connector",  // <1>
    "config": {
        "connector.class" : "io.debezium.connector.oracle.OracleConnector",  // <2>
        "database.hostname" : "<ORACLE_IP_ADDRESS>",  // <3>
        "database.port" : "1521",  // <4>
        "database.user" : "c##dbzuser",  // <5>
        "database.password" : "dbz",   // <6>
        "database.dbname" : "ORCLCDB",  // <7>
        "topic.prefix" : "server1",  // <8>
        "tasks.max" : "1",  // <9>
        "database.pdb.name" : "ORCLPDB1",  // <10>
        "schema.history.internal.kafka.bootstrap.servers" : "kafka:9092", // <11>
        "schema.history.internal.kafka.topic": "schema-changes.inventory"  // <12>
    }
}
----
<1> The name that is assigned to the connector when you register it with a Kafka Connect service.
<2> The name of this Oracle connector class.
<3> The address of the Oracle instance.
<4> The port number of the Oracle instance.
<5> The name of the Oracle user, as specified in xref:creating-users-for-the-connector[Creating users for the connector].
<6> The password for the Oracle user, as specified in xref:creating-users-for-the-connector[Creating users for the connector].
<7> The name of the database to capture changes from.
<8> Topic prefix that identifies and provides a namespace for the Oracle database server from which the connector captures changes.
<9> The maximum number of tasks to create for this connector.
<10> The name of the Oracle pluggable database that the connector captures changes from. Used in container database (CDB) installations only.
<11> The list of Kafka brokers that this connector uses to write and recover DDL statements to the database schema history topic.
<12> The name of the database schema history topic where the connector writes and recovers DDL statements. This topic is for internal use only and should not be used by consumers.

In the previous example, the `database.hostname` and `database.port` properties are used to define the connection to the database host.
However, in more complex Oracle deployments, or in deployments that use Transparent Network Substrate (TNS) names, you can use an alternative method in which you specify a JDBC URL.

The following JSON example shows the same configuration as in the preceding example, except that it uses a JDBC URL to connect to the database.

.Example: {prodname} Oracle connector configuration that uses a JDBC URL to connect to the database
[source,json,indent=0]
----
{
    "name": "inventory-connector",
    "config": {
        "connector.class" : "io.debezium.connector.oracle.OracleConnector",
        "tasks.max" : "1",
        "topic.prefix" : "server1",
        "database.user" : "c##dbzuser",
        "database.password" : "dbz",
        "database.url": "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=OFF)(FAILOVER=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=<oracle ip 1>)(PORT=1521))(ADDRESS=(PROTOCOL=TCP)(HOST=<oracle ip 2>)(PORT=1521)))(CONNECT_DATA=SERVICE_NAME=)(SERVER=DEDICATED)))",
        "database.dbname" : "ORCLCDB",
        "database.pdb.name" : "ORCLPDB1",
        "schema.history.internal.kafka.bootstrap.servers" : "kafka:9092",
        "schema.history.internal.kafka.topic": "schema-changes.inventory"
    }
}
----
endif::community[]

For the complete list of the configuration properties that you can set for the {prodname} Oracle connector, see xref:oracle-connector-properties[Oracle connector properties].

ifdef::community[]
You can send this configuration with a `POST` command to a running Kafka Connect service.
The service records the configuration and starts a connector task that performs the following operations:

* Connects to the Oracle database.
* Reads the redo log.
* Records change events to Kafka topics.

[[oracle-adding-connector-configuration]]
=== Adding connector configuration

To start running a {prodname} Oracle connector, create a connector configuration, and add the configuration to your Kafka Connect cluster.

.Prerequisites

* xref:setting-up-oracle[Oracle is configured for use with {prodname}].
* The {prodname} Oracle connector is installed.

.Procedure

. Create a xref:oracle-example-configuration[configuration] for the Oracle connector.

. Use the link:{link-kafka-docs}/#connect_rest[Kafka Connect REST API] to add that connector configuration to your Kafka Connect cluster.
endif::community[]

.Results

After the connector starts, it xref:oracle-snapshots[performs a consistent snapshot] of the Oracle databases that the connector is configured for.
The connector then starts generating data change events for row-level operations and streaming the change event records to Kafka topics.

// Type: concept
// ModuleID: configuration-of-container-databases-and-non-container-databases
// Title: Configuration of container databases and non-container-databases
[[pluggable-vs-non-pluggable-databases]]
=== Pluggable vs Non-Pluggable databases
[[oracle-database-mode]]


Oracle Database supports the following deployment types:

Container database (CDB):: A database that can contain multiple pluggable databases (PDBs).
Database clients connect to each PDB as if it were a standard, non-CDB database.

Non-container database (non-CDB):: A standard Oracle database, which does not support the creation of pluggable databases.


ifdef::community[]


.Example: {prodname} connector configuration for CDB deployments
[source,json,indent=0]
----
{
    "config": {
        "connector.class" : "io.debezium.connector.oracle.OracleConnector",
        "tasks.max" : "1",
        "topic.prefix" : "server1",
        "database.hostname" : "<oracle ip>",
        "database.port" : "1521",
        "database.user" : "c##dbzuser",
        "database.password" : "dbz",
        "database.dbname" : "ORCLCDB",
        "database.pdb.name" : "ORCLPDB1",
        "schema.history.internal.kafka.bootstrap.servers" : "kafka:9092",
        "schema.history.internal.kafka.topic": "schema-changes.inventory"
    }
}
----

[IMPORTANT]
====
When you configure a {prodname} Oracle connector for use with an Oracle CDB, you must specify a value for the property `database.pdb.name`, which names the PDB that you want the connector to capture changes from.
For non-CDB installation, do *not* specify the `database.pdb.name` property.
====

.Example: {prodname} Oracle connector configuration for non-CDB deployments
[source,json,indent=0]
----
{
    "config": {
        "connector.class" : "io.debezium.connector.oracle.OracleConnector",
        "tasks.max" : "1",
        "topic.prefix" : "server1",
        "database.hostname" : "<oracle ip>",
        "database.port" : "1521",
        "database.user" : "c##dbzuser",
        "database.password" : "dbz",
        "database.dbname" : "ORCLCDB",
        "schema.history.internal.kafka.bootstrap.servers" : "kafka:9092",
        "schema.history.internal.kafka.topic": "schema-changes.inventory"
    }
}
----

endif::community[]

[[using-mtls-secure-connections]]
=== Using mTLS secure connections

When connecting to Oracle using mutual TLS authentication (mTLS), this involves both the connector and the database service proving their identities.
The {prodname} for Oracle connector relies on the Oracle JDBC driver's built-in functionality to support mTLS authentication.

.Prerequisites
* Verify Oracle Wallet is configured on the Oracle database server with your database administrators
* Locate the `oraclepki.jar` inside the Oracle JDBC driver archive

.Procedure
* Install `oraclepki.jar` in the same location where ${prodname} Debezium Oracle connector jars exist.
If you have downloaded and installed the Oracle JDBC driver, the same location is where you would also place `oraclepki.jar`.
* Use the `database.url` configuration property rather than `database.hostname` to configure the connector.
By using `database.url`, a TNS-based configuration is provided to interact with Oracle Wallet.
A sample configuration is shown below.
* Set the Oracle JDBC driver property `oracle.net.wallet_location` to explicitly set the Oracle Wallet configuration to be used by the Oracle JDBC driver.

.Example mTLS configuration
[source,json]
----
{
  "database.url": "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(PORT=xxxx)(HOST=xx.xx.xx.xx))(CONNECT_DATA=(SID=xxxx)))",
  "driver.oracle.net.wallet_location": "(SOURCE=(METHOD=file)(METHOD_DATA=(DIRECTORY=/opt/kafka/external-configuration/oracle_wallet/)))"
}
----

[WARNING]
====
Be sure that you set the correct host, port, and service identifier (sid) in the `database.url`.
Additionally, be sure that the directory in the `driver.oracle.net.wallet_location` is readable.
====

ifdef::product[]
// Type: procedure
[id="verifying-that-the-debezium-oracle-connector-is-running"]
=== Verifying that the {prodname} Oracle connector is running

include::{partialsdir}/modules/all-connectors/proc-verifying-the-connector-deployment.adoc[leveloffset=+1]

endif::product[]

// Type: reference
// Title: Descriptions of {prodname} Oracle connector configuration properties
// ModuleID: descriptions-of-debezium-oracle-connector-configuration-properties
[[oracle-connector-properties]]
== Connector properties

The {prodname} Oracle connector has numerous configuration properties that you can use to achieve the right connector behavior for your application.
Many properties have default values.
Information about the properties is organized as follows:

* xref:required-debezium-oracle-connector-configuration-properties[Required {prodname} Oracle connector configuration properties]
* xref:debezium-oracle-connector-database-history-configuration-properties[Database schema history connector configuration properties] that control how {prodname} processes events that it reads from the database schema history topic.

* xref:debezium-oracle-connector-pass-through-properties[Pass-through Db2 connector configuration properties]
** xref:debezium-oracle-pass-through-database-history-properties-for-configuring-producer-and-consumer-clients[Pass-through database schema history properties for configuring producer and consumer clients]
** xref:debezium-oracle-connector-pass-through-kafka-signals-configuration-properties[Pass-through Kafka signals configuration properties]
** xref:debezium-oracle-connector-pass-through-signals-kafka-consumer-client-configuration-properties[Pass-through Kafka signals consumer client configuration properties]
** xref:debezium-oracle-connector-pass-through-kafka-sink-notification-configuration-properties[Pass-through sink notification configuration properties]
** xref:debezium-oracle-connector-pass-through-database-driver-configuration-properties[Pass-through database driver configuration properties]

[id="required-debezium-{context}-connector-configuration-properties"]
=== Required {prodname} Oracle connector configuration properties
The following configuration properties are _required_ unless a default value is available.

[cols="30%a,25%a,45%a"]
|===
|Property
|Default
|Description

|[[oracle-property-name]]<<oracle-property-name, `+name+`>>
|No default
|Unique name for the connector. Attempting to register again with the same name will fail. (This property is required by all Kafka Connect connectors.)

|[[oracle-property-connector-class]]<<oracle-property-connector-class, `+connector.class+`>>
|No default
|The name of the Java class for the connector. Always use a value of `io.debezium.connector.oracle.OracleConnector` for the Oracle connector.

|[[oracle-property-converters]]<<oracle-property-converters, `converters`>>
|No default
|Enumerates a comma-separated list of the symbolic names of the {link-prefix}:{link-custom-converters}#custom-converters[custom converter] instances that the connector can use. +
For example, `boolean`. +
This property is required to enable the connector to use a custom converter.

For each converter that you configure for a connector, you must also add a `.type` property, which specifies the fully-qualified name of the class that implements the converter interface.
The `.type` property uses the following format: +

`_<converterSymbolicName>_.type` +

For example, +

 boolean.type: io.debezium.connector.oracle.converters.NumberOneToBooleanConverter

If you want to further control the behavior of a configured converter, you can add one or more configuration parameters to pass values to the converter.
To associate any additional configuration parameters with a converter, prefix the parameter names with the symbolic name of the converter. +
 +
For example, to define a `selector` parameter that specifies the subset of columns that the `boolean` converter processes, add the following property: +

 boolean.selector: .*MYTABLE.FLAG,.*.IS_ARCHIVED

|[[oracle-property-tasks-max]]<<oracle-property-tasks-max, `+tasks.max+`>>
|`1`
|The maximum number of tasks to create for this connector. The Oracle connector always uses a single task and therefore does not use this value, so the default is always acceptable.

|[[oracle-property-database-hostname]]<<oracle-property-database-hostname, `+database.hostname+`>>
|No default
|IP address or hostname of the Oracle database server.

|[[oracle-property-database-port]]<<oracle-property-database-port, `+database.port+`>>
|No default
|Integer port number of the Oracle database server.

|[[oracle-property-database-user]]<<oracle-property-database-user, `+database.user+`>>
|No default
|Name of the Oracle user account that the connector uses to connect to the Oracle database server.

|[[oracle-property-database-password]]<<oracle-property-database-password, `+database.password+`>>
|No default
|Password to use when connecting to the Oracle database server.

|[[oracle-property-database-dbname]]<<oracle-property-database-dbname, `+database.dbname+`>>
|No default
|Name of the database to connect to.
In a container database environment, specify the name of the root container database (CDB), not the name of an included pluggable database (PDB).

|[[oracle-property-database-url]]<<oracle-property-database-url, `+database.url+`>>
|No default
|Specifies the raw database JDBC URL. Use this property to provide flexibility in defining that database connection.
Valid values include raw TNS names and RAC connection strings.

|[[oracle-property-database-pdb-name]]<<oracle-property-database-pdb-name, `+database.pdb.name+`>>
|No default
|Name of the Oracle pluggable database to connect to. Use this property with container database (CDB) installations only.

|[[oracle-property-topic-prefix]]<<oracle-property-topic-prefix, `+topic.prefix+`>>
|No default
|Topic prefix that provides a namespace for the Oracle database server from which the connector captures changes.
The value that you set is used as a prefix for all Kafka topic names that the connector emits.
Specify a topic prefix that is unique among all connectors in your {prodname} environment.
The following characters are valid: alphanumeric characters, hyphens, dots, and underscores. +
 +
[WARNING]
====
Do not change the value of this property.
If you change the name value, after a restart, instead of continuing to emit events to the original topics, the connector emits subsequent events to topics whose names are based on the new value.
The connector is also unable to recover its database schema history topic.
====

|[[oracle-property-database-connection-adapter]]<<oracle-property-database-connection-adapter, `+database.connection.adapter+`>>
|`logminer`
|The adapter implementation that the connector uses when it streams database changes.
You can set the following values:

`logminer` (default):: The connector uses the native Oracle LogMiner API.
ifdef::community[]
`olr`:: The connector uses OpenLogReplicator.
`xstream`:: The connector uses the Oracle XStreams API.
endif::community[]
|[[oracle-property-snapshot-mode]]<<oracle-property-snapshot-mode, `+snapshot.mode+`>>
|_initial_
|Specifies the mode that the connector uses to take snapshots of a captured table.
You can set the following values:

`always`:: The snapshot includes the structure and data of the captured tables.
Specify this value to populate topics with a complete representation of the data from the captured tables on each connector start.

`initial`:: The snapshot includes the structure and data of the captured tables.
Specify this value to populate topics with a complete representation of the data from the captured tables.
If the snapshot completes successfully, upon next connector start snapshot is not executed again.

`initial_only`:: The snapshot includes the structure and data of the captured tables.
The connector performs an initial snapshot and then stops, without processing any subsequent changes.

`schema_only`:: Deprecated, see `no_data`

`no_data`:: The snapshot includes only the structure of captured tables.
Specify this value if you want the connector to capture data only for changes that occur after the snapshot.

`schema_only_recovery`:: Deprecated, see `recovery`.

`recovery`:: This is a recovery setting for a connector that has already been capturing changes.
When you restart the connector, this setting enables recovery of a corrupted or lost database schema history topic.
You might set it periodically to "clean up" a database schema history topic that has been growing unexpectedly.
Database schema history topics require infinite retention.
Note this mode is only safe to be used when it is guaranteed that no schema changes happened since the point in time the connector was shut down before and the point in time the snapshot is taken.

After the snapshot is complete, the connector continues to read change events from the database's redo logs except when `snapshot.mode` is configured as `initial_only`.

`when_needed`:: After the connector starts, it performs a snapshot only if it detects one of the following circumstances:

* It cannot detect any topic offsets.
* A previously recorded offset specifies a log position that is not available on the server.

ifdef::community[]
`configuration_based`:: With this option, you control snapshot behavior through a set of connector properties that have the prefix 'snapshot.mode.configuration.based'.
endif::community[]

ifdef::community[]
`custom`:: The connector performs a snapshot according to the implementation specified by the xref:postgresql-property-snapshot-mode-custom-name[`snapshot.mode.custom.name`] property, which defines a custom implementation of the `io.debezium.spi.snapshot.Snapshotter` interface.
endif::community[]

For more information, see the xref:oracle-connector-snapshot-mode-options[table of `snapshot.mode` options].

ifdef::community[]
|[[oracle-property-snapshot-mode-configuration-based-snapshot-data]]<<oracle-property-configuration-based-snapshot-data, `+snapshot.mode.configuration.based.snapshot.data+`>>
|false
|If the `snapshot.mode` is set to `configuration_based`, set this property to specify whether the connector includes table data when it performs a snapshot.
endif::community[]

ifdef::community[]
|[[oracle-property-snapshot-mode-configuration-based-snapshot-schema]]<<oracle-property-configuration-based-snapshot-schema, `+snapshot.mode.configuration.based.snapshot.schema+`>>
|false
|If the `snapshot.mode` is set to `configuration_based`, set this property to specify whether the connector includes the table schema when it performs a snapshot.
endif::community[]

ifdef::community[]
|[[oracle-property-snapshot-mode-configuration-based-start-stream]]<<oracle-property-configuration-based-start-stream, `+snapshot.mode.configuration.based.start.stream+`>>
|false
|If the `snapshot.mode` is set to `configuration_based`, set this property to specify whether the connector begins to stream change events after a snapshot completes.
endif::community[]

ifdef::community[]
|[[oracle-property-snapshot-mode-configuration-based-snapshot-on-schema-error]]<<oracle-property-configuration-based-snapshot-on-schema-error, `+snapshot.mode.configuration.based.snapshot.on.schema.error+`>>
|false
|If the `snapshot.mode` is set to `configuration_based`, set this property to specify whether the connector includes table schema in a snapshot if the schema history topic is not available.
endif::community[]

ifdef::community[]
|[[oracle-property-snapshot-mode-configuration-based-snapshot-on-data-error]]<<oracle-property-configuration-based-snapshot-on-data-error, `+snapshot.mode.configuration.based.snapshot.on.data.error+`>>
|false
|If the `snapshot.mode` is set to `configuration_based`, this property specifies whether the connector attempts to snapshot table data if it does not find the last committed offset in the transaction log. +
Set the value to `true` to instruct the connector to perform a new snapshot.
endif::community[]

ifdef::community[]
|[[oracle-property-snapshot-mode-custom-name]]<<oracle-property-snapshot-mode-custom-name, `+snapshot.mode.custom.name+`>>
|No default
|If `snapshot.mode` is set to `custom`, use this setting to specify the name of the custom implementation that is provided in the `name()` method that is defined in the 'io.debezium.spi.snapshot.Snapshotter' interface.
After a connector restart, {prodname} calls the specified custom implementation to determine whether to perform a snapshot.
For more information, see xref:connector-custom-snapshot[custom snapshotter SPI].
endif::community[]

|[[oracle-property-snapshot-locking-mode]]<<oracle-property-snapshot-locking-mode, `+snapshot.locking.mode+`>>
|_shared_
a|Controls whether and for how long the connector holds a table lock. Table locks prevent certain types of changes table operations from occurring while the connector performs a snapshot.
You can set the following values:

`shared`:: Enables concurrent access to the table, but prevents any session from acquiring an exclusive table lock.
  The connector acquires a `ROW SHARE` level lock while it captures table schema.

`none`:: Prevents the connector from acquiring any table locks during the snapshot.
  Use this setting only if no schema changes might occur during the creation of the snapshot.

ifdef::community[]
`custom`:: The connector performs a snapshot according to the implementation specified by the xref:oracle-property-snapshot-locking-mode-custom-name[`snapshot.locking.mode.custom.name`] property, which is a custom implementation of the `io.debezium.spi.snapshot.SnapshotLock` interface.
endif::community[]

ifdef::community[]
|[[oracle-property-snapshot-locking-mode-custom-name]]<<oracle-property-snapshot-locking-mode-custom-name, `+snapshot.locking.mode.custom.name+`>>
|No default
| When `snapshot.locking.mode` is set as `custom`, use this setting to specify the name of the custom implementation provided in the `name()` method that is defined by the 'io.debezium.spi.snapshot.SnapshotLock' interface.
For more information, see xref:connector-custom-snapshot[custom snapshotter SPI].
endif::community[]

|[[oracle-property-snapshot-query-mode]]<<oracle-property-snapshot-query-mode, `+snapshot.query.mode+`>>
|`select_all`
|Specifies how the connector queries data while performing a snapshot. +
Set one of the following options:

`select_all`:: The connector performs a `select all` query by default, optionally adjusting the columns selected based on the column include and exclude list configurations.

ifdef::community[]
`custom`:: The connector performs a snapshot query according to the implementation specified by the xref:oracle-property-snapshot-snapshot-query-mode-custom-name[`snapshot.query.mode.custom.name`] property, which defines a custom implementation of the `io.debezium.spi.snapshot.SnapshotQuery` interface. +
endif::community[]

This setting enables you to manage snapshot content in a more flexible manner compared to using the xref:oracle-property-snapshot-select-statement-overrides[`snapshot.select.statement.overrides`] property.

ifdef::community[]
|[[oracle-property-snapshot-snapshot-query-mode-custom-name]]<<oracle-property-snapshot-query-mode-custom-name, `+snapshot.query.mode.custom.name+`>>
|No default
| When xref:oracle-property-snapshot-query-mode[`snapshot.query.mode`] is set to `custom`, use this setting to specify the name of the custom implementation provided in the `name()` method that is defined by the 'io.debezium.spi.snapshot.SnapshotQuery' interface.
For more information, see xref:connector-custom-snapshot[custom snapshotter SPI].
endif::community[]

|[[oracle-property-snapshot-include-collection-list]]<<oracle-property-snapshot-include-collection-list, `+snapshot.include.collection.list+`>>
| All tables specified in the connector's xref:{context}-property-table-include-list[`table.include.list`] property.
|An optional, comma-separated list of regular expressions that match the fully-qualified names (`__<databaseName>.____<schemaName>__.__<tableName>__`) of the tables to include in a snapshot.

In a multitenant container database (CDB) environment, the regular expression must include the xref:oracle-property-database-pdb-name[pluggable database (PDB) name], using the format `__<pdbName>__.__<schemaName>__.__<tableName>__`.

To match the name of a table, {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the table; it does not match substrings that might be present in a table name. +
ifdef::product[]
Only POSIX regular expressions are valid.
endif::product[]
ifdef::community[]
In environments that use the LogMiner implementation, you must use POSIX regular expressions only.
endif::community[]

A snapshot can only include tables that are named in the connector's xref:{context}-property-table-include-list[`table.include.list`] property.

This property takes effect only if the connector's xref:oracle-property-snapshot-mode[`snapshot.mode`] property is set to a value other than `never`. +
This property does not affect the behavior of incremental snapshots. +


|[[oracle-property-snapshot-select-statement-overrides]]<<oracle-property-snapshot-select-statement-overrides, `+snapshot.select.statement.overrides+`>>
|No default
|Specifies the table rows to include in a snapshot.
Use the property if you want a snapshot to include only a subset of the rows in a table.
This property affects snapshots only.
It does not apply to events that the connector reads from the log.

The property contains a comma-separated list of fully-qualified table names in the form `_<schemaName>.<tableName>_`. For example, +
 +
`+"snapshot.select.statement.overrides": "inventory.products,customers.orders"+` +
 +
For each table in the list, add a further configuration property that specifies the `SELECT` statement for the connector to run on the table when it takes a snapshot.
The specified `SELECT` statement determines the subset of table rows to include in the snapshot.
Use the following format to specify the name of this `SELECT` statement property: +
 +
`snapshot.select.statement.overrides._<schemaName>_._<tableName>_` +
 +
For example,
`snapshot.select.statement.overrides.customers.orders` +
 +
Example:

From a `customers.orders` table that includes the soft-delete column, `delete_flag`, add the following properties if you want a snapshot to include only those records that are not soft-deleted:

----
"snapshot.select.statement.overrides": "customer.orders",
"snapshot.select.statement.overrides.customer.orders": "SELECT * FROM customers.orders WHERE delete_flag = 0 ORDER BY id DESC"
----

In the resulting snapshot, the connector includes only the records for which `delete_flag = 0`.

|[[oracle-property-schema-include-list]]<<oracle-property-schema-include-list, `+schema.include.list+`>>
|No default
|An optional, comma-separated list of regular expressions that match names of schemas for which you *want* to capture changes.
ifdef::product[]
Only POSIX regular expressions are valid.
endif::product[]
ifdef::community[]
In environments that use the LogMiner implementation, you must use POSIX regular expressions only.
endif::community[]
Any schema name not included in `schema.include.list` is excluded from having its changes captured.
By default, all non-system schemas have their changes captured. +

To match the name of a schema, {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the schema; it does not match substrings that might be present in a schema name. +
If you include this property in the configuration, do not also set the `schema.exclude.list` property.

|[[oracle-property-include-schema-comments]]<<oracle-property-include-schema-comments, `+include.schema.comments+`>>
|`false`
|Boolean value that specifies whether the connector should parse and publish table and column comments on metadata objects. Enabling this option will bring the implications on memory usage. The number and size of logical schema objects is what largely impacts how much memory is consumed by the Debezium connectors, and adding potentially large string data to each of them can potentially be quite expensive.

|[[oracle-property-schema-exclude-list]]<<oracle-property-schema-exclude-list, `+schema.exclude.list+`>>
|No default
|An optional, comma-separated list of regular expressions that match names of schemas for which you *do not* want to capture changes.
ifdef::product[]
Only POSIX regular expressions are valid.
endif::product[]
ifdef::community[]
In environments that use the LogMiner implementation, you must use POSIX regular expressions only. +
endif::community[]
Any schema whose name is not included in `schema.exclude.list` has its changes captured, with the exception of system schemas. +

To match the name of a schema, {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the schema; it does not match substrings that might be present in a schema name. +
If you include this property in the configuration, do not set the`schema.include.list` property.

|[[oracle-property-table-include-list]]<<oracle-property-table-include-list, `+table.include.list+`>>
|No default
|An optional comma-separated list of regular expressions that match fully-qualified table identifiers for tables to be captured.
ifdef::product[]
Only POSIX regular expressions are valid.
endif::product[]
ifdef::community[]
If you use the LogMiner implementation, use only POSIX regular expressions with this property.
endif::community[]
When this property is set, the connector captures changes only from the specified tables.
Each table identifier uses the following format: +
 +
`__<schema_name>.<table_name>__` +
 +
By default, the connector monitors every non-system table in each captured database. +

To match the name of a table, {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the table; it does not match substrings that might be present in a table name. +
If you include this property in the configuration, do not also set the `table.exclude.list` property.

|[[oracle-property-table-exclude-list]]<<oracle-property-table-exclude-list, `+table.exclude.list+`>>
|No default
|An optional comma-separated list of regular expressions that match fully-qualified table identifiers for tables to be excluded from monitoring.
ifdef::product[]
Only POSIX regular expressions are valid.
endif::product[]
ifdef::community[]
If you use the LogMiner implementation, use only POSIX regular expressions with this property.
endif::community[]
The connector captures change events from any table that is not specified in the exclude list.
Specify the identifier for each table using the following format: +
 +
`_<schemaName>.<tableName>_`.

To match the name of a table, {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the table; it does not match substrings that might be present in a table name. +
If you include this property in the configuration, do not also set the `table.include.list` property.

|[[oracle-property-column-include-list]]<<oracle-property-column-include-list, `+column.include.list+`>>
|No default
|An optional, comma-separated list of regular expressions that match the fully-qualified names of columns that want to include in the change event message values.
ifdef::product[]
Only POSIX regular expressions are valid.
endif::product[]
ifdef::community[]
In environments that use the LogMiner implementation, you must use POSIX regular expressions only.
endif::community[]
Fully-qualified names for columns use the following format: +
 +
`_<Schema_name>.<table_name>.<column_name>_` +
 +
The primary key column is always included in an event's key, even if you do not use this property to explicitly include its value. +

To match the name of a column, {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the column it does not match substrings that might be present in a column name. +
If you include this property in the configuration, do not also set the `column.exclude.list` property.

|[[oracle-property-column-exclude-list]]<<oracle-property-column-exclude-list, `+column.exclude.list+`>>
|No default
|An optional, comma-separated list of regular expressions that match the fully-qualified names of columns that you want to exclude from change event message values.
ifdef::product[]
Only POSIX regular expressions are valid.
endif::product[]
ifdef::community[]
In environments that use the LogMiner implementation, you must use POSIX regular expressions only.
endif::community[]
Fully-qualified column names use the following format: +
 +
`_<schema_name>.<table_name>.<column_name>_` +
 +
The primary key column is always included in an event's key, even if you use this property to explicitly exclude its value. +

To match the name of a column, {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the column it does not match substrings that might be present in a column name. +
If you include this property in the configuration, do not set the `column.include.list` property.

|[[oracle-property-skip-messages-without-change]]<<oracle-property-skip-messages-without-change, `+skip.messages.without.change+`>>
|`false`
| Specifies whether to skip publishing messages when there is no change in included columns. This would essentially filter messages if there is no change in columns included as per `column.include.list` or `column.exclude.list` properties.

|[[oracle-property-column-mask-hash]]<<oracle-property-column-mask-hash, `column.mask.hash._hashAlgorithm_.with.salt._salt_`>>;
[[oracle-property-column-mask-hash-v2]]<<oracle-property-column-mask-hash-v2, `column.mask.hash.v2._hashAlgorithm_.with.salt._salt_`>>
|_n/a_
|An optional, comma-separated list of regular expressions that match the fully-qualified names of character-based columns.
Fully-qualified names for columns are of the form `_<schemaName>_._<tableName>_._<columnName>_`. +
To match the name of a column {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the column; the expression does not match substrings that might be present in a column name. +
In the resulting change event record, the values for the specified columns are replaced with pseudonyms. +

A pseudonym consists of the hashed value that results from applying the specified _hashAlgorithm_ and _salt_.
Based on the hash function that is used, referential integrity is maintained, while column values are replaced with pseudonyms.
Supported hash functions are described in the {link-java7-standard-names}[MessageDigest section] of the Java Cryptography Architecture Standard Algorithm Name Documentation. +
 +
In the following example, `CzQMA0cB5K` is a randomly selected salt. +

----
column.mask.hash.SHA-256.with.salt.CzQMA0cB5K = inventory.orders.customerName, inventory.shipment.customerName
----

If necessary, the pseudonym is automatically shortened to the length of the column.
The connector configuration can include multiple properties that specify different hash algorithms and salts. +
 +
Depending on the _hashAlgorithm_ used, the _salt_ selected, and the actual data set, the resulting data set might not be completely masked. +
 +
Hashing strategy version 2 should be used to ensure fidelity if the value is being hashed in different places or systems.

|[[oracle-property-binary-handling-mode]]<<oracle-property-binary-handling-mode, `+binary.handling.mode+`>>
|bytes
|Specifies how binary (`blob`) columns should be represented in change events, including: `bytes` represents binary data as byte array (default), `base64` represents binary data as base64-encoded String, `base64-url-safe` represents binary data as base64-url-safe-encoded String, `hex` represents binary data as hex-encoded (base16) String


|[[oracle-property-schema-name-adjustment-mode]]<<oracle-property-schema-name-adjustment-mode,`+schema.name.adjustment.mode+`>>
|none
|Specifies how schema names should be adjusted for compatibility with the message converter used by the connector. Possible settings:  +

* `none` does not apply any adjustment. +
* `avro` replaces the characters that cannot be used in the Avro type name with underscore. +
* `avro_unicode` replaces the underscore or characters that cannot be used in the Avro type name with corresponding unicode like _uxxxx. Note: _ is an escape sequence like backslash in Java +

|[[oracle-property-field-name-adjustment-mode]]<<oracle-property-field-name-adjustment-mode,`+field.name.adjustment.mode+`>>
|none
|Specifies how field names should be adjusted for compatibility with the message converter used by the connector. Possible settings:  +

* `none` does not apply any adjustment. +
* `avro` replaces the characters that cannot be used in the Avro type name with underscore. +
* `avro_unicode` replaces the underscore or characters that cannot be used in the Avro type name with corresponding unicode like _uxxxx. Note: _ is an escape sequence like backslash in Java +

See {link-prefix}:{link-avro-serialization}#avro-naming[Avro naming] for more details.

|[[oracle-property-decimal-handling-mode]]<<oracle-property-decimal-handling-mode, `+decimal.handling.mode+`>>
|`precise`
| Specifies how the connector should handle floating point values for `NUMBER`, `DECIMAL` and `NUMERIC` columns.
You can set one of the following options:

`precise` (default):: Represents values precisely by using `java.math.BigDecimal` values represented in change events in a binary form.
`double`:: Represents values by using `double` values.
  Using `double` values is easier, but can result in a loss of precision.
`string`:: Encodes values as formatted strings.
  Using the `string` option is easier to consume, but results in a loss of semantic information about the real type.
  For more information, see <<oracle-numeric-types>>.

|[[oracle-property-interval-handling-mode]]<<oracle-property-interval-handling-mode, `+interval.handling.mode+`>>
|`numeric`
| Specifies how the connector should handle values for `interval` columns: +
 +
`numeric` represents intervals using approximate number of microseconds. +
 +
`string` represents intervals exactly by using the string pattern representation `P<years>Y<months>M<days>DT<hours>H<minutes>M<seconds>S`. For example: `P1Y2M3DT4H5M6.78S`.

|[[oracle-property-event-processing-failure-handling-mode]]<<oracle-property-event-processing-failure-handling-mode, `+event.processing.failure.handling.mode+`>>
|`fail`
| Specifies how the connector should react to exceptions during processing of events.
You can set one of the following options:

`fail`:: Propagates the exception (indicating the offset of the problematic event), causing the connector to stop.
`warn`:: Causes the problematic event to be skipped. The offset of the problematic event is then logged.
`skip`:: Causes the problematic event to be skipped.

|[[oracle-property-max-batch-size]]<<oracle-property-max-batch-size, `+max.batch.size+`>>
|`2048`
|A positive integer value that specifies the maximum size of each batch of events to process during each iteration of this connector.

|[[oracle-property-max-queue-size]]<<oracle-property-max-queue-size, `+max.queue.size+`>>
|`8192`
|Positive integer value that specifies the maximum number of records that the blocking queue can hold.
When {prodname} reads events streamed from the database, it places the events in the blocking queue before it writes them to Kafka.
The blocking queue can provide backpressure for reading change events from the database
in cases where the connector ingests messages faster than it can write them to Kafka, or when Kafka becomes unavailable.
Events that are held in the queue are disregarded when the connector periodically records offsets.
Always set the value of `max.queue.size` to be larger than the value of xref:{context}-property-max-batch-size[`max.batch.size`].

|[[oracle-property-max-queue-size-in-bytes]]<<oracle-property-max-queue-size-in-bytes, `+max.queue.size.in.bytes+`>>
|`0` (disabled)
|A long integer value that specifies the maximum volume of the blocking queue in bytes.
By default, volume limits are not specified for the blocking queue.
To specify the number of bytes that the queue can consume, set this property to a positive long value. +
If xref:oracle-property-max-queue-size[`max.queue.size`] is also set, writing to the queue is blocked when the size of the queue reaches the limit specified by either property.
For example, if you set `max.queue.size=1000`, and `max.queue.size.in.bytes=5000`, writing to the queue is blocked after the queue contains 1000 records, or after the volume of the records in the queue reaches 5000 bytes.

|[[oracle-property-poll-interval-ms]]<<oracle-property-poll-interval-ms, `+poll.interval.ms+`>>
|`500` (0.5 second)
|Positive integer value that specifies the number of milliseconds the connector should wait during each iteration for new change events to appear.

|[[oracle-property-include-schema-changes]]<<oracle-property-include-schema-changes, `+include.schema.changes+`>>
|`true`
|Boolean value that specifies whether the connector publishes changes in the database schema to a Kafka topic with the same name as the topic prefix.
The connector records each schema change with a key that contains the database name, and a value that is a JSON structure that describes the schema update.
This mechanism for recording schema changes is independent of the connector's internal recording of changes to the database schema history.

|[[oracle-property-tombstones-on-delete]]<<oracle-property-tombstones-on-delete, `+tombstones.on.delete+`>>
|`true`
|Controls whether a _delete_ event is followed by a tombstone event.
The following values are possible:

`true`:: For each delete operation, the connector emits a _delete_ event and a subsequent tombstone event.
`false`:: For each delete operation, the connector emits only a _delete_ event.

After a source record is deleted, a tombstone event (the default behavior) enables Kafka to completely delete all events that share the key of the deleted row in topics that have {link-kafka-docs}/#compaction[log compaction] enabled.

|[[oracle-property-message-key-columns]]<<oracle-property-message-key-columns, `+message.key.columns+`>>
|No default
|A list of expressions that specify the columns that the connector uses to form custom message keys for change event records that it publishes to the Kafka topics for specified tables.

By default, {prodname} uses the primary key column of a table as the message key for records that it emits.
In place of the default, or to specify a key for tables that lack a primary key, you can configure custom message keys based on one or more columns. +
To establish a custom message key for a table, list the table, followed by the columns to use as the message key.
Each list entry takes the following format: +
 +
   `_<fullyQualifiedTableName>_`:``_<keyColumn>_``,``_<keyColumn>_`` +
 +
To base a table key on multiple column names, insert commas between the column names. +
Each fully-qualified table name is a regular expression in the following format: +
 +
`_<schemaName>_._<tableName>_` +
 +
The property can include entries for multiple tables.
Use a semicolon to separate table entries in the list. +
 The following example sets the message key for the tables `inventory.customers` and `purchase.orders`: +
 +
`inventory.customers:pk1,pk2;(.*).purchaseorders:pk3,pk4` +
 +
For the table `inventory.customer`, the columns `pk1` and `pk2` are specified as the message key.
For the `purchaseorders` tables in any schema, the columns `pk3` and `pk4` server as the message key. +
There is no limit to the number of columns that you use to create custom message keys.
However, it's best to use the minimum number that are required to specify a unique key.

|[[oracle-property-column-truncate-to-length-chars]]<<oracle-property-column-truncate-to-length-chars, `column.truncate.to._length_.chars`>>
|No default
|An optional, comma-separated list of regular expressions that match the fully-qualified names of character-based columns.
Set this property if you want the connector to mask the values for a set of columns, for example, if they contain sensitive data.
Set `_length_` to a positive integer to replace data in the specified columns with the number of asterisk (`*`) characters specified by the _length_ in the property name.
Set _length_ to `0` (zero) to replace data in the specified columns with an empty string.

The fully-qualified name of a column observes the following format: `_<schemaName>_._<tableName>_._<columnName>_`.
To match the name of a column, {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the column; the expression does not match substrings that might be present in a column name.

You can specify multiple properties with different lengths in a single configuration.

|[[oracle-property-column-mask-with-length-chars]]<<oracle-property-column-mask-with-length-chars, `column.mask.with._length_.chars`>>
|No default
|An optional comma-separated list of regular expressions for masking column names in change event messages by replacing characters with asterisks (`*`). +
Specify the number of characters to replace in the name of the property, for example, `column.mask.with.8.chars`. +
Specify length as a positive integer or zero.
Then add regular expressions to the list for each character-based column name where you want to apply a mask. +
Use the following format to specify fully-qualified column names: `_<schemaName>_._<tableName>_._<columnName>_`. +
 +
The connector configuration can include multiple properties that specify different lengths.

|[[oracle-property-column-propagate-source-type]]<<oracle-property-column-propagate-source-type, `+column.propagate.source.type+`>>
|No default
|An optional, comma-separated list of regular expressions that match the fully-qualified names of columns for which you want the connector to emit extra parameters that represent column metadata.
When this property is set, the connector adds the following fields to the schema of event records:

* `pass:[_]pass:[_]debezium.source.column.type` +
* `pass:[_]pass:[_]debezium.source.column.length` +
* `pass:[_]pass:[_]debezium.source.column.scale` +

These parameters propagate a column's original type name and length (for variable-width types), respectively. +
Enabling the connector to emit this extra data can assist in properly sizing specific numeric or character-based columns in sink databases.

The fully-qualified name of a column observes one of the following formats: `_<tableName>_._<columnName>_`, or `_<schemaName>_._<tableName>_._<columnName>_`. +
To match the name of a column, {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the column; the expression does not match substrings that might be present in a column name.

|[[oracle-property-datatype-propagate-source-type]]<<oracle-property-datatype-propagate-source-type, `+datatype.propagate.source.type+`>>
|No default
|An optional, comma-separated list of regular expressions that specify the fully-qualified names of data types that are defined for columns in a database.
When this property is set, for columns with matching data types, the connector emits event records that include the following extra fields in their schema:

* `pass:[_]pass:[_]debezium.source.column.type` +
* `pass:[_]pass:[_]debezium.source.column.length` +
* `pass:[_]pass:[_]debezium.source.column.scale` +

These parameters propagate a column's original type name and length (for variable-width types), respectively. +
Enabling the connector to emit this extra data can assist in properly sizing specific numeric or character-based columns in sink databases.

The fully-qualified name of a column observes one of the following formats: `_<tableName>_._<typeName>_`, or `_<schemaName>_._<tableName>_._<typeName>_`.  +
To match the name of a data type, {prodname} applies the regular expression that you specify as an _anchored_ regular expression.
That is, the specified expression is matched against the entire name string of the data type; the expression does not match substrings that might be present in a type name.

For the list of Oracle-specific data type names, see the xref:oracle-data-type-mappings[Oracle data type mappings].

|[[oracle-property-heartbeat-interval-ms]]<<oracle-property-heartbeat-interval-ms, `+heartbeat.interval.ms+`>>
|`0`
|Specifies, in milliseconds, how frequently the connector sends messages to a heartbeat topic. +
Use this property to determine whether the connector continues to receive change events from the source database. +
It can also be useful to set the property in situations where no change events occur in captured tables for an extended period. +
In such a case, although the connector continues to read the redo log, it emits no change event messages, so that the offset in the Kafka topic remains unchanged.
Because the connector does not flush the latest system change number (SCN) that it read from the database, the database might retain the redo log files for longer than necessary.
If the connector restarts, the extended retention period could result in the connector redundantly sending some change events. +
The default value of `0` prevents the connector from sending any heartbeat messages.

|[[oracle-property-heartbeat-action-query]]<<oracle-property-heartbeat-action-query, `+heartbeat.action.query+`>>
|No default
|Specifies a query that the connector executes on the source database when the connector sends a heartbeat message. +
 +
For example: +
 +
`INSERT INTO test_heartbeat_table (text) VALUES ('test_heartbeat')` +
 +
The connector runs the query after it emits a xref:oracle-property-heartbeat-interval-ms[heartbeat message].

Set this property and create a heartbeat table to receive the heartbeat messages to resolve situations in which xref:low-change-frequency-offset-management[{prodname} fails to synchronize offsets on low-traffic databases that are on the same host as a high-traffic database].
After the connector inserts records into the configured table, it is able to receive changes from the low-traffic database and acknowledge SCN changes in the database, so that offsets can be synchronized with the broker.

|[[oracle-property-snapshot-delay-ms]]<<oracle-property-snapshot-delay-ms, `+snapshot.delay.ms+`>>
|No default
|Specifies an interval in milliseconds that the connector waits after it starts before it takes a snapshot. +
Use this property to prevent snapshot interruptions when you start multiple connectors in a cluster, which might cause re-balancing of connectors.

|[[oracle-property-streaming-delay-ms]]<<oracle-property-streaming-delay-ms, `+streaming.delay.ms+`>>
|0
|Specifies the time, in milliseconds, that the connector delays the start of the streaming process after it completes a snapshot.
Setting a delay interval helps to prevent the connector from restarting snapshots in the event that a failure occurs immediately after the snapshot completes, but before the streaming process begins.
Set a delay value that is higher than the value of the {link-kafka-docs}/#connectconfigs_offset.flush.interval.ms[`offset.flush.interval.ms`] property that is set for the Kafka Connect worker.

|[[oracle-property-snapshot-fetch-size]]<<oracle-property-snapshot-fetch-size, `+snapshot.fetch.size+`>>
|`10000`
|Specifies the maximum number of rows that should be read in one go from each table while taking a snapshot.
The connector reads table contents in multiple batches of the specified size.

|[[oracle-property-query-fetch-size]]<<oracle-property-query-fetch-size, `+query.fetch.size+`>>
|`10000`
|Specifies the number of rows that will be fetched for each database round-trip of a given query.
Using a value of `0` will use the JDBC driver's default fetch size.

|[[oracle-property-provide-transaction-metadata]]<<oracle-property-provide-transaction-metadata, `+provide.transaction.metadata+`>>
|`false`
|Set the property to `true` if you want {prodname} to generate events with transaction boundaries and enriches data events envelope with transaction metadata.

See xref:oracle-transaction-metadata[Transaction Metadata] for additional details.

|[[oracle-property-log-mining-strategy]]<<oracle-property-log-mining-strategy, `+log.mining.strategy+`>>
|`online_catalog`
|Specifies the mining strategy that controls how Oracle LogMiner builds and uses a given data dictionary for resolving table and column ids to names. +
Set one of the following options:

`redo_log_catalog`:: Writes the data dictionary to the online redo logs causing more archive logs to be generated over time.
This also enables tracking DDL changes against captured tables, so if the schema changes frequently this is the ideal choice.

`online_catalog`:: Uses the database's current data dictionary to resolve object ids and does not write any extra information to the online redo logs.
This allows LogMiner to mine substantially faster but at the expense that DDL changes cannot be tracked.
If the captured table(s) schema changes infrequently or never, this is the ideal choice.

`hybrid`:: Uses a combination of the database's current data dictionary and the {prodname} in-memory schema model to resolve table and column names seamlessly.
This mode performs at the level of the `online_catalog` LogMiner strategy with the schema tracking resilience of the `redo_log_catalog` strategy while not incurring the overhead of archive log generation and performance costs of the `redo_log_catalog` strategy.

|[[oracle-property-log-mining-query-filter-mode]]<<oracle-property-log-mining-query-filter-mode, `+log.mining.query.filter.mode+`>>
|`none`
|Specifies the mining query mode that controls how the Oracle LogMiner query is built. +
Set one of the following options:

`none`:: The query is generated without doing any schema, table, or username filtering in the query.

`in`:: The query is generated using a standard SQL in-clause to filter schema, table, and usernames on the database side.
The schema, table, and username configuration include/exclude lists should not specify any regular expressions as the query is built using the values directly.

`regex`:: The query is generated using Oracle's `REGEXP_LIKE` operator to filter schema and table names on the database side, along with usernames using a SQL in-clause.
The schema and table configuration include/exclude lists can safely specify regular expressions.

|[[oracle-property-log-mining-buffer-type]]<<oracle-property-log-mining-buffer-type, `+log.mining.buffer.type+`>>
|`memory`
|The buffer type controls how the connector manages buffering transaction data. +
 +
`memory` - Uses the JVM process' heap to buffer all transaction data.
Choose this option if you don't expect the connector to process a high number of long-running or large transactions.
When this option is active, the buffer state is not persisted across restarts.
Following a restart, recreate the buffer from the SCN value of the current offset. +
ifdef::community[]
 +
`infinispan_embedded` - This option uses an embedded Infinispan cache to buffer transaction data and persist it to disk. +
 +
`infinispan_remote` - This option uses a remote Infinispan cluster to buffer transaction data and persist it to disk.


|[[oracle-property-log-mining-buffer-transaction-events-threshold]]<<oracle-property-log-mining-buffer-transaction-events-threshold, `+log.mining.buffer.transaction.events.threshold+`>>
|`0`
|The maximum number of events a transaction is capable of having in the transaction buffer.
Transactions with event counts that exceed this threshold not be emitted and will be abandoned.
The default behavior is there is no transaction event threshold.

|[[oracle-property-log-mining-buffer-infinispan-cache-global]]<<oracle-property-log-mining-buffer-infinispan-cache-global, `+log.mining.buffer.infinispan.cache.global+`>>
|No default
|The XML configuration for the Infinispan global configuration.
For more information, see xref:oracle-event-buffering-infinispan[Infinispan event buffering].

|[[oracle-property-log-mining-buffer-infinispan-cache-transactions]]<<oracle-property-log-mining-buffer-infinispan-cache-transactions, `+log.mining.buffer.infinispan.cache.transactions+`>>
|No default
|The XML configuration for the Infinispan transaction cache.
For more information, see xref:oracle-event-buffering-infinispan[Infinispan event buffering].

|[[oracle-property-log-mining-buffer-infinispan-cache-events]]<<oracle-property-log-mining-buffer-infinispan-cache-events, `+log.mining.buffer.infinispan.cache.events+`>>
|No default
|The XML configuration for the Infinispan events cache.
For more information, see xref:oracle-event-buffering-infinispan[Infinispan event buffering].

|[[oracle-property-log-mining-buffer-infinispan-cache-processed-transactions]]<<oracle-property-log-mining-buffer-infinispan-cache-processed-transactions, `+log.mining.buffer.infinispan.cache.processed_transactions+`>>
|No default
|The XML configuration for the Infinispan processed transactions cache.
For more information, see xref:oracle-event-buffering-infinispan[Infinispan event buffering].

|[[oracle-property-log-mining-buffer-infinispan-cache-schema-changes]]<<oracle-property-log-mining-buffer-infinispan-cache-schema-changes, `+log.mining.buffer.infinispan.cache.schema_changes+`>>
|No default
|The XML configuration for the Infinispan schema changes cache.

|[[oracle-property-log-mining-buffer-drop-on-stop]]<<oracle-property-log-mining-buffer-drop-on-stop, `+log.mining.buffer.drop.on.stop+`>>
|`false`
|Specifies whether the buffer state is deleted after the connector stops in a graceful, expected way. +
 +
This setting only impacts buffer implementations that persist state across restarts, such as `infinispan`. +
The default behavior is that the buffer state is always retained between restarts. +
 +
Set to `true` only in testing or development environments.
endif::community[]

|[[oracle-property-log-mining-session-max-ms]]<<oracle-property-log-mining-session-max-ms, `+log.mining.session.max.ms+`>>
|`0`
|The maximum number of milliseconds that a LogMiner session can be active before a new session is used. +
 +
For low volume systems, a LogMiner session may consume too much PGA memory when the same session is used for a long period of time.
The default behavior is to only use a new LogMiner session when a log switch is detected.
By setting this value to something greater than `0`, this specifies the maximum number of milliseconds a LogMiner session can be active before it gets stopped and started to deallocate and reallocate PGA memory.

|[[oracle-property-log-mining-restart-connection]]<<oracle-property-log-mining-restart-connection, `+log.mining.restart.connection+`>>
|`false`
|Specifies whether the JDBC connection will be closed and re-opened on log switches or when mining session has reached maximum lifetime threshold. +
 +
By default, the JDBC connection is not closed across log switches or maximum session lifetimes. +
This should be enabled if you experience excessive Oracle SGA growth with LogMiner.

|[[oracle-property-log-mining-batch-size-min]]<<oracle-property-log-mining-batch-size-min, `+log.mining.batch.size.min+`>>
|`1000`
|The minimum SCN interval size that this connector attempts to read from redo/archive logs.

|[[oracle-property-log-mining-batch-size-max]]<<oracle-property-log-mining-batch-size-max, `+log.mining.batch.size.max+`>>
|`100000`
|The maximum SCN interval size that this connector uses when reading from redo/archive logs.

|[[oracle-property-log-mining-batch-size-increment]]<<oracle-property-log-mining-batch-size-increment, `+log.mining.batch.size.increment+`>>
|`20000`
|The amount to increase/decrease the interval that the connector uses to read from redo/archive logs.

|[[oracle-property-log-mining-batch-size-default]]<<oracle-property-log-mining-batch-size-default, `+log.mining.batch.size.default+`>>
|`20000`
|The starting SCN interval size that the connector uses for reading data from redo/archive logs.
This also servers as a measure for adjusting batch size - when the difference between current SCN and beginning/end SCN of the batch is bigger than this value, batch size is increased/decreased.

|[[oracle-property-log-mining-sleep-time-min-ms]]<<oracle-property-log-mining-sleep-time-min-ms, `+log.mining.sleep.time.min.ms+`>>
|`0`
|The minimum amount of time that the connector sleeps after reading data from redo/archive logs and before starting reading data again. Value is in milliseconds.

|[[oracle-property-log-mining-sleep-time-max-ms]]<<oracle-property-log-mining-sleep-time-max-ms, `+log.mining.sleep.time.max.ms+`>>
|`3000`
|The maximum amount of time that the connector ill sleeps after reading data from redo/archive logs and before starting reading data again. Value is in milliseconds.

|[[oracle-property-log-mining-sleep-time-default-ms]]<<oracle-property-log-mining-sleep-time-default-ms, `+log.mining.sleep.time.default.ms+`>>
|`1000`
|The starting amount of time that the connector sleeps after reading data from redo/archive logs and before starting reading data again. Value is in milliseconds.

|[[oracle-property-log-mining-sleep-time-increment-ms]]<<oracle-property-log-mining-sleep-time-increment-ms, `+log.mining.sleep.time.increment.ms+`>>
|`200`
|The maximum amount of time up or down that the connector uses to tune the optimal sleep time when reading data from logminer. Value is in milliseconds.

|[[oracle-property-archive-log-hours]]<<oracle-property-archive-log-hours, `+archive.log.hours+`>>
|`0`
|The number of hours in the past from SYSDATE to mine archive logs.
When the default setting (`0`) is used, the connector mines all archive logs.

|[[oracle-property-log-mining-archive-log-only-mode]]<<oracle-property-log-mining-archive-log-only-mode, `+log.mining.archive.log.only.mode+`>>
|`false`
|Controls whether or not the connector mines changes from just archive logs or a combination of the online redo logs and archive logs (the default). +
 +
Redo logs use a circular buffer that can be archived at any point.
In environments where online redo logs are archived frequently, this can lead to LogMiner session failures.
In contrast to redo logs, archive logs are guaranteed to be reliable.
Set this option to `true` to force the connector to mine archive logs only.
After you set the connector to mine only the archive logs, the latency between an operation being committed and the connector emitting an associated change event might increase.
The degree of latency depends on how frequently the database is configured to archive online redo logs.

|[[oracle-property-log-mining-archive-log-only-scn-poll-interval-ms]]<<oracle-property-log-mining-archive-log-only-scn-poll-interval-ms, `+log.mining.archive.log.only.scn.poll.interval.ms+`>>
|`10000`
|The number of milliseconds the connector will sleep in between polling to determine if the starting system change number is in the archive logs.
If `log.mining.archive.log.only.mode` is not enabled, this setting is not used.

|[[oracle-property-log-mining-transaction-retention-ms]]<<oracle-property-log-mining-transaction-retention-ms, `log.mining.transaction.retention.ms`>>
|`0`
|Positive integer value that specifies the number of milliseconds to retain long running transactions between redo log switches.
When set to `0`, transactions are retained until a commit or rollback is detected.

By default, the LogMiner adapter maintains an in-memory buffer of all running transactions.
Because all of the DML operations that are part of a transaction are buffered until a commit or rollback is detected,
long-running transactions should be avoided in order to not overflow that buffer.
Any transaction that exceeds this configured value is discarded entirely, and the connector does not emit any messages for the operations that were part of the transaction.

|[[oracle-property-archive-destination-name]]<<oracle-property-archive-destination-name, `+archive.destination.name+`>>
|No default
|Specifies the configured Oracle archive destination to use when mining archive logs with LogMiner. +
 +
The default behavior automatically selects the first valid, local configured destination.
However, you can use a specific destination can be used by providing the destination name, for example, `LOG_ARCHIVE_DEST_5`.

|[[oracle-property-log-mining-username-include-list]]<<oracle-property-log-mining-username-include-list, `+log.mining.username.include.list+`>>
|No default
|List of database users to include from the LogMiner query.
It can be useful to set this property if you want the capturing process to include changes from the specified users.

|[[oracle-property-log-mining-username-exclude-list]]<<oracle-property-log-mining-username-exclude-list, `+log.mining.username.exclude.list+`>>
|No default
|List of database users to exclude from the LogMiner query.
It can be useful to set this property if you want the capturing process to always exclude the changes that specific users make.

|[[oracle-property-log-mining-scn-gap-detection-gap-size-min]]<<oracle-property-log-mining-scn-gap-detection-gap-size-min, `+log.mining.scn.gap.detection.gap.size.min+`>>
|`1000000`
|Specifies a value that the connector compares to the difference between the current and previous SCN values to determine whether an SCN gap exists.
If the difference between the SCN values is greater than the specified value, and the time difference is smaller than xref:oracle-property-log-mining-scn-gap-detection-time-interval-max-ms[`log.mining.scn.gap.detection.time.interval.max.ms`] then an SCN gap is detected, and the connector uses a mining window larger than the configured maximum batch.

|[[oracle-property-log-mining-scn-gap-detection-time-interval-max-ms]]<<oracle-property-log-mining-scn-gap-detection-time-interval-max-ms, `+log.mining.scn.gap.detection.time.interval.max.ms+`>>
|`20000`
|Specifies a value,  in milliseconds, that the connector compares to the difference between the current and previous SCN timestamps  to determine whether an SCN gap exists.
If the difference between the timestamps is less than the specified value, and the SCN delta is greater than xref:oracle-property-log-mining-scn-gap-detection-gap-size-min[`log.mining.scn.gap.detection.gap.size.min`], then an SCN gap is detected and the connector uses a mining window larger than the configured maximum batch.

|[[oracle-property-log-mining-flush-table-name]]<<oracle-property-log-mining-flush-table-name, `+log.mining.flush.table.name+`>>
|`LOG_MINING_FLUSH`
|Specifies the name of the flush table that coordinates flushing the Oracle LogWriter Buffer (LGWR) to the redo logs.
This name can be specified using the format `_<schemaName>_._<tableName>_` or `_<tableName>_`.
Typically, multiple connectors can use the same flush table.
However, if connectors encounter table lock contention errors, use this property to specify a dedicated table for each connector deployment.

|[[oracle-property-log-mining-include-redo-sql]]<<oracle-property-log-mining-include-redo-sql, `+log.mining.include.redo.sql+`>>
|`false`
|Specifies whether the redo log constructed SQL statement is included in `source.redo_sql` field.
ifdef::community[]
This configuration is ignored when using XStream or OpenLogReplicator adapters.
endif::community[]

|[[oracle-property-lob-enabled]]<<oracle-property-lob-enabled, `+lob.enabled+`>>
|`false`
|Controls whether or not large object (CLOB or BLOB) column values are emitted in change events. +
 +
By default, change events have large object columns, but the columns contain no values.
There is a certain amount of overhead in processing and managing large object column types and payloads.
To capture large object values and serialized them in change events, set this option to `true`.

ifdef::product[]
NOTE: Use of large object data types is a Technology Preview feature.
endif::product[]

|[[oracle-property-unavailable-value-placeholder]]<<oracle-property-unavailable-value-placeholder, `+unavailable.value.placeholder+`>>
|`__debezium_unavailable_value`
|Specifies the constant that the connector provides to indicate that the original value is unchanged and not provided by the database.

|[[oracle-property-rac-nodes]]<<oracle-property-rac-nodes, `+rac.nodes+`>>
|No default
|A comma-separated list of Oracle Real Application Clusters (RAC) node host names or addresses.
This field is required to enable compatibility with an Oracle RAC deployment.

Specify the list of RAC nodes by using one of the following methods:

* Specify a value for xref:oracle-property-database-port[`database.port`], and use the specified port value for each address in the `rac.nodes` list.
For example:
+
[source,properties]
----
database.port=1521
rac.nodes=192.168.1.100,192.168.1.101
----

* Specify a value for xref:oracle-property-database-port[`database.port`], and override the default port for one or more entries in the list.
The list can include entries that use the default `database.port` value, and entries that define their own unique port values.
For example:
+
[source,properties]
----
database.port=1521
rac.nodes=192.168.1.100,192.168.1.101:1522
----

If you supply a raw JDBC URL for the database by using the xref:oracle-property-database-url[`database.url`] property, instead of defining a value for `database.port`, each RAC node entry must explicitly specify a port value.


|[[oracle-property-skipped-operations]]<<oracle-property-skipped-operations, `+skipped.operations+`>>
|`t`
|A comma-separated list of the operation types that you want the connector to skip during streaming.
You can configure the connector to skip the following types of operations:

* `c` (insert/create)
* `u` (update)
* `d` (delete)
* `t` (truncate)

By default, only truncate operations are skipped.

|[[oracle-property-signal-data-collection]]<<oracle-property-signal-data-collection,`+signal.data.collection+`>>
|No default value
a|Fully-qualified name of the data collection that is used to send {link-prefix}:{link-signalling}#debezium-signaling-enabling-source-signaling-channel[signals] to the connector.
When you use this property with an Oracle pluggable database (PDB), set its value to the name of the root database. +
Use the following format to specify the collection name: +
`_<databaseName>_._<schemaName>_._<tableName>_`

|[[oracle-property-signal-enabled-channels]]<<oracle-property-signal-enabled-channels, `+signal.enabled.channels+`>>
|source
| List of the signaling channel names that are enabled for the connector.
By default, the following channels are available:

* `source`
* `kafka`
* `file`
* `jmx`
ifdef::community[]
Optionally, you can also implement a {link-prefix}:{link-signalling}#debezium-signaling-enabling-custom-signaling-channel[custom signaling channel].
endif::community[]
|[[oracle-property-notification-enabled-channels]]<<oracle-property-notification-enabled-channels, `+notification.enabled.channels+`>>
|No default
| List of notification channel names that are enabled for the connector.
By default, the following channels are available:

* `sink`
* `log`
* `jmx`
ifdef::community[]
Optionally, you can also implement a {link-prefix}:{link-notification}#debezium-notification-custom-channel[custom notification channel].
endif::community[]
|[[oracle-property-incremental-snapshot-chunk-size]]<<oracle-property-incremental-snapshot-chunk-size, `+incremental.snapshot.chunk.size+`>>
|`1024`
|The maximum number of rows that the connector fetches and reads into memory during an incremental snapshot chunk.
Increasing the chunk size provides greater efficiency, because the snapshot runs fewer snapshot queries of a greater size.
However, larger chunk sizes also require more memory to buffer the snapshot data.
Adjust the chunk size to a value that provides the best performance in your environment.

|[[oracle-property-incremental-snapshot-watermarking-strategy]]<<oracle-property-incremental-snapshot-watermarking-strategy, `+incremental.snapshot.watermarking.strategy+`>>
|`insert_insert`
|Specifies the watermarking mechanism that the connector uses during an incremental snapshot to deduplicate events that might be captured by an incremental snapshot and then recaptured after streaming resumes. +
You can specify one of the following options:

`insert_insert`:: When you send a signal to initiate an incremental snapshot, for every chunk that {prodname} reads during the snapshot, it writes an entry to the signaling data collection to record the signal to open the snapshot window.
After the snapshot completes, {prodname} inserts a second entry that records the signal to close the window.
`insert_delete`:: When you send a signal to initiate an incremental snapshot, for every chunk that {prodname} reads, it writes a single entry to the signaling data collection to record the signal to open the snapshot window.
After the snapshot completes, this entry is removed.
No entry is created for the signal to close the snapshot window.
Set this option to prevent rapid growth of the signaling data collection.

|[[oracle-property-topic-naming-strategy]]<<oracle-property-topic-naming-strategy, `topic.naming.strategy`>>
|`io.debezium.schema.SchemaTopicNamingStrategy`
|The name of the TopicNamingStrategy class that should be used to determine the topic name for data change, schema change, transaction, heartbeat event etc., defaults to `SchemaTopicNamingStrategy`.

|[[oracle-property-topic-delimiter]]<<oracle-property-topic-delimiter, `topic.delimiter`>>
|`.`
|Specify the delimiter for topic name, defaults to `.`.

|[[oracle-property-topic-cache-size]]<<oracle-property-topic-cache-size, `topic.cache.size`>>
|`10000`
|The size used for holding the topic names in bounded concurrent hash map. This cache will help to determine the topic name corresponding to a given data collection.

|[[oracle-property-topic-heartbeat-prefix]]<<oracle-property-topic-heartbeat-prefix, `+topic.heartbeat.prefix+`>>
|`__debezium-heartbeat`
|Controls the name of the topic to which the connector sends heartbeat messages. The topic name has this pattern: +
 +
_topic.heartbeat.prefix_._topic.prefix_ +
 +
For example, if the topic prefix is `fulfillment`, the default topic name is `__debezium-heartbeat.fulfillment`.

|[[oracle-property-topic-transaction]]<<oracle-property-topic-transaction, `topic.transaction`>>
|`transaction`
|Controls the name of the topic to which the connector sends transaction metadata messages. The topic name has this pattern: +
 +
_topic.prefix_._topic.transaction_ +
 +
For example, if the topic prefix is `fulfillment`, the default topic name is `fulfillment.transaction`.

|[[oracle-property-snapshot-max-threads]]<<oracle-property-snapshot-max-threads, `snapshot.max.threads`>>
|`1`
|Specifies the number of threads that the connector uses when performing an initial snapshot.
To enable parallel initial snapshots, set the property to a value greater than 1.
In a parallel initial snapshot, the connector processes multiple tables concurrently.
ifdef::community[]
This feature is incubating.
endif::community[]
ifdef::product[]
[IMPORTANT]
====
Parallel initial snapshots is a Technology Preview feature only.
Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete.
Red Hat does not recommend using them in production.
These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
For more information about the support scope of Red Hat Technology Preview features, see link:https://access.redhat.com/support/offerings/techpreview/[Technology Preview Features Support Scope].
====
endif::product[]

|[[oracle-property-snapshot-database-errors-max-retries]]<<oracle-property-snapshot-database-errors-max-retries, `snapshot.database.errors.max.retries`>>
|`0`
|Specifies the number of retry attempts to snapshot a table when a database error occurs.
This configuration property currently only retries failures related to `ORA-01466` exceptions.
By default, no additional retries will be performed.

|[[oracle-property-custom-metric-tags]]<<oracle-property-custom-metric-tags, `custom.metric.tags`>>
|`No default`
|Defines tags that customize MBean object names by adding metadata that provides contextual information.
Specify a comma-separated list of key-value pairs.
Each key represents a tag for the MBean object name, and the corresponding value represents a value for the key, for example,  +
`k1=v1,k2=v2`

The connector appends the specified tags to the base MBean object name.
Tags can help you to organize and categorize metrics data.
You can define tags to identify particular application instances, environments, regions, versions, and so forth.
For more information, see xref:customized-mbean-names[Customized MBean names].

|[[oracle-property-errors-max-retires]]<<oracle-property-errors-max-retires, `errors.max.retries`>>
|`-1`
|Specifies how the connector responds after an operation that results in a retriable error, such as a connection error. +
Set one of the following options:

`-1`:: No limit. The connector always restarts automatically, and retries the operation, regardless of the number of previous failures.

`0`:: Disabled. The connector fails immediately, and never retries the operation.
User intervention is required to restart the connector.

`> 0`:: The connector restarts automatically until it reaches the specified maximum number of retries.
After the next failure, the connector stops, and user intervention is required to restart it.

|[[oracle-property-database-query-timeout-ms]]<<oracle-property-database-query-timeout-ms, `database.query.timeout.ms`>>
|`600000`
|Time to wait for a query to execute, given in milliseconds. Defaults to 600 seconds (600,000 ms); zero means there is no limit.
|===

[id="debezium-oracle-connector-database-history-configuration-properties"]
==== {prodname} Oracle connector database schema history configuration properties
include::{partialsdir}/modules/all-connectors/ref-connector-configuration-database-history-properties.adoc[leveloffset=+1]

[id="debezium-oracle-connector-pass-through-properties"]
==== Pass-through Oracle connector configuration properties

The connector supports _pass-through_ properties that enable {prodname} to specify custom configuration options for fine-tuning the behavior of the Apache Kafka producer and consumer.
For information about the full range of configuration properties for Kafka producers and consumers, see the {link-kafka-docs}/#configuration[Kafka documentation].

[id="debezium-oracle-pass-through-database-history-properties-for-configuring-producer-and-consumer-clients"]
===== Pass-through properties for configuring how producer and consumer clients interact with schema history topics

include::{partialsdir}/modules/all-connectors/ref-connector-pass-through-database-history-properties-for-configuring-producer-and-consumer-clients.adoc[leveloffset=+1]


[id="debezium-oracle-connector-pass-through-kafka-signals-configuration-properties"]
===== Pass-through properties for configuring how the Oracle connector interacts with the Kafka signaling topic

include::{partialsdir}/modules/all-connectors/ref-connector-pass-through-kafka-signals-configuration-properties.adoc[leveloffset=+1]


[id="debezium-oracle-connector-pass-through-signals-kafka-consumer-client-configuration-properties"]
===== Pass-through properties for configuring the Kafka consumer client for the signaling channel

include::{partialsdir}/modules/all-connectors/ref-connector-pass-through-signals-kafka-consumer-client-configuration-properties.adoc[leveloffset=+1]


[id="debezium-oracle-connector-pass-through-kafka-sink-notification-configuration-properties"]
===== Pass-through properties for configuring the Oracle connector sink notification channel

include::{partialsdir}/modules/all-connectors/ref-connector-pass-through-kafka-sink-notification-configuration-properties.adoc[leveloffset=+1]


[id="debezium-oracle-connector-pass-through-database-driver-configuration-properties"]
===== {prodname} connector pass-through database driver configuration properties

include::{partialsdir}/modules/all-connectors/ref-connector-pass-through-database-driver-configuration-properties.adoc[leveloffset=+1]



// Type: assembly
// ModuleID: monitoring-debezium-oracle-connector-performance
// Title: Monitoring {prodname} Oracle connector performance
[[oracle-monitoring]]
== Monitoring

The {prodname} Oracle connector provides three metric types in addition to the built-in support for JMX metrics that Apache Zookeeper, Apache Kafka, and Kafka Connect have.

* xref:oracle-snapshot-metrics[snapshot metrics]; for monitoring the connector when performing snapshots
* xref:oracle-streaming-metrics[streaming metrics]; for monitoring the connector when processing change events
* xref:oracle-schema-history-metrics[schema history metrics]; for monitoring the status of the connector's schema history

Please refer to the {link-prefix}:{link-debezium-monitoring}#monitoring-debezium[monitoring documentation] for details of how to expose these metrics via JMX.

// Type: concept
// ModuleID: monitoring-debezium-oracle-connectors-customized-mbean-names
// Title: Customized names for Oracle connector snapshot and streaming MBean objects
=== Customized MBean names

include::{partialsdir}/modules/all-connectors/frag-common-mbean-name.adoc[leveloffset=+1,tags=mbeans-shared]

// Type: reference
// ModuleID: debezium-oracle-connector-snapshot-metrics
// Title: {prodname} Oracle connector snapshot metrics
[[oracle-snapshot-metrics]]
=== Snapshot Metrics

[[oracle-monitoring-snapshots]]

include::{partialsdir}/modules/all-connectors/frag-common-mbean-name.adoc[leveloffset=+1,tags=common-snapshot]

include::{partialsdir}/modules/all-connectors/ref-connector-monitoring-snapshot-metrics.adoc[leveloffset=+1]

include::{partialsdir}/modules/all-connectors/ref-connector-monitoring-incremental-snapshot-metrics.adoc[leveloffset=+1]

// Type: reference
// ModuleID: debezium-oracle-connector-streaming-metrics
// Title: {prodname} Oracle connector streaming metrics
[[oracle-streaming-metrics]]
=== Streaming Metrics

[[oracle-monitoring-streaming]]
include::{partialsdir}/modules/all-connectors/frag-common-mbean-name.adoc[leveloffset=+1,tags=common-streaming]

include::{partialsdir}/modules/all-connectors/ref-connector-monitoring-streaming-metrics.adoc[leveloffset=+1]

The {prodname} Oracle connector also provides the following additional streaming metrics:

.Descriptions of additional streaming metrics
[cols="45%a,25%a,30%a"]
|===
|Attributes |Type |Description

|[[oracle-streaming-metrics-currentscn]]<<oracle-streaming-metrics-currentscn, `+CurrentScn+`>>
|`BigInteger`
|The most recent system change number that has been processed.

|[[oracle-streaming-metrics-oldest-scn]]<<oracle-streaming-metrics-oldest-scn, `+OldestScn+`>>
|`BigInteger`
|The oldest system change number in the transaction buffer.

|[[oracle-streaming-metrics-oldest-scn-age-in-milliseconds]]<<oracle-streaming-metrics-oldest-scn-age-in-milliseconds, `+OldestScnAgeInMilliseconds+`>>
|`long`
|The oldest system change number's age in milliseconds.
If the buffer is empty, the value will be `0`.

|[[oracle-streaming-metrics-committed-scn]]<<oracle-streaming-metrics-committed-scn, `+CommittedScn+`>>
|`BigInteger`
|The last committed system change number from the transaction buffer.

|[[oracle-streaming-metrics-offset-scn]]<<oracle-streaming-metrics-offset-scn, `+OffsetScn+`>>
|`BigInteger`
|The system change number currently written to the connector's offsets.

|[[oracle-streaming-metrics-currentredologfilename]]<<oracle-streaming-metrics-currentredologfilename, `+CurrentRedoLogFileName+`>>
|`string[]`
|Array of the log files that are currently mined.

|[[oracle-streaming-metrics-minimumminedlogcount]]<<oracle-streaming-metrics-minimumminedlogcount, `+MinimumMinedLogCount+`>>
|`long`
|The minimum number of logs specified for any LogMiner session.

|[[oracle-streaming-metrics-maximumminedlogcount]]<<oracle-streaming-metrics-maximumminedlogcount, `+MaximumMinedLogCount+`>>
|`long`
|The maximum number of logs specified for any LogMiner session.

|[[oracle-streaming-metrics-redologstatus]]<<oracle-streaming-metrics-redologstatus, `+RedoLogStatus+`>>
|`string[]`
|Array of the current state for each mined logfile with the format `_filename_\|_status_`.

|[[oracle-streaming-metrics-switchcounter]]<<oracle-streaming-metrics-switchcounter, `+SwitchCounter+`>>
|`int`
|The number of times the database has performed a log switch for the last day.

|[[oracle-streaming-metrics-lastcaptureddmlcount]]<<oracle-streaming-metrics-lastcaptureddmlcount, `+LastCapturedDmlCount+`>>
|`long`
|The number of DML operations observed in the last LogMiner session query.

|[[oracle-streaming-metrics-maxcaptureddmlinbatch]]<<oracle-streaming-metrics-maxcaptureddmlinbatch, `+MaxCapturedDmlInBatch+`>>
|`long`
|The maximum number of DML operations observed while processing a single LogMiner session query.

|[[oracle-streaming-metrics-totalcaptureddmlcount]]<<oracle-streaming-metrics-totalcaptureddmlcount, `+TotalCapturedDmlCount+`>>
|`long`
|The total number of DML operations observed.

|[[oracle-streaming-metrics-fetchingquerycount]]<<oracle-streaming-metrics-fetchingquerycount, `+FetchingQueryCount+`>>
|`long`
|The total number of LogMiner session query (aka batches) performed.

|[[oracle-streaming-metrics-lastdurationoffetchqueryinmilliseconds]]<<oracle-streaming-metrics-lastdurationoffetchqueryinmilliseconds, `+LastDurationOfFetchQueryInMilliseconds+`>>
|`long`
|The duration of the last LogMiner session query's fetch in milliseconds.

|[[oracle-streaming-metrics-maxdurationoffetchqueryinmilliseconds]]<<oracle-streaming-metrics-maxdurationoffetchqueryinmilliseconds, `+MaxDurationOfFetchQueryInMilliseconds+`>>
|`long`
|The maximum duration of any LogMiner session query's fetch in milliseconds.

|[[oracle-streaming-metrics-lastbatchprocessingtimeinmilliseconds]]<<oracle-streaming-metrics-lastbatchprocessingtimeinmilliseconds, `+LastBatchProcessingTimeInMilliseconds+`>>
|`long`
|The duration for processing the last LogMiner query batch results in milliseconds.

|[[oracle-streaming-metrics-totalparsetimeinmilliseconds]]<<oracle-streaming-metrics-totalparsetimeinmilliseconds, `+TotalParseTimeInMilliseconds+`>>
|`long`
|The time in milliseconds spent parsing DML event SQL statements.

|[[oracle-streaming-metrics-lastminingsessionstarttimeinmilliseconds]]<<oracle-streaming-metrics-lastminingsessionstarttimeinmilliseconds, `+LastMiningSessionStartTimeInMilliseconds+`>>
|`long`
|The duration in milliseconds to start the last LogMiner session.

|[[oracle-streaming-metrics-maxminingsessionstarttimeinmilliseconds]]<<oracle-streaming-metrics-maxminingsessionstarttimeinmilliseconds, `+MaxMiningSessionStartTimeInMilliseconds+`>>
|`long`
|The longest duration in milliseconds to start a LogMiner session.

|[[oracle-streaming-metrics-totalminingsessionstarttimeinmilliseconds]]<<oracle-streaming-metrics-totalminingsessionstarttimeinmilliseconds, `+TotalMiningSessionStartTimeInMilliseconds+`>>
|`long`
|The total duration in milliseconds spent by the connector starting LogMiner sessions.

|[[oracle-streaming-metrics-minbatchprocessingtimeinmilliseconds]]<<oracle-streaming-metrics-minbatchprocessingtimeinmilliseconds, `+MinBatchProcessingTimeInMilliseconds+`>>
|`long`
|The minimum duration in milliseconds spent processing results from a single LogMiner session.

|[[oracle-streaming-metrics-maxbatchprocessingtimeinmilliseconds]]<<oracle-streaming-metrics-maxbatchprocessingtimeinmilliseconds, `+MaxBatchProcessingTimeInMilliseconds+`>>
|`long`
|The maximum duration in milliseconds spent processing results from a single LogMiner session.

|[[oracle-streaming-metrics-totalprocessingtimeinmilliseconds]]<<oracle-streaming-metrics-totalprocessingtimeinmilliseconds, `+TotalProcessingTimeInMilliseconds+`>>
|`long`
|The total duration in milliseconds spent processing results from LogMiner sessions.

|[[oracle-streaming-metrics-totalresultsetnexttimeinmilliseconds]]<<oracle-streaming-metrics-totalresultsetnexttimeinmilliseconds, `+TotalResultSetNextTimeInMilliseconds+`>>
|`long`
|The total duration in milliseconds spent by the JDBC driver fetching the next row to be processed from the log mining view.

|[[oracle-streaming-metrics-totalprocessedrows]]<<oracle-streaming-metrics-totalprocessedrows, `+TotalProcessedRows+`>>
|`long`
|The total number of rows processed from the log mining view across all sessions.

|[[oracle-streaming-metrics-batchsize]]<<oracle-streaming-metrics-batchsize, `+BatchSize+`>>
|`int`
|The number of entries fetched by the log mining query per database round-trip.

|[[oracle-streaming-metrics-millisecondtosleepbetweenminingquery]]<<oracle-streaming-metrics-millisecondtosleepbetweenminingquery, `+MillisecondToSleepBetweenMiningQuery+`>>
|`long`
|The number of milliseconds the connector sleeps before fetching another batch of results from the log mining view.

|[[oracle-streaming-metrics-maxbatchprocessingthroughput]]<<oracle-streaming-metrics-maxbatchprocessingthroughput, `+MaxBatchProcessingThroughput+`>>
|`long`
|The maximum number of rows/second processed from the log mining view.

|[[oracle-streaming-metrics-averagebatchprocessingthroughput]]<<oracle-streaming-metrics-averagebatchprocessingthroughput, `+AverageBatchProcessingThroughput+`>>
|`long`
|The average number of rows/second processed from the log mining.

|[[oracle-streaming-metrics-lastbatchprocessingthroughput]]<<oracle-streaming-metrics-lastbatchprocessingthroughput, `+LastBatchProcessingThroughput+`>>
|`long`
|The average number of rows/second processed from the log mining view for the last batch.

|[[oracle-streaming-metrics-networkconnectionproblemscounter]]<<oracle-streaming-metrics-networkconnectionproblemscounter, `+NetworkConnectionProblemsCounter+`>>
|`long`
|The number of connection problems detected.

|[[oracle-streaming-metrics-hourstokeeptransactioninbuffer]]<<oracle-streaming-metrics-hourstokeeptransactioninbuffer, `+HoursToKeepTransactionInBuffer+`>>
|`int`
|The number of hours that transactions are retained by the connector's in-memory buffer without being committed or rolled back before being discarded.
For more information, see xref:oracle-property-log-mining-transaction-retention-ms[`log.mining.transaction.retention.ms`].

|[[oracle-streaming-metrics-number-of-active-transactions]]<<oracle-streaming-metrics-number-of-active-transactions, `+NumberOfActiveTransactions+`>>
|`long`
|The number of current active transactions in the transaction buffer.

|[[oracle-streaming-metrics-number-of-committed-transactions]]<<oracle-streaming-metrics-number-of-committed-transactions, `+NumberOfCommittedTransactions+`>>
|`long`
|The number of committed transactions in the transaction buffer.
ifdef::community[]
|[[oracle-streaming-metrics-number-of-oversized-transactions]]<<oracle-streaming-metrics-number-of-oversized-transactions, `+NumberOfOversizedTransactions+`>>
|`long`
|The number of transactions that were discarded because their size exceeded <<oracle-property-log-mining-buffer-transaction-events-threshold, `log.mining.buffer.transaction.events.threshold`>>.
endif::community[]
|[[oracle-streaming-metrics-number-of-rolledback-transactions]]<<oracle-streaming-metrics-number-of-rolledback-transactions, `+NumberOfRolledBackTransactions+`>>
|`long`
|The number of rolled back transactions in the transaction buffer.

|[[oracle-straeming-metrics-number-of-partial-rollback-count]]<<oracle-streaming-metrics-number-of-partial-rollback-count, `+NumberOfPartialRollbackCount+`>>
|`long`
|The number of events rolled back in a committed transaction, which implies constraint violations in most use cases.

|[[oracle-streaming-metrics-commit-throughput]]<<oracle-streaming-metrics-commit-throughput, `+CommitThroughput+`>>
|`long`
|The average number of committed transactions per second in the transaction buffer.

|[[oracle-streaming-metrics-registered-dml-count]]<<oracle-streaming-metrics-registered-dml-count, `+RegisteredDmlCount+`>>
|`long`
|The number of registered DML operations in the transaction buffer.

|[[oracle-streaming-metrics-lag-from-source-in-milliseconds]]<<oracle-streaming-metrics-lag-from-source-in-milliseconds, `+LagFromSourceInMilliseconds+`>>
|`long`
|The time difference in milliseconds between when a change occurred in the transaction logs and when its added to the transaction buffer.

|[[oracle-streaming-metrics-max-lag-from-source-in-milliseconds]]<<oracle-streaming-metrics-max-lag-from-source-in-milliseconds, `+MaxLagFromSourceInMilliseconds+`>>
|`long`
|The maximum time difference in milliseconds between when a change occurred in the transaction logs and when its added to the transaction buffer.

|[[oracle-streaming-metrics-min-lag-from-source-in-milliseconds]]<<oracle-streaming-metrics-min-lag-from-source-in-milliseconds, `+MinLagFromSourceInMilliseconds+`>>
|`long`
|The minimum time difference in milliseconds between when a change occurred in the transaction logs and when its added to the transaction buffer.

|[[oracle-streaming-metrics-abandoned-transaction-ids]]<<oracle-streaming-metrics-abandoned-transaction-ids, `+AbandonedTransactionIds+`>>
|`string[]`
|An array of the most recent abandoned transaction identifiers removed from the transaction buffer due to their age.
See <<oracle-property-log-mining-transaction-retention-ms, `log.mining.transaction.retention.ms`>> for details.

|[[oracle-streaming-metrics-abandoned-transaction-count]]<<oracle-streaming-metrics-abandoned-transaction-count, `+AbandonedTransactionCount+`>>
|`long`
|Current number of entries in the xref:oracle-streaming-metrics-abandoned-transaction-ids[abandoned transactions] list.

|[[oracle-streaming-metrics-rolled-back-transaction-ids]]<<oracle-streaming-metrics-rolled-back-transaction-ids, `+RolledBackTransactionIds+`>>
|`string[]`
|An array of the most recent transaction identifiers that have been mined and rolled back in the transaction buffer.

|[[oracle-streaming-metrics-last-commit-duration-in-milliseconds]]<<oracle-streaming-metrics-last-commit-duration-in-milliseconds, `+LastCommitDurationInMilliseconds+`>>
|`long`
|The duration of the last transaction buffer commit operation in milliseconds.

|[[oracle-streaming-metrics-max-commit-duration-in-milliseconds]]<<oracle-streaming-metrics-max-commit-duration-in-milliseconds, `+MaxCommitDurationInMilliseconds+`>>
|`long`
|The duration of the longest transaction buffer commit operation in milliseconds.

|[[oracle-streaming-metrics-error-count]]<<oracle-streaming-metrics-error-count, `+ErrorCount+`>>
|`int`
|The number of errors detected.

|[[oracle-streaming-metrics-warning-count]]<<oracle-streaming-metrics-warning-count, `+WarningCount+`>>
|`int`
|The number of warnings detected.

|[[oracle-streaming-metrics-scn-freeze-count]]<<oracle-streaming-metrics-scn-freeze-count, `+ScnFreezeCount+`>>
|`int`
|The number of times that the system change number was checked for advancement and remains unchanged.
A high value can indicate that a long-running transactions is ongoing and is preventing the connector from flushing the most recently processed system change number to the connector's offsets.
When conditions are optimal, the value should be close to or equal to `0`.

|[[oracle-streaming-metrics-unparsable-ddl-count]]<<oracle-streaming-metrics-unparsable-ddl-count, `+UnparsableDdlCount+`>>
|`int`
|The number of DDL records that have been detected but could not be parsed by the DDL parser.
This should always be `0`; however when allowing unparsable DDL to be skipped, this metric can be used to determine if any warnings have been written to the connector logs.

|[[oracle-streaming-metrics-mining-session-user-global-area-memory-in-bytes]]<<oracle-streaming-metrics-mining-session-user-global-area-memory-in-bytes, `+MiningSessionUserGlobalAreaMemoryInBytes+`>>
|`long`
|The current mining session's user global area (UGA) memory consumption in bytes.

|[[oracle-streaming-metrics-mining-session-user-global-area-max-memory-in-bytes]]<<oracle-streaming-metrics-mining-session-user-global-area-max-memory-in-bytes, `+MiningSessionUserGlobalAreaMaxMemoryInBytes+`>>
|`long`
|The maximum mining session's user global area (UGA) memory consumption in bytes across all mining sessions.

|[[oracle-streaming-metrics-mining-session-process-global-area-memory-in-bytes]]<<oracle-streaming-metrics-mining-session-process-global-area-memory-in-bytes, `+MiningSessionProcessGlobalAreaMemoryInBytes+`>>
|`long`
|The current mining session's process global area (PGA) memory consumption in bytes.

|[[oracle-streaming-metrics-mining-session-process-global-area-max-memory-in-bytes]]<<oracle-streaming-metrics-mining-session-process-global-area-max-memory-in-bytes, `+MiningSessionProcessGlobalAreaMaxMemoryInBytes+`>>
|`long`
|The maximum mining session's process global area (PGA) memory consumption in bytes across all mining sessions.

|===

// Type: reference
// ModuleID: debezium-oracle-connector-schema-history-metrics
// Title: {prodname} Oracle connector schema history metrics
[[oracle-schema-history-metrics]]
=== Schema History Metrics

[[oracle-monitoring-schema-history]]

include::{partialsdir}/modules/all-connectors/ref-connector-monitoring-schema-history-metrics.adoc[leveloffset=+1]

ifdef::community[]
[[surrogate-schema-evolution]]
== Surrogate schema evolution

The Oracle connector automatically tracks and applies table schema changes by parsing DDL from the redo logs.
If the DDL parser encounters an incompatible statement, if needed, the connector provides an alternative way to apply the schema change.

By default, the connector stops when it encounters a DDL statement that it cannot parse.
You can use {prodname} link:/documentation/reference/configuration/signalling[signaling] to trigger the update of the database schema from such DDL statements.

The type of the schema update action is `schema-changes`.
This action updates the schema of all tables enumerated in the signal parameters.
The message does not contain the update to the schema.
Instead, it contains the complete new schema structure.

.Action parameters
[cols="3,9",options="header"]
|===
|Name | Description

|`database`
|The name of the Oracle database.

|`schema`
|The name of the schema where changes are applied.

|`changes`
|An array containing the requested schema updates.

|`changes.type`
|Type of the schema change, usually `ALTER`

|`changes.id`
|The fully-qualified name of the table

|`changes.table`
|The fully-qualified name of the table

|`changes.table.defaultCharsetName`
|The character set name used for the table if different from database default

|`changes.table.primaryKeyColumnNames`
|Array with the name of columns composing the primary key

|`changes.table.columns`
|Array with the column metadata

|`...columns.name`
|The name of the column

|`...columns.jdbcType`
|The JDBC type of the column as defined at link:https://docs.oracle.com/javase/8/docs/api/java/sql/Types.html[JDBC API]

|`...columns.typeName`
|The name of the column type

|`...columns.typeExpression`
|The full column type definition

|`...columns.charsetName`
|The column character set if different from the default

|`...columns.length`
|The length/size constraint of the column

|`...columns.scale`
|The scale of numeric column

|`...columns.position`
|The position of the column in the table starting with `1`

|`...columns.optional`
|Boolean `true` if column value is not mandatory

|`...columns.autoIncremented`
|Boolean `true` if column value is automatically calculated from a sequence

|`...columns.generated`
|Boolean `true` if column value is automatically calculated

|===

After the `schema-changes` signal is inserted, the connector must be restarted with an altered configuration that includes specifying the  <<{context}-property-database-history-skip-unparseable-ddl, `+schema.history.internal.skip.unparseable.ddl+`>> option as `true`.
After the connector's commit SCN advances beyond the DDL change, to prevent unparseable DDL statements from being skipped unexpectedly, return the connector configuration to its previous state.

.Example of a logging record
[cols="1,9a",options="header"]
|===
|Column | Value

|id
|`924e3ff8-2245-43ca-ba77-2af9af02fa07`

|type
|`schema-changes`

|data
|[source,json,indent=0,subs="attributes"]
----
{
   "database":"ORCLPDB1",
   "schema":"DEBEZIUM",
   "changes":[
      {
         "type":"ALTER",
         "id":"\"ORCLPDB1\".\"DEBEZIUM\".\"CUSTOMER\"",
         "table":{
            "defaultCharsetName":null,
            "primaryKeyColumnNames":[
               "ID",
               "NAME"
            ],
            "columns":[
               {
                  "name":"ID",
                  "jdbcType":2,
                  "typeName":"NUMBER",
                  "typeExpression":"NUMBER",
                  "charsetName":null,
                  "length":9,
                  "scale":0,
                  "position":1,
                  "optional":false,
                  "autoIncremented":false,
                  "generated":false
               },
               {
                  "name":"NAME",
                  "jdbcType":12,
                  "typeName":"VARCHAR2",
                  "typeExpression":"VARCHAR2",
                  "charsetName":null,
                  "length":1000,
                  "position":2,
                  "optional":true,
                  "autoIncremented":false,
                  "generated":false
               },
               {
                  "name":"SCORE",
                  "jdbcType":2,
                  "typeName":"NUMBER",
                  "typeExpression":"NUMBER",
                  "charsetName":null,
                  "length":6,
                  "scale":2,
                  "position":3,
                  "optional":true,
                  "autoIncremented":false,
                  "generated":false
               },
               {
                  "name":"REGISTERED",
                  "jdbcType":93,
                  "typeName":"TIMESTAMP(6)",
                  "typeExpression":"TIMESTAMP(6)",
                  "charsetName":null,
                  "length":6,
                  "position":4,
                  "optional":true,
                  "autoIncremented":false,
                  "generated":false
               }
            ]
         }
      }
   ]
}
----

|===

[[oracle-openlogreplicator-support]]
== OpenLogReplicator support

[NOTE]
====
The OpenLogReplicator ingestion adapter is currently in incubating state, i.e. exact semantics, configuration options etc. may change in future revisions, based on the feedback we receive.
Please let us know if you encounter any problems.
====

The {prodname} Oracle connector by default ingests changes using native Oracle LogMiner.
However, the connector can be toggled to use OpenLogReplicator, an open-source and free third-party application that reads Oracle changes directly from the redo and archive logs with low impact on the database.
To configure the connector to use OpenLogReplicator, you must apply specific database and connector configurations that differ from those that you use with LogMiner.

.Prerequisites

* Download and compile OpenLogReplicator for your database environment.
* OpenLogReplicator must be installed with direct access to the archive and redo log files. This does not necessarily require installation on the physical database server if the archive and redo logs can be accessed via some shared filesystem.

=== How OpenLogReplicator works

OpenLogReplicator takes on the role of Oracle LogMiner and Oracle XStream when the {prodname} Oracle connector streams changes.
It is responsible for the capturing of changes in the redo and archive logs as they occur and batching those changes into logical transactions.
{prodname} Oracle connector is a consumer of OpenLogReplicator by connecting to the network endpoint provided by OpenLogReplicator and ingesting the transactions as they're batched.

After the OpenLogReplicator adapter ingests changes, the {prodname} Oracle connector transforms the events into xref:#oracle-events[data change events] just like any other adapter.

From a network topology perspective, the {prodname} Oracle connector relies on network connections to both the Oracle database and to the OpenLogReplicator.
Similarly, OpenLogReplicator requires a network connection to the Oracle database, as well as direct access to the raw redo and archive logs.

=== Preparing the database

The Oracle database must be configured to generate specific files, called archive logs.
An archive log is a saved copy of a full online redo log.
The database must be placed in `ARCHIVELOG` mode before it can archive redo log files.
To place the database in `ARCHIVELOG` mode, you must set specific configuration properties to specify the destination for saving the archive log files.

The following example shows a command for placing a database into archive log mode:

.Configuration needed for OpenLogReplicator
====
[source,indent=0]
----
ORACLE_SID=ORCLCDB dbz_oracle sqlplus /nolog

CONNECT sys/top_secret AS SYSDBA
alter system set db_recovery_file_dest_size = 5G;
alter system set db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' scope=spfile;
shutdown immediate
startup mount
alter database archivelog;
alter database open;
-- Should show "Database log mode: Archive Mode"
archive log list

exit;
----
====

For {prodname} to generate change events that show the `before` and `after` states of a table row, supplemental logging must be active on the database.
Supplemental logging adds column data to the redo logs to identify the rows that are affected when a table is modified.

You can use different methods to configure supplemental logging.
To support {prodname}, you must enable at least minimal database-level supplemental logging.
Minimal supplemental logging writes the least amount of information needed to be able to create change events.
The following example shows a command that you might use to enable minimal supplemental logging.

.Configure database-level supplemental logging
====
[source,sql,indent=0]
----
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA
----
====

[NOTE]
====
{prodname} for Oracle can work with a higher degree of supplemental logging at the database level, if that is already configured for other purposes.
But if you do not require higher fidelity logging to support other applications, you can reduce database-level logging to the minimum level.
====

For each captured table, you must explicitly configure a higher fidelity supplemental logging, called `(ALL) COLUMNS`.
The `(ALL) COLUMNS` logging level guarantees that Oracle captures the state of a column regardless of whether the column changed when a redo entry is written to the redo log.
Enabling the higher logging level enables {prodname} for Oracle to generate change events that provide the accurate _before_ and _after_ states for a row.

The following example shows a command for enabling supplemental logging for each captured table.

.Configure captured table supplemental logging
====
[source,sql,indent=0]
----
ALTER TABLE inventory.customers ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS
----
====

[IMPORTANT]
====
Whenever new tables are added to the {prodname} Oracle's connector configuration, you must configure supplemental logging for each table.
If a table that is configured for capture is not correctly configured for supplemental logging, after the connector begins streaming, it returns a warning message.
====

=== Creating connector users

The {prodname} Oracle connector requires a user account to be set up with specific permissions so that the connector can capture change events.
This user account will be used by both {prodname} and OpenLogReplicator.
The following example shows a possible user account configuration for deploying {prodname} with OpenLogReplicator in a multi-tenant Oracle environment.

[[oracle-create-users-openlogreplicator]]
.Creating OpenLogReplicator user
====
[source,indent=0]
----
# Create Log Miner Tablespace and User
sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF
  CREATE TABLESPACE LOGMINER_TBS DATAFILE '/opt/oracle/oradata/ORCLCDB/logminer_tbs.dbf' SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
  exit;
EOF

sqlplus sys/top_secret@//localhost:1521/ORCLPDB1 as sysdba <<- EOF
  CREATE TABLESPACE LOGMINER_TBS DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/logminer_tbs.dbf' SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
  exit;
EOF

sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba <<- EOF
  CREATE USER c##dbzuser IDENTIFIED BY dbz DEFAULT TABLESPACE LOGMINER_TBS QUOTA UNLIMITED ON LOGMINER_TBS CONTAINER=ALL;

  -- Debezium specific permissions
  GRANT CREATE SESSION TO c##dbzuser CONTAINER=ALL;
  GRANT SET CONTAINER TO c##dbzuser CONTAINER=ALL;
  GRANT SELECT ON V_\$DATABASE TO c##dbzuser CONTAINER=ALL;
  GRANT SELECT ANY DICTIONARY TO c##dbzuser CONTAINER=ALL;
  GRANT LOCK ANY TABLE TO c##dbzuser CONTAINER=ALL;
  -- These can be reduced from ANY TABLE to your captured tables depending on your security model
  GRANT SELECT ANY TABLE TO c##dbzuser CONTAINER=ALL;
  GRANT FLASHBACK ANY TABLE TO c##dbzuser CONTAINER=ALL;

  -- OpenLogReplicator specific permissions
  ALTER SESSION SET CONTAINER = ORCLPDB1;
  GRANT SELECT, FLASHBACK ON SYS.CCOL$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.CDEF$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.COL$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.DEFERRED_STG$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.ECOL$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.LOB$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.LOBCOMPPART$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.LOBFRAG$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.OBJ$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.TAB$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.TABCOMPART$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.TABPART$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.TABSUBPART$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.TS$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON SYS.USER$ TO c##dbzuser;
  GRANT SELECT, FLASHBACK ON XDB.XDB$TTSET TO c##dbzuser;

  exit;
EOF
----
====

[[selecting-the-open-log-replicator-adapter]]
=== Configuring the OpenLogReplicator adapter

By default, {prodname} uses Oracle LogMiner to ingest change events from Oracle.
You can modify the default settings to configure the connector to use the OpenLogReplicator adapter in place of LogMiner.

In the example that follows, the following properties are added to the connector configuration to enable the connector to use the OpenLogReplicator adapter:

* `database.connection.adapter`
* `openlogreplicator.source`
* `openlogreplicator.host`
* `openlogreplicator.port`

[source,json,indent=0]
----
{
    "name": "inventory-connector",
    "config": {
        "connector.class" : "io.debezium.connector.oracle.OracleConnector",
        "tasks.max" : "1",
        "topic.prefix" : "server1",
        "database.hostname" : "<oracle ip>",
        "database.port" : "1521",
        "database.user" : "c##dbzuser",
        "database.password" : "dbz",
        "database.dbname" : "ORCLCDB",
        "database.pdb.name" : "ORCLPDB1",
        "schema.history.internal.kafka.bootstrap.servers" : "kafka:9092",
        "schema.history.internal.kafka.topic": "schema-changes.inventory",
        "database.connection.adapter": "olr",
        "openlogreplicator.source": "ORACLE",
        "openlogreplicator.host": "<ip address or hostname of OpenLogReplicator>",
        "openlogreplicator.port": "<port OpenLogReplicator is listening on>"
    }
}
----

[id="building-openlogreplicator"]
=== Building OpenLogReplicator

OpenLogReplicator does not distribute binaries, so you must build the third-party tool from code.
OpenLogReplicator is written in C++; however, the author provides a container image to build the source for a variety of operating systems, including RHEL, Fedora, CentOS, Debian, and others.
For information about how to build the tool using a container, see the This https://github.com/bersler/OpenLogReplicator-docker[OpenLogReplicator GitHub repository].

[id="obtaining-oracle-jdbc-driver-openlogreplicator"]
=== Obtaining the Oracle JDBC driver for OpenLogReplicator

When you use the {prodname} Oracle connector with the OpenLogReplicator, you must  obtain the Oracle JDBC driver to connect to Oracle databases.
For more information, see xref:obtaining-the-oracle-jdbc-driver[Obtaining the Oracle JDBC driver].

[[oracle-openlogreplicator-configuration]]
=== OpenLogReplicator configuration

OpenLogReplicator is a third-party standalone process that is responsible for reading the Oracle redo and archive logs.
Unlike other {prodname} Oracle adapters, this means that there are two configurable components that must be configured independently of one another.

You configure OpenLogReplicator by using a JSON file called `scripts/OpenLogReplicator.json`.
For more information about the required format of this file, see the https://github.com/bersler/OpenLogReplicator/blob/master/documentation/reference-manual/reference-manual.adoc#openlogreplicator-json-file-format[OpenLogReplicator documentation].

.OpenLogReplicator configuration
====
[source,json,indent=0]
----
{
  "version": "1.6.0",
  "source": [{
    "alias": "SOURCE",
    "name": "ORACLE", <1>
    "reader": {
      "type": "online",
      "path-mapping": ["/opt/olr/recovery_area", "/opt/olr/recovery_area/ORCLCDB/archivelog"], <2>
      "user": "c##dbzuser", <3>
      "password": "dbz", <4>
      "server": "//<ip>:<port>/ORCLPDB1" <5>
    },
    "format": { <6>
      "type": "json",
      "column": 2,
      "db": 3,
      "interval-dts": 9,
      "interval-ytm": 4,
      "message": 2,
      "rid": 1,
      "schema": 7,
      "scn-all": 1,
      "timestamp-all": 1
    }
  }],
  "target": [{
    "alias": "DEBEZIUM",
    "source": "SOURCE",
    "writer": {
      "type": "network", <7>
      "uri": "<host>:<port>" <8>
    }
  }]
}
----
<1> This should match the `openlogreplicator.source` connector configuration.
<2> List of file path pairs `[before1,after1,befor2,after2,...]` where if a log file path matches one of the `beforeX` prefixes, the prefix is replaced with the `afterX` path.  This is useful when OpenLogReplicator is running on a different host than the source database and the path to the redo and archive logs different between the database and the OpenLogReplicator process.
<3> This should match the `database.user` connector property.
<4> This should match the `database.password` connector property.
<5> This should point to the database host, port, and Oracle SID.
<6> This specifies the payload format ingested by {prodname} Oracle connector. Use these values as specified, as these are the only format options that we require beyond the defaults.
<7> This must specify `network`, as {prodname} Oracle connector communicates with OpenLogReplicator via a network connection.
<8> This specifies the bind host and port that OpenLogReplicator listens for connections on.  This should be accessible by {prodname} Oracle connector.
====

[[oracle-openlogreplicator-connector-properties]]
=== OpenLogReplicator connector properties

The following configuration properties are required when using OpenLogReplicator.

[cols="30%a,25%a,45%a"]
|===
|Property
|Default
|Description

|[[oracle-property-openlogreplicator-source]]<<oracle-property-openlogreplicator-source, `+openlogreplicator.source+`>>
|No default
|The logical name of the configured `source.name` element in the OpenLogReplicator JSON configuration.

|[[oracle-property-openlogreplicator-host]]<<oracle-property-openlogreplicator-host, `+openlogreplicator.host+`>>
|No default
|The host name or IP address of the OpenLogReplicator network service.

|[[oracle-property-openlogreplicator-port]]<<oracle-property-openlogreplicator-port, `+openlogreplicator.port+`>>
|No default
|The port number that is used by the OpenLogReplicator network service.

|===

[[oracle-openlogreplicator-row-id-support]]
=== OpenLogReplicator ROWID support

OpenLogReplicator does not provide the `ROWID` pseudocolumn details in its change event payloads.
Consequently, in environments that use the OpenLogReplicator adapter, the {prodname} connector for Oracle consistently displays empty `row_id` values in the source information block.


[[oracle-openlogreplicator-xml-support]]
=== OpenLogReplicator XML support

To capture XML columns using {prodname} Oracle connector with OpenLogReplicator, OpenLogReplicator should be 1.5.0 or later.

[[oracle-xstreams-support]]
== XStreams support

The {prodname} Oracle connector by default ingests changes using native Oracle LogMiner.
The connector can be toggled to use Oracle XStream instead.
To configure the connector to use Oracle XStream, you must apply specific database and connector configurations that differ from those that you use with LogMiner.

.Prerequisites

* To use the XStream API, you must have a license for the GoldenGate product.
Installing GoldenGate is not required.

=== Preparing the Database

.Configuration needed for Oracle XStream
[source,indent=0]
----
ORACLE_SID=ORCLCDB dbz_oracle sqlplus /nolog

CONNECT sys/top_secret AS SYSDBA
alter system set db_recovery_file_dest_size = 5G;
alter system set db_recovery_file_dest = '/opt/oracle/oradata/recovery_area' scope=spfile;
alter system set enable_goldengate_replication=true;
shutdown immediate
startup mount
alter database archivelog;
alter database open;
-- Should show "Database log mode: Archive Mode"
archive log list

exit;
----

In addition, supplemental logging must be enabled for captured tables or the database in order for data changes to capture the _before_ state of changed database rows.
The following illustrates how to configure this on a specific table, which is the ideal choice to minimize the amount of information captured in the Oracle redo logs.

[source,indent=0]
----
ALTER TABLE inventory.customers ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
----

=== Creating XStream users for the connector

The {prodname} Oracle connector requires that users accounts be set up with specific permissions so that the connector can capture change events.
The following briefly describes these user configurations using a multi-tenant database model.


[[oracle-create-users-xstream]]
.Creating an XStream Administrator user
[source,indent=0]
----
sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba
  CREATE TABLESPACE xstream_adm_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/xstream_adm_tbs.dbf'
    SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
  exit;

sqlplus sys/top_secret@//localhost:1521/ORCLPDB1 as sysdba
  CREATE TABLESPACE xstream_adm_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/xstream_adm_tbs.dbf'
    SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
  exit;

sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba
  CREATE USER c##dbzadmin IDENTIFIED BY dbz
    DEFAULT TABLESPACE xstream_adm_tbs
    QUOTA UNLIMITED ON xstream_adm_tbs
    CONTAINER=ALL;

  GRANT CREATE SESSION, SET CONTAINER TO c##dbzadmin CONTAINER=ALL;

  BEGIN
     DBMS_XSTREAM_AUTH.GRANT_ADMIN_PRIVILEGE(
        grantee                 => 'c##dbzadmin',
        privilege_type          => 'CAPTURE',
        grant_select_privileges => TRUE,
        container               => 'ALL'
     );
  END;
  /

  exit;
----

.Creating the connector's XStream user
[source,indent=0]
----
sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba
  CREATE TABLESPACE xstream_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/xstream_tbs.dbf'
    SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
  exit;

sqlplus sys/top_secret@//localhost:1521/ORCLPDB1 as sysdba
  CREATE TABLESPACE xstream_tbs DATAFILE '/opt/oracle/oradata/ORCLCDB/ORCLPDB1/xstream_tbs.dbf'
    SIZE 25M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
  exit;

sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba
  CREATE USER c##dbzuser IDENTIFIED BY dbz
    DEFAULT TABLESPACE xstream_tbs
    QUOTA UNLIMITED ON xstream_tbs
    CONTAINER=ALL;

  GRANT CREATE SESSION TO c##dbzuser CONTAINER=ALL;
  GRANT SET CONTAINER TO c##dbzuser CONTAINER=ALL;
  GRANT SELECT ON V_$DATABASE to c##dbzuser CONTAINER=ALL;
  GRANT FLASHBACK ANY TABLE TO c##dbzuser CONTAINER=ALL;
  GRANT SELECT_CATALOG_ROLE TO c##dbzuser CONTAINER=ALL;
  GRANT EXECUTE_CATALOG_ROLE TO c##dbzuser CONTAINER=ALL;
  exit;
----

=== Create an XStream Outbound Server

Create an https://docs.oracle.com/cd/E11882_01/server.112/e16545/xstrm_cncpt.htm#XSTRM1088[XStream Outbound server]
(given the right privileges, this might be done automatically by the connector going forward, see {jira-url}/browse/DBZ-721[DBZ-721]):

.Create an XStream Outbound Server
[source,indent=0]
----
sqlplus c##dbzadmin/dbz@//localhost:1521/ORCLCDB
DECLARE
  tables  DBMS_UTILITY.UNCL_ARRAY;
  schemas DBMS_UTILITY.UNCL_ARRAY;
BEGIN
    tables(1)  := NULL;
    schemas(1) := 'debezium';
  DBMS_XSTREAM_ADM.CREATE_OUTBOUND(
    server_name     =>  'dbzxout',
    table_names     =>  tables,
    schema_names    =>  schemas);
END;
/
exit;
----

[NOTE]
====
When setting up an XStream Outbound Server to capture changes from a pluggable database,
the `source_container_name` parameter should be provided specifying the pluggable database name.
====

.Configure the XStream user account to connect to the XStream Outbound Server
[source,indent=0]
----
sqlplus sys/top_secret@//localhost:1521/ORCLCDB as sysdba
BEGIN
  DBMS_XSTREAM_ADM.ALTER_OUTBOUND(
    server_name  => 'dbzxout',
    connect_user => 'c##dbzuser');
END;
/
exit;
----

[NOTE]
====
A single XStream Outbound server cannot be shared by multiple {prodname} Oracle connectors.
Each connector requires a unique XStream Outbound connector to be configured.
====

[[selecting-the-xstream-adapter]]
=== Configuring the XStream adapter

By default, {prodname} uses Oracle LogMiner to ingest change events from Oracle.
You can adjust the connector configuration to enable the connector to use the Oracle XStreams adapter.

The following configuration example adds the properties `database.connection.adapter` and `database.out.server.name` to enable the connector to use the XStream API implementation.

[source,json,indent=0]
----
{
    "name": "inventory-connector",
    "config": {
        "connector.class" : "io.debezium.connector.oracle.OracleConnector",
        "tasks.max" : "1",
        "topic.prefix" : "server1",
        "database.hostname" : "<oracle ip>",
        "database.port" : "1521",
        "database.user" : "c##dbzuser",
        "database.password" : "dbz",
        "database.dbname" : "ORCLCDB",
        "database.pdb.name" : "ORCLPDB1",
        "schema.history.internal.kafka.bootstrap.servers" : "kafka:9092",
        "schema.history.internal.kafka.topic": "schema-changes.inventory",
        "database.connection.adapter": "xstream",
        "database.out.server.name" : "dbzxout"
    }
}
----

[id="obtaining-oracle-jdbc-driver-and-xstreams-api-files"]
=== Obtaining the Oracle JDBC driver and XStream API files

The {prodname} Oracle connector requires the Oracle JDBC driver (`ojdbc11.jar`) to connect to Oracle databases.
If the connector uses XStream to access the database, you must also have the XStream API (`xstreams.jar`).
Licensing requirements prohibit {prodname} from including these files in the Oracle connector archive.
However, the required files are available for free download as part of the Oracle Instant Client.
The following steps describe how to download the Oracle Instant Client and extract the required files.

.Procedure

. From a browser, download the https://www.oracle.com/database/technologies/instant-client/downloads.html[Oracle Instant Client package] for your operating system.

. Extract the archive, and then open the `instantclient___<version>__` directory.
+
For example:
+
[source]
----
instantclient_21_1/
├── adrci
├── BASIC_LITE_LICENSE
├── BASIC_LITE_README
├── genezi
├── libclntshcore.so -> libclntshcore.so.21.1
├── libclntshcore.so.12.1 -> libclntshcore.so.21.1

...

├── ojdbc11.jar
├── ucp.jar
├── uidrvci
└── xstreams.jar

----

. Copy the `ojdbc11.jar` and `xstreams.jar` files, and add them to the `_<kafka_home>_/libs` directory, for example, `kafka/libs`.
. Create an environment variable, `LD_LIBRARY_PATH`, and set its value to the path to the Instant Client directory, for example:
+
[source,bash,indent=0]
----
LD_LIBRARY_PATH=/path/to/instant_client/
----

[[oracle-xstreams-connector-properties]]
=== XStream connector properties

The following configuration properties are _required_ when using XStreams unless a default value is available.

[cols="30%a,25%a,45%a"]
|===
|Property
|Default
|Description

|[[oracle-property-database-out-server-name]]<<oracle-property-database-out-server-name, `+database.out.server.name+`>>
|No default
|Name of the XStream outbound server configured in the database.

|===

[[oracle-xstreams-dbms-lob-package]]
=== XStream and DBMS_LOB

Oracle provides a database package called `DBMS_LOB` that consists of a collection of programs to operate on BLOB, CLOB, and NCLOB columns.
Most of these programs manipulate the LOB column in totality, however, one program, `WRITEAPPEND`, is capable of manipulating a subset of the LOB data buffer.

When using XStream, `WRITEAPPEND` emits a logical change record (LCR) event for each invocation of the program.
These LCR events are not combined into a single change event like they are when using the Oracle LogMiner adapter, and so consumers of the topic should be prepared to receive events with partial column values.
This diverged behavior is captured in https://issues.redhat.com/browse/DBZ-4741[DBZ-4741] and will be addressed in a future release.


endif::community[]

// Type: concept
// ModuleID: debezium-oracle-connector-frequently-asked-questions
// Title: Oracle connector frequently asked questions
[[oracle-frequently-asked-questions]]
== Frequently Asked Questions

*Is Oracle 11g supported?*::
Oracle 11g is not supported; however, we do aim to be backward compatible with Oracle 11g on a best-effort basis.
We rely on the community to communicate compatibility concerns with Oracle 11g as well as provide bug fixes when a regression is identified.

*Isn't Oracle LogMiner deprecated?*::
No, Oracle only deprecated the continuous mining option with Oracle LogMiner in Oracle 12c and removed that option starting with Oracle 19c.
The {prodname} Oracle connector does not rely on this option to function, and therefore can safely be used with newer versions of Oracle without any impact.

*How do I change the position in the offsets?*::
The {prodname} Oracle connector maintains two critical values in the offsets, a field named `scn` and another named `commit_scn`.
The `scn` field is a string that represents the low-watermark starting position the connector used when capturing changes.

. Find out the name of the topic that contains the connector offsets.
This is configured based on the value set as the  `offset.storage.topic` configuration property.

. Find out the last offset for the connector, the key under which it is stored and identify the partition used to store the offset.
This can be done using the `kafkacat` utility script provided by the Kafka broker installation.
An example might look like this:
+
[source,shell]
----
kafkacat -b localhost -C -t my_connect_offsets -f 'Partition(%p) %k %s\n'
Partition(11) ["inventory-connector",{"server":"server1"}] {"scn":"324567897", "commit_scn":"324567897: 0x2832343233323:1"}
----
+
The key for `inventory-connector` is `["inventory-connector",{"server":"server1"}]`, the partition is `11` and the last offset is the contents that follows the key.
. To move back to a previous offset the connector should be stopped and the following command has to be issued:
+
[source,shell]
----
echo '["inventory-connector",{"server":"server1"}]|{"scn":"3245675000","commit_scn":"324567500"}' | \
kafkacat -P -b localhost -t my_connect_offsets -K \| -p 11
----
+
This writes to partition `11` of the `my_connect_offsets` topic the given key and offset value.
In this example, we are reversing the connector back to SCN `3245675000` rather than `324567897`.

*What happens if the connector cannot find logs with a given offset SCN?*::
The {prodname} connector maintains a low and high -watermark SCN value in the connector offsets.
The low-watermark SCN represents the starting position and must exist in the available online redo or archive logs in order for the connector to start successfully.
When the connector reports it cannot find this offset SCN, this indicates that the logs that are still available do not contain the SCN and therefore the connector cannot mine changes from where it left off.
+
When this happens, there are two options.
The first is to remove the history topic and offsets for the connector and restart the connector, taking a new snapshot as suggested.
This will guarantee that no data loss will occur for any topic consumers.
The second is to manually manipulate the offsets, advancing the SCN to a position that is available in the redo or archive logs.
This will cause changes that occurred between the old SCN value and the newly provided SCN value to be lost and not written to the topics.
This is not recommended.

*What's the difference between the various mining strategies?*::
The {prodname} Oracle connector provides three options for `log.mining.strategy`.
+
The default is `online_catalog`, and this instructs the connector not write the data dictionary to the redo logs.
Instead, Oracle LogMiner will always use the online data dictionary that contains the current state of the table's structure.
This also means that if a table's structure changes and no longer matches the online data dictionary, Oracle LogMiner will be unable to resolve table or column names if the table's structure is changed.
This mining strategy option should not be used if the tables being captured are subject to frequent schema changes.
It's important that all data changes be lock-stepped with the schema change such that all changes have been captured from the logs for the table, stop the connector, apply the schema change, and restart the connector and resume data changes on the table.
This option requires less Oracle database memory and Oracle LogMiner sessions generally start substantially faster since the data dictionary does not need to be loaded or primed by the LogMiner process.
+
The second option, `redo_log_catalog`, writes the Oracle data dictionary to the redo logs everytime a log switch is detected.
This data dictionary is necessary for Oracle LogMiner to track schema changes effectively when parsing the redo and archive logs.
This option will generate more than usual numbers of archive logs but allows tables being captured to be manipulated in real-time without any impact on capturing data changes.
This option generally requires more Oracle database memory and will cause the Oracle LogMiner session and process to take slightly longer to start after each log switch.
+
The final option, `hybrid`, combines the strengths of the above two strategies with none of their weaknesses.
This strategy harnesses the performance of the `online_catalog` with the resilience in schema tracking of the `redo_log_catalog` while also avoiding the overhead and performance costs with the higher than normal archive log generation.
This mode utilizes a fallback mode where if LogMiner fails to reconstruct the SQL for a database change, the {prodname} connector will rely on the in-memory schema model maintained by the connector to reconstruct the SQL in-flight.
The intent is that this mode will eventually transition to the default, and likely only mode of operation in the future.

*Are there any limitations with the Hybrid mining strategy with LogMiner?*::
Yes, the Hybrid mode for `log.mining.strategy` is still a work-in-progress strategy, and therefore does not yet support all data types.
At this time, this mode cannot reconstruct SQL statements that include operations against `CLOB`, `NCLOB`, `BLOB`, `XML`, nor `JSON` data types.
So in short, if you enable `lob.enabled` with a value of `true`, you will be unable to use the Hybrid strategy and the connector will fail to start as this combination is unsupported.

*Why does the connector appear to stop capturing changes on AWS?*::
Due to the https://aws.amazon.com/blogs/networking-and-content-delivery/best-practices-for-deploying-gateway-load-balancer[fixed idle timeout of 350 seconds on the AWS Gateway Load Balancer],
JDBC calls that require more than 350 seconds to complete can hang indefinitely.
+
In situations where calls to the Oracle LogMiner API take more than 350 seconds to complete, a timeout can be triggered, causing the AWS Gateway Load Balancer to hang.
For example, such timeouts can occur when a LogMiner session that processes large amounts of data runs concurrently with Oracle's periodic checkpointing task.
+
ifdef::product[]
To prevent timeouts from occurring on the AWS Gateway Load Balancer, enable keep-alive packets from the Kafka Connect environment, by performing the following steps as root or a super-user:
endif::product[]
ifdef::community[]
To prevent timeouts from occurring on the AWS Gateway Load Balancer, enable keep-alive packets from the kafka Connect or Debezium Server environment, by performing the following task as the root user or as a super-user in the environment that hosts the connector:
endif::community[]

. From a terminal, run the following command:
+
```shell
sysctl -w net.ipv4.tcp_keepalive_time=60
```
. Edit `/etc/sysctl.conf` and set the value of the following variable as shown:
+
```properties
net.ipv4.tcp_keepalive_time=60
```
. Reconfigure the {prodname} for Oracle connector to use the `database.url` property rather than `database.hostname` and add the `(ENABLE=broken)` Oracle connect string descriptor as shown in the following example:
+
```properties
database.url=jdbc:oracle:thin:username/password!@(DESCRIPTION=(ENABLE=broken)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=hostname)(Port=port)))(CONNECT_DATA=(SERVICE_NAME=serviceName)))
```

+
The preceding steps configure the TCP network stack to send keep-alive packets every 60 seconds.
As a result, the AWS Gateway Load Balancer does not timeout when JDBC calls to the LogMiner API take more than 350 seconds to complete, enabling the connector to continue to read changes from the database's transaction logs.

[id="what-causes-ora-01555-and-how-to-handle-it"]
*What's the cause for ORA-01555 and how to handle it?*::
The {prodname} Oracle connector uses flashback queries when the initial snapshot phase executes.
A flashback query is a special type of query that relies on the flashback area, maintained by the database's `UNDO_RETENTION` database parameter, to return the results of a query based on what the contents of the table had at a given time, or in our case at a given SCN.
By default, Oracle generally only maintains an undo or flashback area for approximately 15 minutes unless this has been increased or decreased by your database administrator.
For configurations that capture large tables, it may take longer than 15 minutes or your configured `UNDO_RETENTION` to perform the initial snapshot and this will eventually lead to this exception:
+
```
ORA-01555: snapshot too old: rollback segment number 12345 with name "_SYSSMU11_1234567890$" too small
```
+
The first way to deal with this exception is to work with your database administrator and see whether they can increase the `UNDO_RETENTION` database parameter temporarily.
This does not require a restart of the Oracle database, so this can be done online without impacting database availability.
However, changing this may still lead to the above exception or a "snapshot too old" exception if the tablespace has inadequate space to store the necessary undo data.
+
The second way to deal with this exception is to not rely on the initial snapshot at all, setting the `snapshot.mode` to `no_data` and then instead relying on incremental snapshots.
An incremental snapshot does not rely on a flashback query and therefore isn't subject to ORA-01555 exceptions.

*What's the cause for ORA-04036 and how to handle it?*::
The {prodname} Oracle connector may report an ORA-04036 exception when the database changes occur infrequently.
An Oracle LogMiner session is started and re-used until a log switch is detected.
The session is re-used as it provides the optimal performance utilization with Oracle LogMiner, but should a long-running mining session occur, this can lead to excessive PGA memory usage, eventually causing an exception like this:
+
```
ORA-04036: PGA memory used by the instance exceeds PGA_AGGREGATE_LIMIT
```
+
This exception can be avoided by specifying how frequent Oracle switches redo logs or how long the {prodname} Oracle connector is allowed to re-use the mining session.
The {prodname} Oracle connector provides a configuration option, xref:oracle-property-log-mining-session-max-ms[`log.mining.session.max.ms`], which controls how long the current Oracle LogMiner session can be re-used for before being closed and a new session started.
This allows the database resources to be kept in-check without exceeding the PGA memory allowed by the database.

*What's the cause for ORA-01882 and how to handle it?*::
The {prodname} Oracle connector may report the following exception when connecting to an Oracle database:
+
```
ORA-01882: timezone region not found
```
+
This happens when the timezone information cannot be correctly resolved by the JDBC driver.
In order to solve this driver related problem, the driver needs to be told to not resolve the timezone details using regions.
This can be done by specifying a driver pass through property using `driver.oracle.jdbc.timezoneAsRegion=false`.


*What's the cause for ORA-25191 and how to handle it?*::
The {prodname} Oracle connector automatically ignores index-organized tables (IOT) as they are not supported by Oracle LogMiner.
However, if an ORA-25191 exception is thrown, this could be due to a unique corner case for such a mapping and the additional rules may be necessary to exclude these automatically.
An example of an ORA-25191 exception might look like this:
+
```
ORA-25191: cannot reference overflow table of an index-organized table
```
+
If an ORA-25191 exception is thrown, please raise a Jira issue with the details about the table and it's mappings, related to other parent tables, etc.
As a workaround, the include/exclude configuration options can be adjusted to prevent the connector from accessing such tables.


*How to solve SAX feature external-general-entities not supported*::
Debezium 2.4 introduced support for Oracle's `XMLTYPE` column type and to support this feature, the Oracle `xdb` and `xmlparserv2` dependencies are required. +
 +
Oracle's `xmlparserv2` dependency implements a SAX-based parser and if the runtime finds an uses this implementation rather than the other on the classpath, this error will occur.
In order to influence specifically which SAX implementation is used generally, the JVM will need to be started with a specific argument. +
 +
When the following JVM argument is provided, the Oracle connector will start successfully without this error.
[source,bash]
----
-Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
----
