Skip to content

Commit f51d70e

Browse files
Merge pull request #23887 from abhimantiwari/main
Added CDC usage guidelines and max row cap in sys.dm_cdc_log_scan_sessions DMV
2 parents d75ccbf + bd63804 commit f51d70e

2 files changed

Lines changed: 22 additions & 3 deletions

File tree

docs/relational-databases/system-dynamic-management-views/change-data-capture-sys-dm-cdc-log-scan-sessions.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ dev_langs:
4949
|**failed_sessions_count**|**int**|Number of sessions that failed.|
5050

5151
## Remarks
52-
The values in this dynamic management view are reset whenever the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] is started.
52+
53+
The `sys.dm_cdc_log_scan_sessions` can contain up to 32 scan sessions and an aggregate of all the scan sessions with `session_id= 0`. So, at any given time, this dynamic management view can contain a maximum of 33 rows.
54+
55+
The values in this dynamic management view are reset whenever the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] is restarted or a failover (local & GeoDR) occurs.
5356

5457
## Permissions
5558
Requires VIEW DATABASE STATE permission to query the `sys.dm_cdc_log_scan_sessions` dynamic management view. For more information about permissions on dynamic management views, see [Dynamic Management Views and Functions (Transact-SQL)](~/relational-databases/system-dynamic-management-views/system-dynamic-management-views.md).

docs/relational-databases/track-changes/about-change-data-capture-sql-server.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,22 @@ CREATE TABLE T1(
192192

193193
Sysadmin permissions are required to enable change data capture for SQL Server or Azure SQL Managed Instance. The db_owner role is required to enable change data capture for Azure SQL Database.
194194

195+
## General guidelines
196+
197+
For Change data capture (CDC) to function properly, you shouldn't modify any CDC metadata such as CDC schema, CDC system stored procedures, default `cdc` user permissions ([`sys.database_principals`](../system-catalog-views/sys-database-principals-transact-sql.md)) or rename `cdc` user.
198+
199+
Any objects in [sys.objects](../system-catalog-views/sys-objects-transact-sql.md) with `is_ms_shipped` property set to `1` shouldn't be modified.
200+
201+
```sql
202+
SELECT name AS object_name
203+
,SCHEMA_NAME(schema_id) AS schema_name
204+
,type_desc
205+
,is_ms_shipped
206+
FROM sys.objects
207+
WHERE is_ms_shipped= 1
208+
209+
```
210+
195211
## Limitations
196212

197213
Change data capture has the following limitations:
@@ -217,10 +233,10 @@ Configuring the frequency of the capture and the cleanup processes for CDC in Az
217233
CDC does not support the values for computed columns even if the computed column is defined as persisted. Computed columns that are included in a capture instance always have a value of `NULL`. This behavior is intended, and not a bug.
218234

219235
**Point-in-time restore (PITR)**
220-
If you enable CDC on your database as an Microsoft Azure Active Directory (Azure AD) user, it is not possible to Point-in-time restore (PITR) to a sub-core SLO. It is recommended that you restore the database to the same as the source or higher SLO, and then disable CDC if necessary.
236+
If you enable CDC on your database as a Microsoft Azure Active Directory (Azure AD) user, it is not possible to Point-in-time restore (PITR) to a sub-core SLO. It is recommended that you restore the database to the same as the source or higher SLO, and then disable CDC if necessary.
221237

222238
**Microsoft Azure Active Directory (Azure AD)**
223-
If you create a database in Azure SQL Database as an Microsoft Azure Active Directory (Azure AD) user and enable change data capture (CDC) on it, a SQL user (for example, even sysadmin role) won't be able to disable/make changes to CDC artifacts. However, another Azure AD user will be able to enable/disable CDC on the same database.
239+
If you create a database in Azure SQL Database as a Microsoft Azure Active Directory (Azure AD) user and enable change data capture (CDC) on it, a SQL user (for example, even sysadmin role) won't be able to disable/make changes to CDC artifacts. However, another Azure AD user will be able to enable/disable CDC on the same database.
224240

225241
Similarly, if you create an Azure SQL Database as a SQL user, enabling/disabling change data capture as an Azure AD user won't work.
226242

0 commit comments

Comments
 (0)