Prepare Microsoft SQL Server on AWS RDS for RDI
Enable CDC features in your source databases
Follow the steps in the sections below to prepare a Microsoft SQL Server on AWS RDS database to work with RDI.
Create the Debezium user
The Debezium connector needs a user account to connect to SQL Server. This user must have appropriate permissions on all databases where you want Debezium to capture changes.
{ "$schema": "https://redis.io/schemas/checklist.json", "id": "rds-sqlserver-create-debezium-user", "items": [ { "name": "Connect to SQL Server as an admin user", "position": 1, "url": "#connect-to-sql-server-as-an-admin-user" }, { "name": "Grant the user the necessary permissions", "position": 2, "url": "#grant-the-user-the-necessary-permissions" } ], "type": "checklist" }-
Connect to your database as an admin user and create a new user for the connector:
USE master GO CREATE LOGIN <username> WITH PASSWORD = '<password>' GO USE <database> GO CREATE USER <username> FOR LOGIN <username> GOReplace
<username>and<password>with a username and password for the new user and replace<database>with the name of your database. -
Grant the user the necessary permissions:
USE master GO GRANT VIEW SERVER STATE TO <username> GO USE <database> GO EXEC sp_addrolemember N'db_datareader', N'<username>' GOReplace
<username>with the username of the Debezium user and replace<database>with the name of your database.
Enable CDC on the database
Change Data Capture (CDC) must be enabled for the database and for each table you want to capture.
{ "$schema": "https://redis.io/schemas/checklist.json", "id": "rds-sqlserver-enable-cdc", "items": [ { "name": "Enable CDC for the database", "position": 1, "url": "#enable-cdc-for-the-database" }, { "name": "Enable CDC for each table you want to capture", "position": 2, "url": "#enable-cdc-for-each-table-you-want-to-capture" }, { "name": "Add the Debezium user to the CDC role", "position": 3, "url": "#add-the-debezium-user-to-the-cdc-role" } ], "type": "checklist" }-
Enable CDC for the database by running the following command:
EXEC msdb.dbo.rds_cdc_enable_db '<database>' GOReplace
<database>with the name of your database. -
Enable CDC for each table you want to capture by running the following commands:
USE <database> GO EXEC sys.sp_cdc_enable_table @source_schema = N'<schema>', @source_name = N'<table>', @role_name = N'<role>', @supports_net_changes = 0 GOReplace
<database>with the name of your database,<schema>with the name of the schema containing the table,<table>with the name of the table, and<role>with the name of a new role that will be created to manage access to the CDC data.Note:The value for@role_namecan’t be a fixed database role, such asdb_datareader. Specifying a new name will create a corresponding database role that has full access to the captured change data. -
Add the Debezium user to the CDC role:
USE <database> GO EXEC sp_addrolemember N'<role>', N'<username>' GOReplace
<role>with the name of the role you created in the previous step and replace<username>with the username of the Debezium user.