SOLVED

Possiblity of excluding CDC tables from Backup

Copper Contributor

After we enable CDC on our database server, the size of backup file increases by a large percentage.

I would like to ask if we can exclude CDC tables from backup procedure.

Thanks.

2 Replies

@Boyee_Wu , no, it's impossible to exclude anything from a database backup.

A backup is always a complete and exact 1:1 copy of the database.

 

Olaf

best response confirmed by Boyee_Wu (Copper Contributor)
Solution

Hi @Boyee_Wu 

 

Change data capture (CDC) uses the SQL Server agent to record insert, update, and delete activity that applies to a table. CDC depend on the log reader agent to read the active part of the SQL Server Transaction Log associated with the changes. These SQL Transaction Log records will be in pending state until these tracked changes are replicated to the tracking tables.

 

In many cases the transaction logs are pending for long time and can’t be truncated due to slow log reader agent activities. This is a problem you may face if you configure SQL Server Replication or Change Data Capture (CDC) features in your database. The direct result is that your backup is bigger since you need to backup all these information.

 

Note! check that the CDC capture job is running and tracking changes.

 

If you do not need the CDC to track old changes and you are OK with stop it then you can disable the CDC before the backup and enable it again after - obviously you will lose the functionality of the CDC (not recommended probably in most cases).

 

Execute the following query can help find issues delaying the truncation of transaction log which mean that your full backup will probably be bigger. You need to monitor the reason for such big backup file since CDC by itself is not something that must end with such behavior. In some cases you simply need to have more log backups and as mentioned above it can be related to an issue.

 

SELECT name AS Database_Name,log_reuse_wait_desc
FROM sys.databases
GO

 

 

You can search more deeper posts about log_reuse_wait_desc

1 best response

Accepted Solutions
best response confirmed by Boyee_Wu (Copper Contributor)
Solution

Hi @Boyee_Wu 

 

Change data capture (CDC) uses the SQL Server agent to record insert, update, and delete activity that applies to a table. CDC depend on the log reader agent to read the active part of the SQL Server Transaction Log associated with the changes. These SQL Transaction Log records will be in pending state until these tracked changes are replicated to the tracking tables.

 

In many cases the transaction logs are pending for long time and can’t be truncated due to slow log reader agent activities. This is a problem you may face if you configure SQL Server Replication or Change Data Capture (CDC) features in your database. The direct result is that your backup is bigger since you need to backup all these information.

 

Note! check that the CDC capture job is running and tracking changes.

 

If you do not need the CDC to track old changes and you are OK with stop it then you can disable the CDC before the backup and enable it again after - obviously you will lose the functionality of the CDC (not recommended probably in most cases).

 

Execute the following query can help find issues delaying the truncation of transaction log which mean that your full backup will probably be bigger. You need to monitor the reason for such big backup file since CDC by itself is not something that must end with such behavior. In some cases you simply need to have more log backups and as mentioned above it can be related to an issue.

 

SELECT name AS Database_Name,log_reuse_wait_desc
FROM sys.databases
GO

 

 

You can search more deeper posts about log_reuse_wait_desc

View solution in original post