sys.sp_cdc_disable_db (Transact-SQL)

Applies to: SQL Server

Disables change data capture for the current database. Change data capture is not available in every edition of Microsoft SQL Server. For a list of features that are supported by the editions of SQL Server, see Features Supported by the Editions of SQL Server 2016.

Applies to: SQL Server ( SQL Server 2008 (10.0.x) through current version).

Transact-SQL syntax conventions

Syntax

sys.sp_cdc_disable_db  

Return Code Values

0 (success) or 1 (failure)

Result Sets

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.

Note

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 AdventureWorks2012 database.

USE AdventureWorks2012;  
GO  
EXECUTE sys.sp_cdc_disable_db;  
GO  

See Also

sys.sp_cdc_enable_db (Transact-SQL)
sys.sp_cdc_disable_table (Transact-SQL)