{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.
{prodname} ingests change events from Oracle by using the native LogMiner database package
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, and uses metadata.
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.
You can customize the way that the connector creates snapshots by setting the value of the snapshot.mode
connector configuration property.
By default, the connector’s snapshot mode is set to initial
.
When the snapshot mode is set to the default, the connector completes the following tasks to create a snapshot:
-
Determines the tables to be captured
-
Obtains a
ROW SHARE MODE
lock on each of the monitored tables to prevent structural changes from occurring during creation of the snapshot. {prodname} holds the locks for only a short time. -
Reads the current system change number (SCN) position from the server’s redo log.
-
Captures the structure of all relevant tables.
-
Releases the locks obtained in Step 2.
-
Scans all of the relevant database tables and schemas as valid at the SCN position that was read in Step 3 (
SELECT * FROM … AS OF SCN 123
), generates aREAD
event for each row, and then writes the event records to the table-specific Kafka topic. -
Records the successful completion of the snapshot in the connector offsets.
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.
snapshot.mode
connector configuration property
Setting | Description |
---|---|
|
The connector performs a database snapshot as described in the default workflow for creating an initial snapshot. After the snapshot completes, the connector begins to stream event records for subsequent database changes. |
|
The connector performs a database snapshot and stops before streaming any change event records, not allowing any subsequent change events to be captured. |
|
The connector captures the structure of all relevant tables, performing all of the steps described in the default snapshot workflow, except that it does not create |
|
Set this option to restore a database 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 the database history topic that experience unexpected growth. 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. |
Warning
|
The {prodname} connector for Oracle does not support schema changes while an incremental snapshot is running. |
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:
serverName.schemaName.tableName
The following list provides definitions for the components of the default name:
- serverName
-
The logical name of the server as specified by the
database.server.name
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 history topics, schema change topics, and 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 Topic routing.
You can configure a {prodname} Oracle connector to produce schema change events that describe schema changes that are applied to captured tables in the database.
The connector writes schema change events to a Kafka topic named <serverName>
, where serverName
is the logical server name that is specified in the database.server.name
configuration property.
{prodname} emits a new message to this topic whenever it streams data from a new table.
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 payload of a schema change event message includes the following elements:
ddl
-
Provides the SQL
CREATE
,ALTER
, orDROP
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
|
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 history topic. The internal database 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 history topic. For the database 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:
|
The following example shows a typical schema change message in JSON format. The message contains a logical representation of the table schema.
{
"schema": {
...
},
"payload": {
"source": {
"version": "{debezium-version}",
"connector": "oracle",
"name": "server1",
"ts_ms": 1588252618953,
"snapshot": "true",
"db": "ORCLPDB1",
"schema": "DEBEZIUM",
"table": "CUSTOMERS",
"txId" : null,
"scn" : "1513734",
"commit_scn": "1513734",
"lcr_position" : null
},
"databaseName": "ORCLPDB1", // (1)
"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\" ", // (2)
"tableChanges": [ // (3)
{
"type": "CREATE", // (4)
"id": "\"ORCLPDB1\".\"DEBEZIUM\".\"CUSTOMERS\"", // (5)
"table": { // (6)
"defaultCharsetName": null,
"primaryKeyColumnNames": [ // (7)
"ID"
],
"columns": [ // (8)
{
"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
}
]
}
}
]
}
}
Item | Field name | Description |
---|---|---|
1 |
|
Identifies the database and the schema that contains the change. |
2 |
|
This field contains the DDL that is responsible for the schema change. |
3 |
|
An array of one or more items that contain the schema changes generated by a DDL command. |
4 |
|
Describes the kind of change. The value is one of the following:
|
5 |
|
Full identifier of the table that was created, altered, or dropped.
In the case of a table rename, this identifier is a concatenation of |
6 |
|
Represents table metadata after the applied change. |
7 |
|
List of columns that compose the table’s primary key. |
8 |
|
Metadata for each column in the changed table. |
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 key:
{
"schema": {
"type": "struct",
"fields": [
{
"type": "string",
"optional": false,
"field": "databaseName"
}
],
"optional": false,
"name": "io.debezium.connector.oracle.SchemaChangeKey"
},
"payload": {
"databaseName": "ORCLPDB1"
}
}
{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
orEND
id
-
String representation of unique transaction identifier.
event_count
(forEND
events)-
Total number of events emmitted by the transaction.
data_collections
(forEND
events)-
An array of pairs of
data_collection
andevent_count
elements that indicates number of events that the connector emits for changes that originate from a data collection.
The following example shows a typical transaction boundary message:
{
"status": "BEGIN",
"id": "5.6.641",
"event_count": null,
"data_collections": null
}
{
"status": "END",
"id": "5.6.641",
"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 transaction.topic
option,
the connector emits transaction events to the <database.server.name>
.transaction
topic.
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:
{
"before": null,
"after": {
"pk": "2",
"aa": "1"
},
"source": {
...
},
"op": "c",
"ts_ms": "1580390884335",
"transaction": {
"id": "5.6.641",
"total_order": "1",
"data_collection_order": "1"
}
}
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 log.mining.buffer.type
.
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.
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 because of large or bulk transactions in the database.
Under certain circumstances, the Oracle database advances the system change number by an unusually high amount, rather than increasing it 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 this difference 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. Additionally, the connector will ignore the mining maximum batch size for this iteration only when this occurs.
Warning
|
SCN gap detection is available only if the large SCN increment occurs while the connector is running and processing near real-time 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 Topic names.
Warning
|
The {prodname} Oracle connector ensures that all Kafka Connect schema names are 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 |
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:
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 <database.server.name>
.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:
{
"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
.
Like the message key, the value of a change event message has a schema section and payload section. The payload section of every change event value produced by the Oracle connector has an envelope structure with the following fields:
op
-
A mandatory field that contains a string value describing the type of operation. Values for the Oracle connector are
c
for create (or insert),u
for update,d
for delete, andr
for read (in the case of a snapshot). before
-
An optional field that, if present, contains the state of the row before the event occurred. The structure is described by the
server1.INVENTORY.CUSTOMERS.Value
Kafka Connect schema, which theserver1
connector uses for all rows in theinventory.customers
table.
after
-
An optional field that if present contains the state of the row after the event occurred. The structure is described by the same
server1.INVENTORY.CUSTOMERS.Value
Kafka Connect schema used inbefore
. source
-
A mandatory field that contains a structure describing the source metadata for the event, which in the case of Oracle contains these fields: the {prodname} version, the connector name, whether the event is part of an ongoing snapshot or not, the transaction id (not while snapshotting), the SCN of the change, and a timestamp representing the point in time when the record was changed in the source database (during snapshotting, this is the point in time of snapshotting).
TipThe
commit_scn
field is optional and describes the SCN of the transaction commit that the change event participates within. This field is only present when using the LogMiner connection adapter. ts_ms
-
An optional field that, if present, contains the time (using the system clock in the JVM running the Kafka Connect task) at which the connector processed the event.
And of course, the schema portion of the event message’s value contains a schema that describes this envelope structure and the nested fields within it.
Let’s look at what a create event value might look like for our customers
table:
{
"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": "string",
"optional": true,
"field": "txId"
},
{
"type": "string",
"optional": true,
"field": "scn"
},
{
"type": "string",
"optional": true,
"field": "commit_scn"
},
{
"type": "boolean",
"optional": true,
"field": "snapshot"
}
],
"optional": false,
"name": "io.debezium.connector.oracle.Source",
"field": "source"
},
{
"type": "string",
"optional": false,
"field": "op"
},
{
"type": "int64",
"optional": true,
"field": "ts_ms"
}
],
"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,
"txId": "6.28.807",
"scn": "2122185",
"commit_scn": "2122185",
"snapshot": false
},
"op": "c",
"ts_ms": 1532592105975
}
}
Examining the schema
portion of the preceding event’s value, we can see how the following schema are defined:
-
The envelope
-
The
source
structure (which is specific to the Oracle connector and reused across all events). -
The table-specific schemas for the
before
andafter
fields.
Tip
|
The names of the schemas for the |
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 they describe. The increased size results from the JSON representation including both the schema and payload portions of a message. You can use the Avro Converter to decrease the size of messages that the connector writes to Kafka topics. |
The value of an update change event on this table has the same schema as the create event. The payload uses the same structure, but it holds different values. Here’s an example:
{
"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,
"txId": "6.9.809",
"scn": "2125544",
"commit_scn": "2125544",
"snapshot": false
},
"op": "u",
"ts_ms": 1532592713485
}
}
Comparing the value of the update event to the create (insert) event, notice the following differences in the payload
section:
-
The
op
field value is nowu
, signifying that this row changed because of an update -
The
before
field now has the state of the row with the values before the database commit -
The
after
field now has the updated state of the row, and here was can see that theEMAIL
value is nowanne@example.com
. -
The
source
field structure has the same fields as before, but the values are different since this event is from a different position in the redo log. -
The
ts_ms
shows the timestamp that {prodname} processed this 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:
|
So far we’ve seen samples of create and update events.
Now, let’s look at the value of a delete event for the same table. As is the case with create and update events, for a delete
event, the schema
portion of the value is exactly the same:
{
"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,
"txId": "6.28.807",
"scn": "2122184",
"commit_scn": "2122184",
"snapshot": false
},
"op": "d",
"ts_ms": 1532592105960
}
}
If we look at the payload
portion, we see a number of differences compared with the create or update event payloads:
-
The
op
field value is nowd
, signifying that this row was deleted -
The
before
field now has the state of the row that was deleted with the database commit. -
The
after
field is null, signifying that the row no longer exists -
The
source
field structure has many of the same values as before, except thets_ms
,scn
andtxId
fields have changed -
The
ts_ms
shows the timestamp that {prodname} processed this event.
This event gives a consumer all kinds of information that it can use to process the removal of this row.
The Oracle connector’s events are designed to work with 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.
When a row is deleted, the delete event value listed above still works with log compaction, since Kafka can still remove all earlier messages with that 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 tombstones.on.delete
.
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:
{
"schema": { ... },
"payload": {
"before": null,
"after": null,
"source": { // (1)
"version": "{debezium-version}",
"connector": "oracle",
"name": "oracle_server",
"ts_ms": 1638974535000,
"snapshot": "false",
"db": "ORCLPDB1",
"sequence": null,
"schema": "DEBEZIUM",
"table": "TEST_TABLE",
"txId": "02000a0037030000",
"scn": "13234397",
"commit_scn": "13271102",
"lcr_position": null
},
"op": "t", // (2)
"ts_ms": 1638974558961, // (3)
"transaction": null
}
}
Item | Field name | Description |
---|---|---|
1 |
|
Mandatory field that describes the source metadata for the event. In a truncate event value, the
|
2 |
|
Mandatory string that describes the type of operation. The |
3 |
|
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 |
Note that since truncate events represent a change made to an entire table and don’t have a message key, unless you’re working with topics with a single partition, there are no ordering guarantees for the change events pertaining to a table (create, update, etc.) and truncate events for that table. For instance a consumer may receive an update event only after a truncate event for that table, when those events are read from different partitions.
If truncate events are not desired, they can be filtered out with the skipped.operations
option.
When the {prodname} Oracle 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
, andSTRUCT
. - 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 Binary and Character LOB types and Numeric types.
The following table describes how the connector maps basic character types.
Oracle Data Type | Literal type (schema type) | Semantic type (schema name) and Notes |
---|---|---|
|
|
n/a |
|
|
n/a |
|
|
n/a |
|
|
n/a |
|
|
n/a |
The following table describes how the connector maps binary and character large object (LOB) data types.
Oracle Data Type | Literal type (schema type) | Semantic type (schema name) and Notes |
---|---|---|
|
n/a |
This data type is not supported |
|
|
Either the raw bytes (the default), a base64-encoded String, or a hex-encoded String, based on the |
|
|
n/a |
|
n/a |
This data type is not supported. |
|
n/a |
This data type is not supported. |
|
|
n/a |
|
n/a |
This data type is not supported. |
Note
|
Oracle only supplies column values for If the value of a |
The following table describes how the {prodname} Oracle connector maps numeric types.
Note
|
You can modify the way that the connector maps the Oracle |
Oracle Data Type | Literal type (schema type) | Semantic type (schema name) and Notes |
---|---|---|
|
|
n/a |
|
|
n/a |
|
|
When the When the |
|
|
|
|
|
|
|
|
|
|
|
When the When the |
|
|
When the When the |
|
|
|
|
|
When the When the |
|
|
|
|
|
When the When the |
Oracle does not natively have 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 aBOOLEAN
type. -
Enumerate a subset of columns by using a comma-separated list of regular expressions.
To use this type of conversion, you must set theconverters
configuration property with theselector
parameter, as shown in the following example:converters=boolean boolean.type=io.debezium.connector.oracle.converters.NumberOneToBooleanConverter boolean.selector=.*MYTABLE.FLAG,.*.IS_ARCHIVED
Other than Oracle’s INTERVAL
, TIMESTAMP WITH TIME ZONE
and TIMESTAMP WITH LOCAL TIME ZONE
data types, the other temporal types depend 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:
Oracle data type | Literal type (schema type) | Semantic type (schema name) and Notes |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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:
Oracle data type | Literal type (schema type) | Semantic type (schema name) and Notes |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The following table describes how the connector maps ROWID (row address) data types.
Oracle Data Type | Literal type (schema type) | Semantic type (schema name) and Notes |
---|---|---|
|
|
|
|
n/a |
This data type is not supported. |
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.
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, XML, or Spatial types. At this time, you cannot use the {prodname} Oracle connector with any of these data types.
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 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.
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.
For information about using Vagrant to set up Oracle in a virtual machine, see the Debezium Vagrant Box for Oracle database GitHub repository.
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
-
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.
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;
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.
ALTER TABLE inventory.customers ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
Minimal supplemental logging must be enabled at the database level and can be configured as follows.
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
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.
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 |
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)
exit;
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 |
4 |
FLASHBACK ANY TABLE |
Enables the connector to perform Flashback queries, which is how the connector performs the initial snapshot of data. |
5 |
SELECT ANY TABLE |
Enables the connector to read any table. |
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 |
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 ANY 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 |
14 |
EXECUTE ON DBMS_LOGMNR_D |
Enables the connector to run methods in the |
15 to 23 |
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. |
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.
For the complete list of the configuration properties that you can set for the {prodname} Oracle connector, see Oracle connector properties.
After the connector starts, it 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.
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:
-
Required {prodname} Oracle connector configuration properties
-
Database history connector configuration properties that control how {prodname} processes events that it reads from the database history topic.
-
Pass-through database driver properties that control the behavior of the database driver.
The following configuration properties are required unless a default value is available.
Property |
Default |
Description |
||
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.) |
|||
No default |
The name of the Java class for the connector. Always use a value of |
|||
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 each converter that you configure for a connector, you must also add a
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. boolean.selector: .*MYTABLE.FLAG,.*.IS_ARCHIVED |
|||
|
The maximum number of tasks that should be created for this connector. The Oracle connector always uses a single task and therefore does not use this value, so the default is always acceptable. |
|||
No default |
IP address or hostname of the Oracle database server. |
|||
No default |
Integer port number of the Oracle database server. |
|||
No default |
Name of the Oracle user account that the connector uses to connect to the Oracle database server. |
|||
No default |
Password to use when connecting to the Oracle database server. |
|||
No default |
Name of the database to connect to. Must be the CDB name when working with the CDB + PDB model. |
|||
No default |
Specifies the raw database JDBC URL. Use this property to provide flexibility in defining that database connection. |
|||
No default |
Name of the Oracle pluggable database to connect to. Use this property with container database (CDB) installations only. |
|||
No default |
Logical name that identifies and 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 logical name that is unique among all connectors in your {prodname} environment. The following characters are valid: alphanumeric characters, hyphens, dots, and underscores. +
|
|||
|
The adapter implementation that the connector uses when it streams database changes. You can set the following values:
|
|||
initial |
Specifies the mode that the connector uses to take snapshots of a captured table. You can set the following values:
After the snapshot is complete, the connector continues to read change events from the database’s redo logs except when For more information, see the table of |
|||
shared |
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:
|
|||
All tables specified in |
An optional, comma-separated list of regular expressions that match the fully-qualified names ( This property does not affect the behavior of incremental snapshots. |
|||
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 From a "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 |
|||
No default |
An optional, comma-separated list of regular expressions that match names of schemas for which you want to capture changes. Any schema name not included in |
|||
|
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. |
|||
No default |
An optional, comma-separated list of regular expressions that match names of schemas for which you do not want to capture changes. Any schema whose name is not included in |
|||
No default |
An optional comma-separated list of regular expressions that match fully-qualified table identifiers for tables to be monitored.
Tables that are not included in the include list are excluded from monitoring.
Each table identifier uses the following format: |
|||
No default |
An optional comma-separated list of regular expressions that match fully-qualified table identifiers for tables to be excluded from monitoring.
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: Do not use this property in combination with |
|||
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.
Fully-qualified names for columns use the following format: |
|||
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.
Fully-qualified column names use the following format: |
|||
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 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. 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. |
|||
bytes |
Specifies how binary ( |
|||
avro |
Specifies how schema names should be adjusted for compatibility with the message converter used by the connector. Possible settings:
|
|||
|
Specifies how the connector should handle floating point values for
|
|||
|
Specifies how the connector should handle values for |
|||
|
Specifies how the connector should react to exceptions during processing of events. You can set one of the following options:
|
|||
|
A positive integer value that specifies the maximum size of each batch of events to process during each iteration of this connector. |
|||
|
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 |
|||
|
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. |
|||
|
Positive integer value that specifies the number of milliseconds the connector should wait during each iteration for new change events to appear. |
|||
|
Controls whether a delete event is followed by a tombstone event. The following values are possible:
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. |
|||
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. |
|||
No default |
An optional comma-separated list of regular expressions that match the fully-qualified names of character-based columns to be truncated in change event messages if their length exceeds the specified number of characters.
Length is specified as a positive integer. A configuration can include multiple properties that specify different lengths.
Specify the fully-qualified name for columns by using the following format: |
|||
No default |
An optional comma-separated list of regular expressions for masking column names in change event messages by replacing characters with asterisks ( |
|||
No default |
An optional comma-separated list of regular expressions that match the fully-qualified names of columns whose original type and length should be added as a parameter to the corresponding field schemas in the emitted change messages.
The schema parameters |
|||
No default |
An optional comma-separated list of regular expressions that match the database-specific data type name of columns whose original type and length should be added as a parameter to the corresponding field schemas in the emitted change messages.
The schema parameters |
|||
|
Specifies, in milliseconds, how frequently the connector sends messages to a heartbeat topic. |
|||
|
Specifies the string that prefixes the name of the topic to which the connector sends heartbeat messages. |
|||
No default |
Specifies an interval in milliseconds that the connector waits after it starts before it takes a snapshot. |
|||
|
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. |
|||
|
Specifies whether field names are normalized to comply with Avro naming requirements. For more information, see Avro naming. |
|||
|
Set the property to See Transaction Metadata for additional details. |
|||
|
Controls the name of the topic to which the connector sends transaction metadata messages. The placeholder |
|||
|
Specifies the mining strategy that controls how Oracle LogMiner builds and uses a given data dictionary for resolving table and column ids to names. |
|||
|
The buffer type controls how the connector manages buffering transaction data. |
|||
|
The maximum number of milliseconds that a LogMiner session can be active before a new session is used. |
|||
|
The minimum SCN interval size that this connector attempts to read from redo/archive logs. Active batch size is also increased/decreased by this amount for tuning connector throughput when needed. |
|||
|
The maximum SCN interval size that this connector uses when reading from redo/archive logs. |
|||
|
The starting SCN interval size that the connector uses for reading data from redo/archive logs. |
|||
|
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. |
|||
|
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. |
|||
|
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. |
|||
|
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. |
|||
|
The number of content records that the connector fetches from the LogMiner content view. |
|||
|
The number of hours in the past from SYSDATE to mine archive logs.
When the default setting ( |
|||
|
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). |
|||
|
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 |
|||
|
Positive integer value that specifies the number of hours to retain long running transactions between redo log switches.
When set to 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. |
|||
No default |
Specifies the configured Oracle archive destination to use when mining archive logs with LogMiner. |
|||
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. |
|||
|
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 |
|||
|
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 |
|||
|
Controls whether or not large object (CLOB or BLOB) column values are emitted in change events.
|
|||
|
Specifies the constant that the connector provides to indicate that the original value is unchanged and not provided by the database. |
|||
No default |
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:
By default, no operations are skipped. |
|||
No default value |
Fully-qualified name of the data collection that is used to send signals to the connector. |
|||
|
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. |
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.
-
snapshot metrics; for monitoring the connector when performing snapshots
-
streaming metrics; for monitoring the connector when processing change events
-
schema history metrics; for monitoring the status of the connector’s schema history
Please refer to the monitoring documentation for details of how to expose these metrics via JMX.
The {prodname} Oracle connector also provides the following additional streaming metrics:
Attributes | Type | Description |
---|---|---|
|
The most recent system change number that has been processed. |
|
|
The oldest system change number in the transaction buffer. |
|
|
The last committed system change number from the transaction buffer. |
|
|
The system change number currently written to the connector’s offsets. |
|
|
Array of the log files that are currently mined. |
|
|
The minimum number of logs specified for any LogMiner session. |
|
|
The maximum number of logs specified for any LogMiner session. |
|
|
Array of the current state for each mined logfile with the format |
|
|
The number of times the database has performed a log switch for the last day. |
|
|
The number of DML operations observed in the last LogMiner session query. |
|
|
The maximum number of DML operations observed while processing a single LogMiner session query. |
|
|
The total number of DML operations observed. |
|
|
The total number of LogMiner session query (aka batches) performed. |
|
|
The duration of the last LogMiner session query’s fetch in milliseconds. |
|
|
The maximum duration of any LogMiner session query’s fetch in milliseconds. |
|
|
The duration for processing the last LogMiner query batch results in milliseconds. |
|
|
The time in milliseconds spent parsing DML event SQL statements. |
|
|
The duration in milliseconds to start the last LogMiner session. |
|
|
The longest duration in milliseconds to start a LogMiner session. |
|
|
The total duration in milliseconds spent by the connector starting LogMiner sessions. |
|
|
The minimum duration in milliseconds spent processing results from a single LogMiner session. |
|
|
The maximum duration in milliseconds spent processing results from a single LogMiner session. |
|
|
The total duration in milliseconds spent processing results from LogMiner sessions. |
|
|
The total duration in milliseconds spent by the JDBC driver fetching the next row to be processed from the log mining view. |
|
|
The total number of rows processed from the log mining view across all sessions. |
|
|
The number of entries fetched by the log mining query per database round-trip. |
|
|
The number of milliseconds the connector sleeps before fetching another batch of results from the log mining view. |
|
|
The maximum number of rows/second processed from the log mining view. |
|
|
The average number of rows/second processed from the log mining. |
|
|
The average number of rows/second processed from the log mining view for the last batch. |
|
|
The number of connection problems detected. |
|
|
The number of hours that transactions are retained by the connector’s in-memory buffer without being committed or rolled back before being discarded.
See |
|
|
The number of current active transactions in the transaction buffer. |
|
|
The number of committed transactions in the transaction buffer. |
|
|
The number of rolled back transactions in the transaction buffer. |
|
|
The average number of committed transactions per second in the transaction buffer. |
|
|
The number of registered DML operations in the transaction buffer. |
|
|
The time difference in milliseconds between when a change occurred in the transaction logs and when its added to the transaction buffer. |
|
|
The maximum time difference in milliseconds between when a change occurred in the transaction logs and when its added to the transaction buffer. |
|
|
The minimum time difference in milliseconds between when a change occurred in the transaction logs and when its added to the transaction buffer. |
|
|
An array of abandoned transaction identifiers removed from the transaction buffer due to their age.
See |
|
|
An array of transaction identifiers that have been mined and rolled back in the transaction buffer. |
|
|
The duration of the last transaction buffer commit operation in milliseconds. |
|
|
The duration of the longest transaction buffer commit operation in milliseconds. |
|
|
The number of errors detected. |
|
|
The number of warnings detected. |
|
|
The number of times the system change number has been checked for advancement and remains unchanged.
This is an indicator that long-running transaction(s) are ongoing and preventing the connector from flushing the latest processed system change number to the connector’s offsets.
Under optimal operations, this should always be or remain close to |
|
|
The number of DDL records that have been detected but could not be parsed by the DDL parser.
This should always be |
|
|
The current mining session’s user global area (UGA) memory consumption in bytes. |
|
|
The maximum mining session’s user global area (UGA) memory consumption in bytes across all mining sessions. |
|
|
The current mining session’s process global area (PGA) memory consumption in bytes. |
|
|
The maximum mining session’s process global area (PGA) memory consumption in bytes across all mining sessions. |
{prodname} is a distributed system that captures all changes in multiple upstream databases; it never misses or loses an event. When the system is operating normally or being managed carefully then {prodname} provides exactly once delivery of every change event record.
If a fault occurs, {prodname} does not lose any events. However, while it is recovering from the fault, it might repeat some change events. In these abnormal situations, {prodname}, like Kafka, provides at least once delivery of change events.
The rest of this section describes how {prodname} handles various kinds of faults and problems.
In some cases, after the {prodname} Oracle connector restarts, it reports the following error:
Online REDO LOG files or archive logs do not contain the offset scn xxxxxxx. Please perform a new snapshot.
After the connector examines the redo and archive logs, if it cannot find the SCN that is recorded in the connector offsets, it returns the preceding error. Because the connector uses the SCN to determine where to resume processing, if the expected SCN if not found, a new snapshot must be completed.
You might find that the V$ARCHIVED_LOG
table contains a record with an SCN that matches the expected range.
However, the record might not be available for mining.
To be available for mining, a record must include a filename in the NAME
column, a value of NO
in the DELETED
column, and a value of A
(available) in the STATUS
column.
If a record does not match any of these criteria, it is considered incomplete and cannot be mined.
At a minimum, archive logs must be retained for as long as the longest downtime window of the connector.
Note
|
Records that have no value in the |
Oracle might issue this error during the snapshot phase when encountering an index-organized table (IOT). This error means that the connector has attempted to execute an operation that must be executed against the parent index-organized table that contains the specified overflow table.
To resolve this, the IOT name used in the SQL operation should be replaced with the parent index-organized table name. To determine the parent index-organized table name, use the following SQL:
SELECT IOT_NAME
FROM DBA_TABLES
WHERE OWNER='<tablespace-owner>'
AND TABLE_NAME='<iot-table-name-that-failed>'
The connector’s table.include.list
or table.exclude.list
configuration options should then be adjusted to explicitly include or exclude the appropriate tables to avoid the connector from attempting to capture changes from the child index-organized table.
Oracle may issue this error if you’re connecting to a database that changes very infrequent. The {prodname} connector starts an Oracle LogMiner session and reuses this session until a log switch is detected. The reuse is both a performance and resource utilization optimization; however, a long-running mining session can cause high PGA memory usage.
If your redo log switch frequency is low, you can avoid the ORA-04036 error by configuring Oracle to automatically switch logs on a defined frequency. A log switch causes the connector to restart the mining session, therefore avoiding high PGA memory usage. The following configuration forces Oracle to switch log files every 20 minutes if a log switch hasn’t occurred within that window:
ALTER SYSTEM SET archive_lag_target=1200 scope=both;
This change will likely require SYSDBA permissions, so coordinate with your database administrator.
If you are unable to adjust the Oracle database parameter, you can instead use the connector configuration option log.mining.session.max.ms
to control the duration of an Oracle LogMiner session so that it is restarted regularly even if a database log switch has not yet happened.
Oracle uses the SYS
and SYSTEM
accounts for lots of internal changes and therefore the connector automatically filters changes made by these users when fetching changes from LogMiner.
Never use the SYS
or SYSTEM
user accounts for changes to be emitted by the {prodname} Oracle connector.
Due to the 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.
-
From a terminal, run the following command:
sysctl -w net.ipv4.tcp_keepalive_time=60
-
Edit
/etc/sysctl.conf
and set the value of the following variable as shown:net.ipv4.tcp_keepalive_time=60
-
Reconfigure the {prodname} for Oracle connector to use the
database.url
property rather thandatabase.hostname
and add the(ENABLE=broken)
Oracle connect string descriptor as shown in the following example: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.
When you start a connector that the Oracle JDBC driver (ojdbc8.jar
) to access an Oracle 11g database, the connector might report the following error:
Caused by: java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1
ORA-01882: timezone region not found
To prevent the preceding error from occurring, add the following setting to the connector configuration: database.oracle.jdbc.timezoneAsRegion=false
.