You can use Data Transmission Service (DTS) to track data changes in real time. This feature applies to the following scenarios: lightweight cache updates, business decoupling, and synchronization of extract, transform, and load (ETL) operations. This topic describes how to track data changes from a self-managed Oracle database.

Prerequisites

  • The version of the self-managed Oracle database is 9i, 10g, or 11g. Real Application Cluster (RAC) instances are not supported.
  • Supplemental logging, including SUPPLEMENTAL_LOG_DATA_PK and SUPPLEMENTAL_LOG_DATA_UI, is enabled for the self-managed Oracle database. For more information, see Supplemental Logging.
  • The self-managed Oracle database is running in ARCHIVELOG mode. Archived log files are accessible and a suitable retention period is set for archived log files. For more information, see Managing Archived Redo Log Files.

Precautions

  • DTS does not track data definition language (DDL) operations that are performed by gh-ost or pt-online-schema-change. Therefore, the change tracking client may fail to write the consumed data to the destination tables due to schema conflicts.
  • If the source database is used in another task, for example, it is used in a running data migration task, DTS may track data changes of other objects. In this case, you must use the change tracking client to filter the tracked data.

Before you begin

Log on to the source Oracle database, create a database account, and grant the database administrator (DBA) permission to the account.

Note If the DBA permission cannot be granted to the database account, you can grant fine-grained permissions to the account. The following sample statements show you how to grant specific permissions to an Oracle database account.
create session;
connect;
resource;
execute on sys.dbms_logmnr;
select on v_$logmnr_contents;
select on v_$log;
select on v_$logfile;
select on v_$archived_log;
select on v_$logmnr_logs;
select on v_$parameter;
select on v_$database;
select on all_objects;
select on all_tab_cols;
select on dba_registry;
select any table;
select any transaction;
select on v$active_instances;
select on v$instance;
select on sys.USER$;
select on SYS.OBJ$;
select on SYS.COL$;
select on SYS.IND$;
select on SYS.ICOL$;
select on SYS.CDEF$;
select on SYS.CCOL$;
select on SYS.TABPART$;
select on SYS.TABSUBPART$;
select on SYS.TABCOMPART$;
select on gv_$listener_network;
#Grant permissions on the pluggable database (PDB) and container database (CDB).
#Grant permissions on the PDB:
create   session;
connect;
resource;
select on  all_objects;
select on  all_tab_cols;
select on  dba_registry;
select any table;
select any transaction;
select on v_$log;
select on v_$logfile;
select on v_$archived_log;
select on v_$parameter;
select on v_$database;
select on v_$active_instances;
select on v_$instance;
select on V_$PDBS;
select on sys.USER$;
select on SYS.OBJ$;
select on SYS.COL$;
select on SYS.IND$;
select on SYS.ICOL$;
select on SYS.CDEF$;
select on SYS.CCOL$;
select on SYS.TABPART$;
select on SYS.TABSUBPART$;
select on SYS.TABCOMPART$;

#Grant permissions on the CDB:
create   session;
LOGMINING;
select on v_$logmnr_contents;

#The following sample statements show you how to grant permissions to a database account named dtstest.
create user dtstest IDENTIFIED BY rdsdt_dtsacct;
grant create session to dtstest;
grant connect to dtstest;
grant resource to dtstest;
grant execute on sys.dbms_logmnr to dtstest;
grant select on v_$logmnr_contents to dtstest;
grant select on v_$log to dtstest;
grant select on v_$logfile to dtstest;
grant select on v_$archived_log to dtstest;
grant select on v_$logmnr_logs to dtstest;
grant select on v_$parameter to dtstest;
grant select on v_$database to dtstest;
grant select on all_objects to dtstest;
grant select on all_tab_cols to dtstest;
grant select on dba_registry to dtstest;
grant select any table to dtstest;
grant select any transaction to dtstest;
grant select on v$active_instances to dtstest;
grant select on v$instance to dtstest;
grant select on sys.USER$ to dtstest;
grant select on SYS.OBJ$ to dtstest;
grant select on SYS.COL$ to dtstest;
grant select on SYS.IND$ to dtstest;
grant select on SYS.ICOL$ to dtstest;
grant select on SYS.CDEF$ to dtstest;
grant select on SYS.CCOL$ to dtstest;
grant select on SYS.TABPART$ to dtstest;
grant select on SYS.TABSUBPART$ to dtstest;
grant select on SYS.TABCOMPART$ to dtstest;
grant select on gv_$listener_network to dtstest;
#The following sample statements show you how to grant permissions on the PDB and CDB to a database account named dtstest.
#Grant permissions on the PDB:
create user dtstest IDENTIFIED BY rdsdt_dtsacct;
grant create  session to dtstest;
grant connect  to dtstest;
grant resource to dtstest;
grant select on  all_objects to dtstest;
grant select on  all_tab_cols to dtstest;
grant select on  dba_registry to dtstest;
grant select any table to dtstest;
grant select any transaction to dtstest;
-- v$log privileges
grant select on v_$log to dtstest;
-- v$logfile privileges
grant select on v_$logfile to dtstest;
-- v$archived_log privileges
grant select on v_$archived_log to dtstest;
-- v$parameter privileges
grant select on v_$parameter to dtstest;
-- v$database privileges
grant select on v_$database to dtstest;
-- v$active_instances privileges
grant select on v_$active_instances to dtstest;
-- v$instance privileges
grant select on v_$instance to dtstest;
-- V$PDBS privileges
grant select on V_$PDBS to dtstest;
grant select on sys.USER$ to dtstest;
grant select on SYS.OBJ$ to dtstest;
grant select on SYS.COL$ to dtstest;
grant select on SYS.IND$ to dtstest;
grant select on SYS.ICOL$ to dtstest;
grant select on SYS.CDEF$ to dtstest;
grant select on SYS.CCOL$ to dtstest;
grant select on SYS.TABPART$ to dtstest;
grant select on SYS.TABSUBPART$ to dtstest;
grant select on SYS.TABCOMPART$ to dtstest;

#Grant permissions on the CDB:
create user dtstest IDENTIFIED BY rdsdt_dtsacct;
grant create   session to dtstest;
grant LOGMINING TO dtstest;
-- v$logmnr_contents privileges
grant select on v_$logmnr_contents to dtstest;

Procedure

  1. Create a change tracking instance. For more information, see Purchase a DTS instance.
    Note On the buy page, set Source Database to Oracle and select the region where the source instance resides.
  2. Log on to the DTS console.
  3. In the left-side navigation pane, click Change Tracking.
  4. At the top of the Change Tracking Tasks page, select the region where the change tracking instance resides.
    Select a region
  5. Find the change tracking instance and click Configure Channel in the Actions column.
  6. Configure the source database and network type for the change tracking task.
    Configure the source database and network type
    Section Parameter Description
    N/A Task Name DTS automatically generates a task name. We recommend that you specify an informative name for easy identification. You do not need to use a unique task name.
    Source Database Instance Type Select the type of the source instance. In this example, select Self-managed Database on ECS.
    Note If you select other instance types, you must deploy the network environment for the source database. For more information, see Preparation overview.
    Database Type The value of this parameter is set to Oracle and cannot be changed.
    Instance Region The source region that you selected on the buy page. You cannot change the value of this parameter.
    ECS Instance ID Select the ID of the Elastic Compute Service (ECS) instance that hosts the self-managed Oracle database.
    Port Number Enter the service port number of the self-managed Oracle database.
    SID Enter the system ID (SID) of the self-managed Oracle database.
    Database Account Enter the account of the self-managed Oracle database.
    Note For more information about how to create and authorize a database account, see Before you begin.
    Database Password Enter the password of the database account.
    Consumer Network Type N/A Select the network type of the change tracking instance.
    Note
    • We recommend that you select the same network type as the ECS instance on which the change tracking client is installed. For example, if the ECS instance is deployed in a virtual private cloud (VPC), select VPC as the network type and specify the VPC and vSwitch parameters.
    • If you track data changes over internal networks, the network latency is minimal.
    • Classic

      If you select Classic, no other configurations are required. For more information, see Classic network.

    • VPC

      If you select VPC, you must specify the VPC and vSwitch parameters. For more information, see VPC.

  7. Click Set Whitelist and Next. The following table describes the details about whitelist settings.
    Instance type of the source database Description
    Self-managed database that is hosted on ECS The CIDR blocks of DTS servers are automatically added to an inbound rule of the ECS instance. This ensures that DTS servers can connect to the source instance.
    • Self-managed database that is connected over Express Connect, VPN Gateway, or Smart Access Gateway
    • Self-managed database that has no public IP address or port number (connected over Database Gateway)
    • Self-managed database with a public IP address
    If a whitelist is configured for the source database, you must add the CIDR blocks of DTS servers to the whitelist of the database. For more information, see Add the CIDR blocks of DTS servers to the security settings of on-premises databases.
  8. Select the data change types and objects.
    Select the data change types and objects
    Parameter Description
    Required Data Types
    • Data Updates

      DTS tracks data updates of the selected objects, including the INSERT, DELETE, and UPDATE operations.

    • Schema Updates

      DTS tracks the create, delete, and modify operations that are performed on all object schemas of the source instance. You must use the change tracking client to filter the required data.

    Note
    • If you select a database as the object, DTS tracks data changes of all objects, including new objects in the database.
    • If you select a table as the object, DTS only tracks data changes of this table. In this case, if you want to track data changes of another table, you must add the table to the required objects. For more information, see Modify the objects for change tracking.
    Required Objects

    Select objects from the Required Objects section and click the Rightwards arrow icon to add the objects to the Selected section.

    Note You can select tables or databases as the objects for change tracking.
  9. In the lower-right corner of the page, click Save and Precheck.
    Note
    • Before you can start the change tracking task, a precheck is performed. You can start the change tracking task only after the task passes the precheck.
    • If the task fails to pass the precheck, click the Info icon icon next to each failed item to view details. Troubleshoot the issues based on the causes and run a precheck again.
  10. Close the Precheck dialog box after the following message is displayed: The precheck is passed.
    After the change tracking task is configured, DTS performs initial change tracking, which takes about 1 minute. After initial change tracking is completed, you can create one or more consumer groups to consume the tracked data.

What to do next

  1. Create consumer groups
  2. Use a Kafka client to consume tracked data
  3. Use the SDK demo code to consume tracked data