Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a replication scheme that was created several months ago. Since that time the schema has had a variety of changes. All existing subscriptions were updated as these changes were made as the publication is set to push schema changes as well.

Recently however when trying to add a new subscription the initial snapshot fails to apply. The cause of the error is that two different views fail to apply as tables they rely on have not been created by the snapshot yet.

I know that I can specify processing order of articles via the sp_changemergearticle stored procedure. But as I understand... the processing order setting here is for specifying the order in which data changes are applied to subscribers during sync. Is there a way to specify the order in which articles are applied when a new subscription is initialized? Does it use the same setting?

I figured that generating a new snapshot would cause the engine to figure out the proper order but in the case of my current publication it did not. The new subscription fails to apply the snapshot even after I have generated a new snapshot. It tells me the exact script that fails and when applying by hand it's obvious that it's failing because a table needed by the view does not yet exist.

What is the best way to fix this? Does setting the processing order of an article affect the schema order as well as the data order or do I need to look somewhere else to set the order that articles are built on new subscriptions.

From what I can tell the processing order setting has no effect whatsoever on the order in which the snapshot applies its articles during initialization. Mostly because currently all my articles have a value of 0 for their processing order. So, is this something I can control or am I at the mercy of the snapshot generation process?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

Yes, utilizing sp_changemergearticle to change the processing order will alleviate this issue.

share|improve this answer
add comment

I have the same question, very well exposed by Thomas. As far as I know, processing order doesn't make any difference on snapshot schema order, but only in data applying order.

I think that the schema is applyed in the same order than the articles are added to the publication. I'am not sure and would appreciate a confirmation of this.

Numbers added at the end of .SCH files could be a track to understand the logic behind the snapshot constitution and application.

share|improve this answer
    
Please do now post questions as answers. Your "answer" would be a better fit as a comment on the original question. –  trygvis Dec 5 '12 at 13:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.