Skip to content

Latest commit

 

History

History
71 lines (51 loc) · 2.76 KB

sys-sp-cdc-disable-db-transact-sql.md

File metadata and controls

71 lines (51 loc) · 2.76 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sys.sp_cdc_disable_db (Transact-SQL)
Disables change data capture (CDC) for the current database.
markingmyname
maghan
randolphwest
06/13/2023
sql
system-objects
reference
sp_cdc_disable_db
sys.sp_cdc_disable_db_TSQL
sp_cdc_disable_db_TSQL
sys.sp_cdc_disable_db
sp_cdc_disable_db
sys.sp_cdc_disable_db
change data capture [SQL Server], disabling databases
TSQL

sys.sp_cdc_disable_db (Transact-SQL)

[!INCLUDE SQL Server]

Disables change data capture (CDC) for the current database. Change data capture isn't available in every edition of [!INCLUDE ssNoVersion]. For a list of features that are supported by the editions of [!INCLUDE ssNoVersion], see Editions and supported features of SQL Server 2022.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sys.sp_cdc_disable_db
[ ; ]

Return code values

0 (success) or 1 (failure).

Result set

None.

Remarks

sys.sp_cdc_disable_db disables change data capture for all tables in the database currently enabled. All system objects related to change data capture, such as change tables, jobs, stored procedures and functions, are dropped. The is_cdc_enabled column for the database entry in the sys.databases catalog view is set to 0.

If there are many capture instances defined for the database at the time change data capture is disabled, a long running transaction can cause the execution of sys.sp_cdc_disable_db to fail. This problem can be avoided by disabling the individual capture instances by using sys.sp_cdc_disable_table before running sys.sp_cdc_disable_db.

Permissions

Requires membership in the sysadmin fixed server role for change data capture on Azure SQL Managed Instance or SQL Server. Requires membership in the db_owner for Change Data Capture on Azure SQL Database.

Examples

The following example disables change data capture for the [!INCLUDE sssampledbobject-md] database.

USE AdventureWorks2022;
GO

EXECUTE sys.sp_cdc_disable_db;
GO

Related content