SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


ALTER TABLE breaks replication


ALTER TABLE breaks replication

Author
Message
DR_DBA
DR_DBA
SSC Veteran
SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)

Group: General Forum Members
Points: 206 Visits: 314
I have a table-article being replicated as part of a publication that replicates DDL commands. Historically, executing ALTER statements on replicated tables has not caused any problems.

However, I recently executed the following ALTER:
ALTER TABLE my_table ADD my_column INT NULL DEFAULT(0)



I immediately started receiving the following error on one subscriber:
Procedure or function 'sp_MSupd_mytable' expects parameter '@pkc1', which was not supplied.


And this error on another subscriber:
rocedure or function 'sp_MSins_mytable' expects parameter '@c7', which was not supplied.



I was under the impression the sp_MS-stored procs would update automatically to reflect schema changes and that there shouldn't be any problem if the Log Reader is processing changes as it should. Anything jump out as the specific cause of this problem? Let me know if I can provide any other information that would help.

Thanks
DR_DBA
DR_DBA
SSC Veteran
SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)

Group: General Forum Members
Points: 206 Visits: 314
The article has "Copy check contraints" set to False. This ALTER would certainly add a constraint to default new values to 0. It seems to me that the Log Reader should just end up picking up the ALTER and applying the change on subscribers, resulting in a new constraint on the downstream DBs. Just thinking out loud about the possibility of a conflict between the article properties and what the subscribed servers would end up doing.
Neeraj Dwivedi
Neeraj Dwivedi
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2081 Visits: 1341
If you make Schema changes to Publisher they are propagated to Subscriber by default, unless set otherwise while creating replication.

So as you said, you can wait if it resolves the issue by self, else you can manually modify the SPs in question on the subscriber DB.
Neeraj Dwivedi
Neeraj Dwivedi
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2081 Visits: 1341
Just observed one more thing. your default in not named. Always create named defaults if you are using replication. It creates issue if you drop or alter defaults.
Bhaskar.Shetty
Bhaskar.Shetty
Ten Centuries
Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)Ten Centuries (1.2K reputation)

Group: General Forum Members
Points: 1152 Visits: 509
Check the setting of Copy INSERT, UPDATE, DELETE stored procedures for this article should be set to true.
DR_DBA
DR_DBA
SSC Veteran
SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)

Group: General Forum Members
Points: 206 Visits: 314
I don't think the problem would "resolve itself" unless I had manually modified those SPs. Strangely enough "Copy INSERT, UPDATE and DELETE stored procedures" is set to True so I'm not sure why they didn't update automatically
DR_DBA
DR_DBA
SSC Veteran
SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)SSC Veteran (206 reputation)

Group: General Forum Members
Points: 206 Visits: 314
I did read here http://msdn.microsoft.com/en-us/library/ms151870.aspx that naming the constraint is recommended. Just wish I knew if that is the cause of the original problem. Thanks for your replies
Neeraj Dwivedi
Neeraj Dwivedi
SSCrazy
SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)SSCrazy (2.1K reputation)

Group: General Forum Members
Points: 2081 Visits: 1341
No. Named constrains will cause problem only when they are either altered or deleted at publisher.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search