Skip to content

Instantly share code, notes, and snippets.

@timweigel
timweigel / Modify_change_tracking.sql
Created Aug 12, 2019
Script to modify database-level change tracking settings in SQL Server
View Modify_change_tracking.sql
ALTER DATABASE CT_Demo
SET CHANGE_TRACKING
(CHANGE_RETENTION = 14 DAYS, AUTO_CLEANUP = ON);
@timweigel
timweigel / Disable_change_tracking.sql
Last active Aug 12, 2019
Statement to disable change tracking
View Disable_change_tracking.sql
ALTER DATABASE CT_Demo
SET CHANGE_TRACKING = OFF;
@timweigel
timweigel / Kendra_Little_better_change_tracking_script_brent_ozar.sql
Last active Aug 12, 2019
Kendra Little's better script to review change tracking
View Kendra_Little_better_change_tracking_script_brent_ozar.sql
-- Kendra Little made this; posted at https://www.brentozar.com/archive/2014/06/performance-tuning-sql-server-change-tracking/
SELECT db.name AS change_tracking_db,
is_auto_cleanup_on,
retention_period,
retention_period_units_desc
FROM sys.change_tracking_databases AS ct
JOIN sys.databases AS db
ON ct.database_id=db.database_id;
GO
@timweigel
timweigel / Enable_change_tracking.sql
Last active Aug 12, 2019
Statement to enable change tracking on SQL Server
View Enable_change_tracking.sql
ALTER DATABASE CT_Demo
SET CHANGE_TRACKING = ON
(CHANGE_RETENTION = 30 DAYS, AUTO_CLEANUP = ON);
You can’t perform that action at this time.