Bobcares

How to Enable CDC in RDS SQL Server?

by | Jun 9, 2024

Let’s discuss the quick steps to enable CDC in AWS RDS SQL Server in this post. At Bobcares, with our AWS Support Services, we can handle your issues.

Steps to Enable CDC in AWS RDS SQL Server

We can use Change Data Capture (CDC) to track real-time changes (inserts, deletes, updates) to databases and tables. This simplifies the data extraction processes. AWS RDS (Amazon Web Services Relational Database Service) for SQL Server is a managed database service that makes it easy to set up, operate, and scale SQL Server databases in the cloud. CDC in AWS RDS SQL Server tracks table changes, aiding in data auditing, ETL processes, and real-time analytics effortlessly.

To use CDC, we first enable it at the database level with EXEC sys.sp_cdc_enable_db;. Then, enable CDC on specific tables we want to monitor with EXEC sys.sp_cdc_enable_table @source_schema = N'dbo', @source_name = N'your_table', @role_name = NULL;. The changes are captured in CDC tables, which we can query to monitor and process data changes. Let’s see how to enable CDC in Amazon RDS for SQL Server in the following section:

1. Initially, we must make sure the SQL Server Agent is running.
enable cdc in rds sql server

2. Then, connect to the database as an admin user.

3. Now, run the following SQL command:

USE
GO
EXEC msdb.dbo.rds_cdc_enable_db ''
GO

4. For each table we want to track, run the following code:

USE
GO
EXEC sys.sp_cdc_enable_table
@source_schema = N'schema_name',
@source_name = N'table_name',
@role_name = N'role_name',
@supports_net_changes = 1 -- Use 0 for tables without primary keys
GO

5. Then, verify CDC is enabled by running the next code:

EXEC sys.sp_cdc_help_change_data_capture
GO

6. Ensure database.applicationIntent is set to ReadOnly on the read replica.

7. Lastly, we can use CDC with AWS Database Migration Service to provide continual replication from SQL Server DB instances.

[Need to know more? We’re available 24/7.]

Conclusion

CDC in RDS SQL Server simplifies tracking and integrating data changes, making it easier to maintain up-to-date data across various apps and systems. Here, we can see the simple steps to use CDC in RDS SQL Server from our Support team.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.