You can use Data Transmission Service (DTS) to track data changes from databases in real time. You can use the change tracking feature in the following scenarios: lightweight cache updates, business decoupling, asynchronous data processing, and synchronization of extract, transform, and load (ETL) operations. This topic describes how to create a change tracking task 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) or pluggable database (PDB) 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.

Limits

Category Description
Limits on the source database
  • Bandwidth requirements: The server to which the source database belongs must have sufficient egress bandwidth. Otherwise, the change tracking speed is affected.
  • The source tables must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, some of the tracked data changes may be duplicate.
  • If you select tables as the objects to be tracked, up to 500 tables can be tracked in a single change tracking task. If you run a task to track more than 500 tables, a request error occurs. In this case, we recommend that you split the tables to be tracked, configure multiple tasks to track the tables, or configure a change tracking task for the entire database.
  • The following requirements must be met:
    • The redo log and archive log must be enabled.
    • The redo logs and archive logs of the source database must be stored for more than 24 hours. Otherwise, DTS may fail to obtain the redo logs and archive logs and the task may fail. In extreme cases, data may be inconsistent or lost. Make sure that you set the retention period of redo logs and archive logs based on the preceding requirements. Otherwise, the Service Level Agreement (SLA) of DTS does not guarantee service reliability and performance.
Other limits
  • You must make sure that the precision settings for columns of the FLOAT or DOUBLE data type meet your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for the FLOAT data type to 38 digits and the precision for the DOUBLE data type to 308 digits.
  • 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.

Preparations

Log on to the source Oracle database, create a database account, and grant the database administrator (DBA) permission to the account. For more information, see CREATE USER and GRANT.

Notice If you need to track data changes from an Oracle database but the database administrator (DBA) permission cannot be granted to the database account, you can enable archive logging and supplemental logging, and grant fine-grained permissions to the account.
  1. Enable archive logging and supplemental logging.
    Type Procedure
    Archive logging Execute the following statements to enable archive logging:
    shutdown immediate;
    startup mount;
    alter database archivelog;
    alter database open;
    archive log list;
    Supplemental logging Enable supplemental logging at the database or table level:
    Note You can enable database-level supplemental logging to ensure the stability of DTS tasks. You can enable table-level supplemental logging to reduce the disk usage of the source Oracle database.
    • Enable database-level supplemental logging
      1. Enable minimal supplemental logging:
        alter database add supplemental log data;
      2. Enable primary key and unique key supplemental logging at the database level:
        alter database add supplemental log data (primary key,unique index) columns;
    • Enable table-level supplemental logging
      1. Enable minimal supplemental logging:
        alter database add supplemental log data;
      2. Enable table-level supplemental logging by using one of the following methods:
        • Enable primary key supplemental logging at the table level:
          alter table table_name add supplemental log data (primary key) columns;
        • Enable table-level supplemental logging for all columns:
          alter table tb_name add supplemental log data (all) columns ;
  2. Grant fine-grained permissions to an Oracle database account
    # Create a database account, for example, rdsdt_dtsacct, and grant permissions to the account.
    create user rdsdt_dtsacct IDENTIFIED BY rdsdt_dtsacct;
    grant create session to rdsdt_dtsacct;
    grant connect to rdsdt_dtsacct;
    grant resource to rdsdt_dtsacct;
    grant execute on sys.dbms_logmnr to rdsdt_dtsacct;
    grant select on V_$LOGMNR_LOGS to rdsdt_dtsacct;
    grant select on all_objects to rdsdt_dtsacct;
    grant select on all_tab_cols to rdsdt_dtsacct;
    grant select on dba_registry to rdsdt_dtsacct;
    grant select any table to rdsdt_dtsacct;
    grant select any transaction to rdsdt_dtsacct;
    -- v$log privileges
    grant select on v_$log to rdsdt_dtsacct;
    -- v$logfile privileges
    grant select on v_$logfile to rdsdt_dtsacct;
    -- v$archived_log privileges
    grant select on v_$archived_log to rdsdt_dtsacct;
    -- v$parameter privileges
    grant select on v_$parameter to rdsdt_dtsacct;
    -- v$database privileges
    grant select on v_$database to rdsdt_dtsacct;
    -- v$active_instances privileges
    grant select on v_$active_instances to rdsdt_dtsacct;
    -- v$instance privileges
    grant select on v_$instance to rdsdt_dtsacct;
    -- v$logmnr_contents privileges
    grant select on v_$logmnr_contents to rdsdt_dtsacct;
    -- system tables
    grant select on sys.USER$ to rdsdt_dtsacct;
    grant select on SYS.OBJ$ to rdsdt_dtsacct;
    grant select on SYS.COL$ to rdsdt_dtsacct;
    grant select on SYS.IND$ to rdsdt_dtsacct;
    grant select on SYS.ICOL$ to rdsdt_dtsacct;
    grant select on SYS.CDEF$ to rdsdt_dtsacct;
    grant select on SYS.CCOL$ to rdsdt_dtsacct;
    grant select on SYS.TABPART$ to rdsdt_dtsacct;
    grant select on SYS.TABSUBPART$ to rdsdt_dtsacct;
    grant select on SYS.TABCOMPART$ to rdsdt_dtsacct;

Procedure

  1. Go to the Change Tracking page of the new DTS console.
  2. In the upper-left corner of the page, select the region where the change tracking instance resides.
    Select a region
  3. Click Create Task. On the page that appears, configure the source database and the consumer network type.
    Warning After you select the source instance, we recommend that you read the limits displayed at the top of the page. This helps you create and run the change tracking task.
    Section Parameter Description
    N/A Task Name

    DTS automatically generates a task name. We recommend that you specify an informative name to identify the task. You do not need to use a unique task name.

    Source Database Select Template
    You can choose whether to use a database connection template.
    • If you use a connection template, DTS automatically applies the parameter settings of the source database.
      Note
      • You can modify the parameter settings of a connection template.
      • To edit the template name, you can click Edit Template Name at the bottom of the Source Database section.
      • The modified connection template will take effect the next time you select the connection template. The database instance that you have configured by using the template is not affected.
    • If you do not use a connection template, you must set parameters for the source database.
    Database Type Select Oracle.
    Access Method Select the type of the source instance. In this example, select Self-managed Database on ECS.
    Note If your source database is a self-managed database, you must deploy the network environment for the database. For more information, see Preparation overview.
    Instance Region Select the region in which the self-managed Oracle database resides.
    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. The default port number is 1521.
    Oracle Type
    • If you select Non-RAC Instance, you must specify the SID parameter.
    • If you select RAC or PDB Instance, you must specify the Service Name parameter.
      Notice RAC or PDB instances are not supported.
    In this example, select Non-RAC Instance.
    Database Account Enter the account of the self-managed Oracle database. For information about the permissions that are required for the account, see Preparations.
    Database Password

    Enter the password of the database account.

    Save as Template
    Click Save as Template. In the dialog box that appears, set the name of the database connection, and click OK. The connection settings of the database instance is saved as a template.
    Note We recommend that you specify an informative name to identify the database connection. You do not need to use a unique name.
    Consumer Network Type
    • Classic
    • VPC
    Select the network type of the change tracking instance.
    Note
    • If your change tracking client is deployed on a local server, you can select Classic or VPC.
    • If your change tracking client is deployed on an ECS instance, we recommend that you select the network of the ECS instance. For example, if the ECS instance is deployed in a 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.

    Notice After a change tracking task is configured, you cannot change the network type. Data changes are tracked and consumed over the specified type of network.
  4. In the lower part of the page, click Test Connectivity and Proceed.
  5. Select objects for the task and configure advanced settings.
    • Basic Settings
      Parameter Description
      Data Change Types
      • Data Update

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

      • Schema Update

        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.

      Source Objects
      Select one or more objects from the Source Objects section and click the Rightwards arrow icon to move the objects to the Selected Objects section.
      Note You can select tables or databases as the objects for change tracking.
      • 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 tracks only 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 selected objects. For more information, see Modify the objects for change tracking.
    • Advanced Settings
      Parameter Description
      Set Alerts
      Specify whether to set alerts for the change tracking task. If the task fails or the latency exceeds the threshold, the alert contacts will receive notifications.
      • Select No if you do not want to set alerts.
      • Select Yes to set alerts. In this case, you must also set the alert threshold and alert contacts.
      Retry Time for Failed Connections
      Specify the retry time for failed connections. Valid values: 10 to 1440. Unit: minutes. Default value: 120. We recommend that you set the retry time to more than 30 minutes. If DTS reconnects to the source and destination databases within the specified time, DTS resumes the change tracking task. Otherwise, the change tracking task fails.
      Note
      • If multiple DTS instances have the same source or destination database, the lowest value takes effect. For example, the retry time is set to 30 minutes for Instance A and 60 minutes for Instance B, DTS retries failed connections at an interval of 30 minutes.
      • When DTS retries a connection, you are charged for the DTS instance. We recommend that you specify the retry time based on your business needs. You can also release the DTS instance at your earliest opportunity after the source and destination instances are released.
  6. Click Next: Save Task Settings and Precheck in the lower part of the page.
    Note
    • Before you can start the change tracking task, DTS performs a precheck. You can start the change tracking task only after the task passes the precheck.
    • If the task fails to pass the precheck, you can click the Info icon icon next to each failed item to view details.
      • You can troubleshoot the issues based on the causes and run a precheck again.
      • If you do not need to troubleshoot the issues, you can ignore failed items and run a precheck again.
  7. Wait until the Success Rate becomes 100%. Then, click Next: Purchase Instance.
  8. On the Purchase Instance page, specify the billing method of the change tracking instance. The following table describes the parameters.
    Parameter Description
    Billing Method
    • Subscription: You can pay for your subscription when you create an instance. We recommend that you select the subscription billing method for long-term use because it is more cost-effective than the pay-as-you-go billing method. You can save more costs with longer subscription periods.
    • Pay-as-you-go: A pay-as-you-go instance is billed on an hourly basis. We recommend that you select the pay-as-you-go billing method for short-term use. If you no longer require your pay-as-you-go instance, you can release it to reduce costs.
    Billing Type of Change Tracking Instance

    If you select the subscription billing method, you can select only USD 120 per month for configuration fee (no data traffic fee) as the billing type of the change tracking instance.

    Subscription Length
    If you select the subscription billing method, set the subscription length and the number of instances that you want to create. The subscription length can be one to nine months or one to three years.
    Note This parameter is available only if you select the subscription billing method.
    Note When a client accesses the change tracking instance over the Internet, DTS charges Internet traffic fee.
  9. Read and select Data Transmission Service (Pay-as-you-go) Service Terms.
  10. Click Buy and Start to start the change tracking task. You can view the progress of the task in the task list.

What to do next

When the change tracking task is running, you can create consumer groups based on the downstream client to consume the tracked data.
  1. Create and manage consumer groups. For more information, see Create consumer groups.
  2. Use one of the following methods to consume the tracked data: