このページは、お客様の言語ではご利用いただけません。Huawei Cloudは、より多くの言語バージョンを追加するために懸命に取り組んでいます。ご協力ありがとうございました。

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Configuring SQL Server CDC

Updated on 2024-12-10 GMT+08:00

Overview

Change Data Capture (CDC) enables ROMA Connect to synchronize data with data sources and physically delete data tables in real time.

This section describes how to enable the CDC function for the SQL Server database.

Prerequisites

Procedure

It is recommended that the database administrator configure the CDC function. The following uses the Windows environment as an example.

  1. Enable CDC.
    1. Use the SSMS client to connect to the server where the SQL Server database is located, and log in to the database as user sa.

      Password indicates the password of user sa of the database. You can obtain the password from the database administrator.

    2. Click New Query and select the database for which you want to enable CDC. Run the following command to start CDC for the SQL Server database:
      if exists(select 1 from sys.databases where name='fdiromatest' and is_cdc_enabled=0)
      begin
          exec sys.sp_cdc_enable_db
      end

      Replace fdiromatest with the actual database name.

    3. Run the following command to check whether CDC is successfully enabled. If 1 is displayed, CDC is successfully enabled.
      select is_cdc_enabled from sys.databases where name='fdiromatest'

      Replace fdiromatest with the actual database name.

    4. Enable the table-level configuration.
      IF EXISTS(SELECT 1 FROM sys.tables WHERE name='baris' AND is_tracked_by_cdc = 0)
      BEGIN
          EXEC sys.sp_cdc_enable_table
              @source_schema = 'dbo', -- source_schema
              @source_name = 'baris', -- table_name
              @capture_instance = NULL, -- capture_instance
              @supports_net_changes = 1, -- supports_net_changes
              @role_name = NULL -- role_name
      END

      Replace baris with the name of the table for which CDC needs to be enabled.

    5. Run the following command to query the execution result. If the result is 1, the operation is successful.
      SELECT is_tracked_by_cdc FROM sys.tables WHERE name='baris'

      Replace baris with the name of the table for which CDC needs to be enabled.

      After CDC is created, the system creates a series of system catalogs, views, stored procedures, and jobs to implement CDC functions.

  2. After the CDC is configured, you need to create a user and assign permissions to the user.
    1. Right-click Security and choose New > Login from the shortcut menu.
    2. On the General page, enter the created username and password.

      Select SQL Server authentication and enter the password.

    3. On the Server Roles page, select dbcreator and public.
    4. On the User Mapping page, select the users and database role members that are mapped to this login.
      1. In the Users mapped to this login area, select the database for which you want to configure CDC, for example, fdiromatest.
      2. In the Database role membership for area, select db_datareader, db_owner, and public.
    5. Click OK.

Follow-Up Operations

If the system table structure changes or the table level is adjusted, you need to enable CDC again. The configuration procedure is as follows:

  1. Disable CDC and set schema and name based on the site requirements.
    EXEC sys.sp_cdc_disable_table 
     @source_schema = N'dbo',
     @source_name = 'baris', 
     @capture_instance ='all'
  2. Enable CDC again and set schema and name based on the site requirements.

    Enable the table-level configuration.

    IF EXISTS(SELECT 1 FROM sys.tables WHERE name='baris' AND is_tracked_by_cdc = 0) 
     BEGIN 
         EXEC sys.sp_cdc_enable_table 
             @source_schema = 'dbo', -- source_schema 
             @source_name = 'baris', -- table_name 
             @capture_instance = NULL, -- capture_instance 
             @supports_net_changes = 1, -- supports_net_changes 
             @role_name = NULL -- role_name 
     END

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback