Data Subscription lets you subscribe to incremental data from a source database in real time. It is ideal for use cases such as lightweight cache updates, asynchronous business system decoupling, and real-time data synchronization with custom ETL logic. This topic shows you how to create a Data Subscription task for an Oracle database.
Prerequisites
-
The self-managed Oracle database must be version 9i, 10g, or 11g. Real Application Clusters (RAC) and Pluggable Database (PDB) instances are not supported.
-
Supplemental logging is enabled for the source Oracle database, and the
supplemental_log_data_pkandsupplemental_log_data_uiparameters are enabled. For more information, see Supplemental Logging. -
The source Oracle database must be in ARCHIVELOG mode. Archived logs must have a reasonable retention period and be accessible. For more information, see ARCHIVELOG.
A VPC and a vSwitch for the change tracking instance to run in.
Limitations
|
Type |
Description |
|
Source database limitations |
|
|
Other limitations |
|
Before you begin
Log on to the source Oracle database, create a database account for the Data Subscription task, and grant it DBA permissions. For more information, see CREATE USER and GRANT USER.
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.
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:
NoteYou 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
Enable minimal supplemental logging:
alter database add supplemental log data;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
Enable minimal supplemental logging:
alter database add supplemental log data;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 ;
Grant fine-grained permissions to an Oracle database account.
Oracle Versions 9i to 11g
# 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
-
Use one of the following methods to go to the Change Tracking Tasks page and select the region in which the change tracking instance resides.
DTS console
-
Log on to the DTS console.
-
In the left-side navigation pane, click Change Tracking.
-
In the upper-left corner of the page, select the region in which the change tracking instance resides.
DMS console
NoteThe actual operations may vary based on the mode and layout of the DMS console. For more information, see Simple mode console and Customize the layout and style of the DMS console.
-
Log on to the DMS console.
-
In the top navigation bar, move the pointer over .
-
From the drop-down list to the right of Change Tracking Tasks, select the region in which the change tracking instance resides.
-
-
Click Create Task to go to the task configuration page.
-
Configure parameters in the Source Database and Consumer Network Type sections.
WarningAfter you specify the source database instance, we recommend that you read the Limits that are displayed in the upper part of the page. Otherwise, the task may fail or the tracked data cannot be consumed.
Category
Parameter
Description
N/A
Task Name
The name of the change tracking task. DTS automatically assigns a name to the task. We recommend that you specify a descriptive name that makes it easy to identify the task. You do not need to use a unique task name.
Source Database
Select Existing Connection
If you want to use a database instance that is already added to the system (either newly created or previously saved), select it from the dropdown list. The database information is then automatically populated.
NoteIn the DMS console, this setting is labeled Select a DMS database instance..
If your database instance is not in the system, or if you do not want to use an existing one, manually configure the database information.
Database Type
Select Oracle.
Access Method
Select the access method based on the source instance type. This topic uses Self-managed Database on ECS as an example.
NoteIf your source database is a self-managed database, you must complete the preparation for the database. For more information, see Preparation overview.
Instance Region
Select the region where the self-managed Oracle database is located.
ECS Instance ID
Select the ID of the ECS instance that hosts the self-managed Oracle database.
Port
Enter the service port of the self-managed Oracle database. The default value is 1521.
Oracle Type
-
Non-RAC Instance: If you select this option, you must also specify the SID.
-
RAC or PDB Instance: If you select this option, you must also enter the Service Name.
ImportantRAC and PDB instances are not supported.
This example uses a Non-RAC Instance.
Database Account
Enter the account for the self-managed Oracle database. For permission requirements, see Before you begin.
Database Password
The password that is used to access the database instance.
Consumer Network Type
Network Type
The value of the Network Type parameter is fixed to VPC. You must select a VPC and a vSwitch. For more information, see VPCs.
Note-
After a change tracking task is configured, you cannot change the settings in the Consumer Network Type section.
-
If your change tracking client is deployed in a VPC, we recommend that you select the same VPC and vSwitch connected to the client.
-
If you track data changes over internal networks, the network latency is minimal.
After completing the configuration, click Test Connectivity and Proceed at the bottom of the page. In the CIDR Blocks of DTS Servers dialog box that appears, click Test Connectivity.
NoteTo allow access, ensure that you add the IP address CIDR blocks of the DTS servers to the security settings of the source database, either automatically or manually. For more information, see Add the CIDR blocks of DTS servers to the IP address whitelist of a database.
-
Configure the objects for change tracking.
-
On the Configure Objects page, configure the objects for change tracking.
Parameter
Description
Data Change Types
Data Change Types are checked by default and cannot be modified.
-
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 data to be tracked.
Source Objects
Select one or more objects from the Source Objects section and click the
icon to add the objects to the Selected Objects section. NoteYou can select tables or databases as the objects for change tracking.
-
If you select a database as the object, DTS tracks incremental data of all objects, including new objects in the database.
-
If you select a table as the object, DTS tracks only incremental data of this table. In this case, if you want to track data changes of another table, you must add the table to the object list. For more information, see Modify the objects for change tracking.
-
-
Click Next: Advanced Settings to configure advanced settings.
Parameter
Description
Dedicated Cluster for Task Scheduling
By default, DTS schedules the task to a shared cluster. You do not need to configure this parameter. You can purchase dedicated clusters of specified specifications to run DTS change tracking tasks. For more information, see What is a DTS dedicated cluster?.
Retry Time for Failed Connections
The retry time range for failed connections. If the change tracking task fails, DTS immediately retries a connection within the time range. Valid values: 10 to 1440. Unit: minutes. Default value: 720. We recommend that you set the parameter to a value greater than 30. If DTS is reconnected to the source database instance within the specified time range, DTS resumes the change tracking task. Otherwise, the change tracking task fails.
Note-
If multiple change tracking tasks are configured for a database instance, the shortest retry time range takes precedence. For example, Task A and Task B are configured for the same database instance. Task A is configured with a retry time range of 30 minutes, and Task B is configured with a retry time range of 60 minutes. In this case, the retry time range of 30 minutes takes precedence.
-
When DTS retries a connection, fees are charged. We recommend that you specify the retry time range based on your business requirements, or release the DTS instance at the earliest opportunity after the source database instance is released.
Retry Time for Other Issues
The retry time range for other issues. For example, if DDL or DML operations fail to be performed after the change tracking task is started, DTS immediately retries the operations within the retry time range. Valid values: 1 to 1440. Unit: minutes. Default value: 10. We recommend that you set the parameter to a value greater than 10. If the failed operations are successfully performed within the specified retry time range, DTS resumes the change tracking task. Otherwise, the change tracking task fails.
ImportantThe value of the Retry Time for Other Issues parameter must be smaller than the value of the Retry Time for Failed Connections parameter.
Environment Tag
You can select an environment tag to identify the instance. This step is optional.
Monitoring and Alerting
Specifies whether to enable alerting for the change tracking task. If alerting is configured and the task fails or the latency exceeds the threshold, alert notifications are sent. Valid values:
-
No: does not enable alerting.
-
Yes: enables alerting. In this case, you must also configure the alert threshold and alert contacts. For more information, see Configure monitoring and alerts.
-
-
-
In the lower part of the page, click Next: Save Task Settings and Precheck.
-
To view the parameters to be specified when you call the relevant API operation to configure the DTS task, move the pointer over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters.
-
If you do not need to view or have viewed the parameters, 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, click View Details next to each failed item. After you troubleshoot the issues based on the error message, you can run a precheck again.
-
If an alert is generated for an item during the precheck, perform the following operations based on the scenario:
-
If an alert item cannot be ignored, click View Details next to the failed item and troubleshoot the issues. Then, run a precheck again.
-
If the alert item can be ignored, click Confirm Alert Details. In the View Details dialog box, click Ignore. In the message that appears, click OK. Then, click Precheck Again to run a precheck again. If you ignore the alert item, data inconsistency may occur and your business may be exposed to potential risks.
-
-
-
Purchase the instance.
-
Wait until Success Rate becomes 100%. Then, click Next: Purchase Instance.
-
On the Purchase page, specify the billing method of the change tracking instance. The following table describes the parameters.
Parameter
Description
Billing method
-
Subscription: You pay for your subscription when you create an instance. The subscription billing method is more cost-effective than the pay-as-you-go billing method for long-term use. You are offered lower prices for longer subscription durations.
-
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 a pay-as-you-go instance, you can release the instance to reduce costs.
Resource Group Settings
The resource group to which the instance belongs. Default value: default resource group. For more information, see What is Resource Management?
Subscription Duration
If you select the subscription billing method, set the subscription duration and the number of instances that you want to create. The subscription duration can be one to nine months, one year, two years, three years, or five years.
NoteThis parameter is available only if you select the Subscription billing method.
-
-
Read and select the Data Transmission Service (Pay-as-you-go) Service Terms.
-
Click Buy and Start to start the change tracking task. You can view the progress of the task in the task list.
-
What's next
After the task is running, create consumer groups and connect your downstream clients to consume the tracked data.
-
Connect a client to consume the tracked data: