0% found this document useful (0 votes)
401 views

Change Data Capture Error 14234

This document describes an error encountered when enabling Change Data Capture (CDC) on a SQL Server table. The error indicates a mismatch between the server name returned by SERVERPROPERTY('ServerName') and the server names in the master.sysservers table. The solution is to execute sp_dropserver and sp_addserver to update the sysservers table with the correct server name. Checks are provided to compare the server name values from SERVERPROPERTY and sysservers.

Uploaded by

FrancesHsieh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
401 views

Change Data Capture Error 14234

This document describes an error encountered when enabling Change Data Capture (CDC) on a SQL Server table. The error indicates a mismatch between the server name returned by SERVERPROPERTY('ServerName') and the server names in the master.sysservers table. The solution is to execute sp_dropserver and sp_addserver to update the sysservers table with the correct server name. Checks are provided to compare the server name values from SERVERPROPERTY and sysservers.

Uploaded by

FrancesHsieh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Change Data Capture Error 14234

SQL Server – Error While Enabling CDC on a Table The specified ‘@server’ is invalid (valid values are returned
by sp_helpserver)

Every environment is different and it is no doubt some of these environment changes can give you results that are
not expected. Recently one of my blog reader followed below blogs:
 SQL SERVER – Introduction to Change Data Capture (CDC) in SQL Server 2008
 SQL SERVER – Download Script of Change Data Capture (CDC)
and they reported that when he is trying to enable CDC for a table, he was getting below error:
Msg 22832, Level 16, State 1, Procedure sp_cdc_enable_table_internal, Line 623
Could not update the metadata that indicates table [HumanResources].[Shift] 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 AdventureWorks2014 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.

So the best way to learn these new things is by exploring the events how it happened. Below is the script he was
using (taken from my blog)
-- You can run this stored procedure in the context of each database to enable CDC at database level.

-- (The following script will enable CDC in AdventureWorks2014 database)

USE AdventureWorks2014

GO

EXEC sys.sp_cdc_enable_db

GO

-- Following script will enable CDC on HumanResources.Shift table.

USE AdventureWorks2014

GO

EXEC sys.sp_cdc_enable_table

@source_schema = N'HumanResources',

@source_name = N'Shift',

@role_name = NULL

GO

First command was working fine. Error was raised by second command. I asked him to capture the profiler and
share with me. I found that first SQL Server get instance name using below query:
SELECT @server = CONVERT(SYSNAME,SERVERPROPERTY('ServerName'))
The value is then passed to create the job for CDC. In procedure sp_verify_jobstep, below is the condition which
was failing.
IF (@server IS NOT NULL) AND

(NOT EXISTS (SELECT * FROM MASTER.dbo.sysservers WHERE (UPPER(srvname) = UPPER(@server))))

RAISERROR(14234, -1, -1, '@server', 'sp_helpserver')

Notice that this is the same error in error message (which I have highlighted) I asked him to check and he verified
that SQL Server name was changed but sp_dropserver and sp_addserver was not executed. Here is the command to
fix the issue. Please change the parameter values as per your SQL Instance.
sp_dropserver 'HostName\InstanceName_incorrect'

GO

sp_addserver 'HostName\InstanceName', 'local'

GO

In short, error is caused due to mismatch in value


between SERVERPROPERTY(‘ServerName’)) and master.dbo.sysservers

The error is caused due to mismatch in value between SERVERPROPERTY(‘ServerName’)) and


master.dbo.sysservers.

Check these SQLs:


SELECT * FROM master.dbo.sysservers

SELECT SERVERPROPERTY('ServerName')

If your SERVERPROPERTY('ServerName') is not any of the sysservers, then the fix is to change your computer
name to match one of those.

SELECT @@SERVERNAME, SERVERPROPERTY('ServerName')

GO

sp_dropserver 'ABC'

GO

sp_addserver 'XYZ', 'local'

GO

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy