CATCHV Blog

Updatable Transaction replication Error 20515 20512 본문

Database/MS SQL

Updatable Transaction replication Error 20515 20512

catchv 2015. 4. 8. 17:03
반응형

Msg 20515, Level 16, State 1, Procedure sp_MSreplraiserror, Line 9
Updateable Subscriptions: Rows do not match between Publisher and Subscriber. Run the Distribution Agent to refresh rows at the Subscriber.
Msg 20512, Level 16, State 1, Procedure sp_MSreplraiserror, Line 8
Updateable Subscriptions: Rolling back transaction.
Msg 3609, Level 16, State 1, Procedure spAutoPrintList, Line 18
The transaction ended in the trigger. The batch has been aborted.

 

Updatable Transaction replication을 운영하다보면 위와 같은 에러로 replciation Article(table) 이 Insert, udpate, delete 가 안되는 경우가 발생을 한다.

 

Updatable Transaction replication은 msrepl_tran_version 이라는 컬럼을 생성하여 ROW의 버젼을 관리하는데

pub, sub에 동일한 Primary Key의 값을 가진 데이터가 있지만 msrepl_tran_version의 값이 다른 경우 위와 같은 문제가 발생한다.

 

이런 문제가 발생하는 이유는 SQL Server의 replication이 비동기이기 때문이다.

pub와 sub에 동시에 데이터를 입력 할 경우(동일한 PK를 가진) 문제 없이 Insert가 되며 msrepl_tran_version는 다른 값을 가져 충돌이 발생된다. Merge의 경우 conflict의 결과를 조회 가능하지만 Updatable은 나오지 않는다.

(보통 대략 1분 정도 안에 동기화하 진행된다.)

 

해결 방법은 subscription의 msrepl_tran_version으로 publication의 데이터를 update하면 된다.

 

 

 

 

반응형
Comments