Quantcast
Viewing latest article 26
Browse Latest Browse All 131

Restore of Database with CDC Failing

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 enabledfor Change Data Capture. The failure occurred when executing theaction 'drop function fn_cdc_get_all_changes_<capture_instance>'. Theerror returned was 3764: 'line 1, state 1, Cannot drop the tablevalued function'cdc.fn_cdc_get_all_changes_dbo_mytablename' because it isbeing used for Change Data Capture.'. Use the action and error todetermine 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?


Viewing latest article 26
Browse Latest Browse All 131

Trending Articles