diff --git a/content/integrate/redis-data-integration/data-pipelines/prepare-dbs/oracle.md b/content/integrate/redis-data-integration/data-pipelines/prepare-dbs/oracle.md index 29f0d1c2bf..c5024c9304 100644 --- a/content/integrate/redis-data-integration/data-pipelines/prepare-dbs/oracle.md +++ b/content/integrate/redis-data-integration/data-pipelines/prepare-dbs/oracle.md @@ -288,7 +288,124 @@ you should also revoke `LOCK` on all tables: REVOKE LOCK ANY TABLE FROM c##dbzuser container=all; ``` -## 6. Configuration is complete +## 6. Support for Oracle XMLTYPE columns (optional) + +If your Oracle database contains tables with columns of type +[`XMLTYPE`](https://docs.oracle.com/en/database/oracle/oracle-database/21/arpls/XMLTYPE.html), +you must configure additional libraries for Debezium Server to process these columns correctly. + +### Create a custom Debezium Server image + +To support `XMLTYPE` columns, you must create a custom [Docker](https://www.docker.com/) image +that includes the required Oracle XML libraries. + +1. Download the required libraries from Maven Central: + + ```bash + mkdir xml + cd xml + wget https://repo.maven.apache.org/maven2/com/oracle/database/xml/xdb/19.27.0.0/xdb-19.27.0.0.jar + wget https://repo.maven.apache.org/maven2/com/oracle/database/xml/xmlparserv2/19.27.0.0/xmlparserv2-19.27.0.0.jar + mv xdb-19.27.0.0.jar xdb.jar + mv xmlparserv2-19.27.0.0.jar xmlparserv2.jar + ``` + +2. Create a `Dockerfile` in the same directory: + + ```dockerfile + FROM quay.io/debezium/server:3.0.8.Final + + USER root + + COPY xdb.jar /debezium/lib + COPY xmlparserv2.jar /debezium/lib + ``` + +3. Build the custom image: + + ```bash + cd .. + docker build -t dbz-xml xml + docker tag dbz-xml quay.io/debezium/server:3.0.8.Final + docker image save quay.io/debezium/server:3.0.8.Final -o dbz3.0.8-xml-linux-amd.tar + ``` + +4. Add the image to your K3s image repository: + + ```bash + sudo k3s ctr images import dbz3.0.8-xml-linux-amd.tar all + ``` + +### Configure RDI for XMLTYPE support + +In your RDI configuration file, set the `lob.enabled` property to `true` in the +`advanced.source` section: + +```yaml +sources: + oracle: + type: cdc + logging: + level: info + connection: + type: oracle + host: oracle + port: 1521 + user: ${SOURCE_DB_USERNAME} + password: ${SOURCE_DB_PASSWORD} + database: ORCLCDB + advanced: + source: + database.pdb.name: ORCLPDB1 + lob.enabled: true +``` + +### Test XMLTYPE support + +You can create a test table to verify that `XMLTYPE` columns work correctly +(using the +[`CHINOOK`](https://github.com/Redislabs-Solution-Architects/rdi-quickstart-postgres/tree/main) +schema as an example): + +```sql +CREATE TABLE tab1 ( + xmlid INT NOT NULL, + col1 SYS.XMLTYPE, + CONSTRAINT PK_tab1 PRIMARY KEY (xmlid) +); + +DECLARE + v_xml SYS.XMLTYPE; + v_doc CLOB; +BEGIN + -- XMLTYPE created from a CLOB + v_doc := '' || Chr(10) || ' MY_TABLE'; + v_xml := SYS.XMLTYPE.createXML(v_doc); + + INSERT INTO tab1 (xmlid, col1) VALUES (1, v_xml); + + -- XMLTYPE created from a query + SELECT SYS_XMLGEN(table_name) + INTO v_xml + FROM user_tables + WHERE rownum = 1; + + INSERT INTO tab1 (xmlid, col1) VALUES (2, v_xml); + + COMMIT; +END; +/ + +ALTER TABLE CHINOOK.TAB1 ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS; +``` + +After you run an initial +[snapshot]({{< relref "/integrate/redis-data-integration/data-pipelines/data-pipelines#pipeline-lifecycle" >}}), +the XML data appears in your Redis target database: + +{{< image filename="/images/rdi/ingest/xmltype-example.webp" >}} + +## 7. Configuration is complete Once you have followed the steps above, your Oracle database is ready for Debezium to use. diff --git a/static/images/rdi/ingest/xmltype-example.webp b/static/images/rdi/ingest/xmltype-example.webp new file mode 100644 index 0000000000..1c021a872a Binary files /dev/null and b/static/images/rdi/ingest/xmltype-example.webp differ