Restore of Database with CDC Failing
1
vote
1
answer
166
views
I'm taking a backup of a SQL Server 2019 database with CDC enabled, and trying to restore it to a different instance. I don't need CDC on target database so I don't have the "keep_cdc" option in the restore script. Despite this, I'm getting the following error:
> Could not upgrade the metadata for database mydbname that is enabled
> for Change Data Capture. The failure occurred when executing the
> action 'drop function fn_cdc_get_all_changes_'. The
> error returned was 3764: 'line 1, state 1, Cannot drop the table
> valued function
> 'cdc.fn_cdc_get_all_changes_dbo_mytablename' because it is
> being used for Change Data Capture.'. Use the action and error to
> determine the cause of the failure and resubmit the request.
The database seems to restore OK despite the error, but CDC is enabled when I look in sys.databases. When I try to disable cdc on the restored database I get following error:
> Could not update the metadata that indicates database mydbname is not enabled for Change Data Capture. The failure occurred when executing the command 'DROP TABLE dbo.systranschemas'. The error returned was 3764: 'Cannot drop the table 'dbo.systranschemas' because it is being used for Change Data Capture.'. Use the action and error to determine the cause of the failure and resubmit the request.
Any thoughts as to why this is happening despite the fact that I'm not including keep_CDC in the restore script? Any potential solutions?
Asked by Brian Layden
(11 rep)
Feb 14, 2025, 04:45 PM
Last activity: Jul 18, 2025, 05:07 AM
Last activity: Jul 18, 2025, 05:07 AM