Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while enabling CDC on table level

I am enabling Change data capture (CDC) on SQL server 2012 Enterprise edition(11.0.2100.60)

. I am able to enable it on Database level with below SQL, but failed to enable on Table level.

Use DatabaseName
GO

Exec sys.sp_cdc_enable_db 
GO

EXEC sys.sp_cdc_enable_table @source_schema = N'dbo'
                            ,@source_name = N'TableName'
                            , @role_name = NULL
GO

Got Error like,

'msg 22832, Level 16, State 1, Procedure sp_cdc_enable_table_internal, Line 623

Could not update the metadata that indicates table [dbo].[TableName] is enabled for Change Data Capture. The failure occurred when executing the command '[sys].[sp_cdc_add_job] @job_type = N'capture''. The error returned was 22836: 'Could not update the metadata for database DatabaseName to indicate that a Change Data Capture job has been added. The failure occurred when executing the command 'sp_add_jobstep_internal'. The error returned was 14234: 'The specified '@server' is invalid (valid values are returned by sp_helpserver).'. Use the action and error to determine the cause of the failure and resubmit the request.'. Use the action and error to determine the cause of the failure and resubmit the request.'

Would anyone help me to out of this?

Thanks in advance..!!

like image 679
Jaysukh Kalasariya Avatar asked May 31 '14 11:05

Jaysukh Kalasariya


People also ask

How do I enable CDC at database level?

Enable for a database This is done by running the stored procedure sys. sp_cdc_enable_db (Transact-SQL) in the database context. To determine if a database is already enabled, query the is_cdc_enabled column in the sys. databases catalog view.

How do you check if CDC is enabled for a table?

To check if CDC is enabled on a table, use the sys. sp_cdc_help_change_data_capture stored procedure.


1 Answers

I had the same problem recently.

In my opinion, it is highly probable that the name of the computer has changed. If it is true, read on ...

Name Changing the computer is automatically recognized by SQL. However, system metadata must be updated manually. (Source: http://msdn.microsoft.com/en-us/library/ms143799.aspx)

SQL Statement

sp_dropserver old_name\instancename;
GO
sp_addserver new_name\instancename, local;
GO

Example

sp_dropserver name-PC\SQLEXPRESS;
GO
sp_addserver CLT55\SQLEXPRESS, local;
GO

Reference problem and solution

like image 190
SergeyVoskoboynikov Avatar answered Oct 07 '22 12:10

SergeyVoskoboynikov