{
  "id": "aws-rds-sqlserver",
  "title": "Prepare Microsoft SQL Server on AWS RDS for RDI",
  "url": "https://redis.io/docs/latest/integrate/redis-data-integration/data-pipelines/prepare-dbs/aws-aurora-rds/aws-rds-sqlserver/",
  "summary": "Enable CDC features in your source databases",
  "tags": [
    "docs",
    "integrate",
    "rs",
    "rdi"
  ],
  "last_updated": "2026-04-01T08:10:08-05:00",
  "page_type": "content",
  "content_hash": "e7142791a53f801d4a2943410b06835fc1efba970010814c4e4932cc3e20cd67",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Follow the steps in the sections below to prepare a [Microsoft SQL Server on AWS RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_GettingStarted.CreatingConnecting.SQLServer.html) database to work with RDI.\n\n\nChange Data Capture (CDC) is not supported on SQL Server Express Edition. Only the Standard, Enterprise, and Developer editions support CDC and are supported by RDI.\n\n\n[code example]"
    },
    {
      "id": "create-the-debezium-user",
      "title": "Create the Debezium user",
      "role": "content",
      "text": "The Debezium connector needs a user account to connect to SQL Server. This\nuser must have appropriate permissions on all databases where you want Debezium\nto capture changes.\n\n[code example]\n\n1. <a id=\"connect-to-sql-server-as-an-admin-user\"></a>\n    Connect to your database as an admin user and create a new user for the connector:\n\n    [code example]\n\n    Replace `<username>` and `<password>` with a username and password for the new user and replace `<database>` with the name of your database.\n\n1. <a id=\"grant-the-user-the-necessary-permissions\"></a>\n    Grant the user the necessary permissions:\n\n    [code example]\n\n    Replace `<username>` with the username of the Debezium user and replace `<database>` with the name of your database."
    },
    {
      "id": "enable-cdc-on-the-database",
      "title": "Enable CDC on the database",
      "role": "content",
      "text": "Change Data Capture (CDC) must be enabled for the database and for each table you want to capture.\n\n[code example]\n\n1. <a id=\"enable-cdc-for-the-database\"></a>\n    Enable CDC for the database by running the following command:\n\n    [code example]\n\n    Replace `<database>` with the name of your database.\n\n1. <a id=\"enable-cdc-for-each-table-you-want-to-capture\"></a>\n    Enable CDC for each table you want to capture by running the following commands:\n\n    [code example]\n\n    Replace `<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. \n\n    \nThe value for `@role_name` can’t be a fixed database role, such as `db_datareader`. \nSpecifying a new name will create a corresponding database role that has full access to the\ncaptured change data.\n    \n\n1. <a id=\"add-the-debezium-user-to-the-cdc-role\"></a>\n    Add the Debezium user to the CDC role:\n\n    [code example]\n\n    Replace `<role>` with the name of the role you created in the previous step and replace `<username>` with the username of the Debezium user."
    }
  ],
  "examples": [
    {
      "id": "overview-ex0",
      "language": "checklist {id=\"rds-sqlserver-list\" nointeractive=\"true\" }",
      "code": "- [ ] [Create the Debezium user](#create-the-debezium-user)\n- [ ] [Enable CDC on the database](#enable-cdc-on-the-database)",
      "section_id": "overview"
    },
    {
      "id": "create-the-debezium-user-ex0",
      "language": "checklist {id=\"rds-sqlserver-create-debezium-user\" nointeractive=\"true\" }",
      "code": "- [ ] [Connect to SQL Server as an admin user](#connect-to-sql-server-as-an-admin-user)\n- [ ] [Grant the user the necessary permissions](#grant-the-user-the-necessary-permissions)",
      "section_id": "create-the-debezium-user"
    },
    {
      "id": "create-the-debezium-user-ex1",
      "language": "sql",
      "code": "USE master\n    GO\n    CREATE LOGIN <username> WITH PASSWORD = '<password>'\n    GO\n    USE <database>\n    GO\n    CREATE USER <username> FOR LOGIN <username>\n    GO",
      "section_id": "create-the-debezium-user"
    },
    {
      "id": "create-the-debezium-user-ex2",
      "language": "sql",
      "code": "USE master\n    GO\n    GRANT VIEW SERVER STATE TO <username>\n    GO\n    USE <database>\n    GO\n    EXEC sp_addrolemember N'db_datareader', N'<username>'\n    GO",
      "section_id": "create-the-debezium-user"
    },
    {
      "id": "enable-cdc-on-the-database-ex0",
      "language": "checklist {id=\"rds-sqlserver-enable-cdc\" nointeractive=\"true\" }",
      "code": "- [ ] [Enable CDC for the database](#enable-cdc-for-the-database)\n- [ ] [Enable CDC for each table you want to capture](#enable-cdc-for-each-table-you-want-to-capture)\n- [ ] [Add the Debezium user to the CDC role](#add-the-debezium-user-to-the-cdc-role)",
      "section_id": "enable-cdc-on-the-database"
    },
    {
      "id": "enable-cdc-on-the-database-ex1",
      "language": "sql",
      "code": "EXEC msdb.dbo.rds_cdc_enable_db '<database>'\n    GO",
      "section_id": "enable-cdc-on-the-database"
    },
    {
      "id": "enable-cdc-on-the-database-ex2",
      "language": "sql",
      "code": "USE <database>\n    GO\n    EXEC sys.sp_cdc_enable_table\n    @source_schema = N'<schema>',\n    @source_name   = N'<table>', \n    @role_name     = N'<role>',\n    @supports_net_changes = 0\n    GO",
      "section_id": "enable-cdc-on-the-database"
    },
    {
      "id": "enable-cdc-on-the-database-ex3",
      "language": "sql",
      "code": "USE <database>\n    GO\n    EXEC sp_addrolemember N'<role>', N'<username>'\n    GO",
      "section_id": "enable-cdc-on-the-database"
    }
  ]
}
