@@ -288,7 +288,124 @@ you should also revoke `LOCK` on all tables:
288288REVOKE LOCK ANY TABLE FROM c# #dbzuser container=all;
289289```
290290
291- ## 6. Configuration is complete
291+ ## 6. Support for Oracle XMLTYPE columns (optional)
292+
293+ If your Oracle database contains tables with columns of type
294+ [ ` XMLTYPE ` ] ( https://docs.oracle.com/en/database/oracle/oracle-database/21/arpls/XMLTYPE.html ) ,
295+ you must configure additional libraries for Debezium Server to process these columns correctly.
296+
297+ ### Create a custom Debezium Server image
298+
299+ To support ` XMLTYPE ` columns, you must create a custom [ Docker] ( https://www.docker.com/ ) image
300+ that includes the required Oracle XML libraries.
301+
302+ 1 . Download the required libraries from Maven Central:
303+
304+ ``` bash
305+ mkdir xml
306+ cd xml
307+ wget https://repo.maven.apache.org/maven2/com/oracle/database/xml/xdb/19.27.0.0/xdb-19.27.0.0.jar
308+ wget https://repo.maven.apache.org/maven2/com/oracle/database/xml/xmlparserv2/19.27.0.0/xmlparserv2-19.27.0.0.jar
309+ mv xdb-19.27.0.0.jar xdb.jar
310+ mv xmlparserv2-19.27.0.0.jar xmlparserv2.jar
311+ ```
312+
313+ 2 . Create a ` Dockerfile ` in the same directory:
314+
315+ ``` dockerfile
316+ FROM quay.io/debezium/server:3.0.8.Final
317+
318+ USER root
319+
320+ COPY xdb.jar /debezium/lib
321+ COPY xmlparserv2.jar /debezium/lib
322+ ```
323+
324+ 3 . Build the custom image:
325+
326+ ``` bash
327+ cd ..
328+ docker build -t dbz-xml xml
329+ docker tag dbz-xml quay.io/debezium/server:3.0.8.Final
330+ docker image save quay.io/debezium/server:3.0.8.Final -o dbz3.0.8-xml-linux-amd.tar
331+ ```
332+
333+ 4 . Add the image to your K3s image repository:
334+
335+ ``` bash
336+ sudo k3s ctr images import dbz3.0.8-xml-linux-amd.tar all
337+ ```
338+
339+ ### Configure RDI for XMLTYPE support
340+
341+ In your RDI configuration file, set the ` lob.enabled ` property to ` true ` in the
342+ ` advanced.source ` section:
343+
344+ ``` yaml
345+ sources :
346+ oracle :
347+ type : cdc
348+ logging :
349+ level : info
350+ connection :
351+ type : oracle
352+ host : oracle
353+ port : 1521
354+ user : ${SOURCE_DB_USERNAME}
355+ password : ${SOURCE_DB_PASSWORD}
356+ database : ORCLCDB
357+ advanced :
358+ source :
359+ database.pdb.name : ORCLPDB1
360+ lob.enabled : true
361+ ` ` `
362+
363+ ### Test XMLTYPE support
364+
365+ You can create a test table to verify that ` XMLTYPE` columns work correctly
366+ (using the
367+ [`CHINOOK`](https://github.com/Redislabs-Solution-Architects/rdi-quickstart-postgres/tree/main)
368+ schema as an example) :
369+
370+ ` ` ` sql
371+ CREATE TABLE tab1 (
372+ xmlid INT NOT NULL,
373+ col1 SYS.XMLTYPE,
374+ CONSTRAINT PK_tab1 PRIMARY KEY (xmlid)
375+ );
376+
377+ DECLARE
378+ v_xml SYS.XMLTYPE;
379+ v_doc CLOB;
380+ BEGIN
381+ -- XMLTYPE created from a CLOB
382+ v_doc := '<?xml version="1.0"?>' || Chr(10) || ' <TABLE_NAME>MY_TABLE</TABLE_NAME>';
383+ v_xml := SYS.XMLTYPE.createXML(v_doc);
384+
385+ INSERT INTO tab1 (xmlid, col1) VALUES (1, v_xml);
386+
387+ -- XMLTYPE created from a query
388+ SELECT SYS_XMLGEN(table_name)
389+ INTO v_xml
390+ FROM user_tables
391+ WHERE rownum = 1;
392+
393+ INSERT INTO tab1 (xmlid, col1) VALUES (2, v_xml);
394+
395+ COMMIT;
396+ END;
397+ /
398+
399+ ALTER TABLE CHINOOK.TAB1 ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
400+ ` ` `
401+
402+ After you run an initial
403+ [snapshot]({{< relref "/integrate/redis-data-integration/data-pipelines/data-pipelines#pipeline-lifecycle" >}}),
404+ the XML data appears in your Redis target database :
405+
406+ {{< image filename="/images/rdi/ingest/xmltype-example.webp" >}}
407+
408+ # # 7. Configuration is complete
292409
293410Once you have followed the steps above, your Oracle database is ready
294411for Debezium to use.
0 commit comments