Azure SQL Data Sync fails for bulk data

Dheeraj 351 Reputation points
2020-06-23T09:02:59.587+00:00

I'm using Azure Data Sync to synchronize two databases

Everything was working fine until a few days ago when I inserted around 30 users in the Hub Database.
Since then I'm getting the following error.

Sync failed with the exception "GetStatus failed with exception:Sync worker failed, checked by GetStatus method.
Failure details:Sync was aborted because more than 30 changes failed to apply.
Examine your table schemas to look for conflicting constraints or incompatible data types that may prevent sync from succeeding.
Upload - errors for first 5 rows that failed to apply:
Error #1: SqlException Error Code: -2146232060 - SqlError Number:547, Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserClaims_dbo.AspNetUsers_UserId".
The conflict occurred in database "xxx", table "dbo.AspNetUsers", column 'Id'. SqlError Number:3621, Message: The statement has been terminated.
Error #2: SqlException Error Code: -2146232060 - SqlError Number:547, Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserClaims_dbo.AspNetUsers_UserId".
The conflict occurred in database "xxx", table "dbo.AspNetUsers", column 'Id'. SqlError Number:3621, Message: The statement has been terminated.
Error #3: SqlException Error Code: -2146232060 - SqlError Number:547, Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserClaims_dbo.AspNetUsers_UserId".
The conflict occurred in database "xxx", table "dbo.AspNetUsers", column 'Id'. SqlError Number:3621, Message: The statement has been terminated.
Error #4: SqlException Error Code: -2146232060 - SqlError Number:547, Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserClaims_dbo.AspNetUsers_UserId".
The conflict occurred in database "xxx", table "dbo.AspNetUsers", column 'Id'. SqlError Number:3621, Message: The statement has been terminated.
Error #5: SqlException Error Code: -2146232060 - SqlError Number:547, Message: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.AspNetUserClaims_dbo.AspNetUsers_UserId".
The conflict occurred in database "xxx", table "dbo.AspNetUsers", column 'Id'. SqlError Number:3621, Message: The statement has been terminated. "

I have gone through below links but could not find any answer.
sql-data-sync-data-replication-failing
azure-data-sync-error-the-insert-statement-conflicted-with-the-foreign-key-constraint

Below are properties:
10516-datasync-error.png

Azure SQL Database
Azure Firewall
Azure Firewall
An Azure network security service that is used to protect Azure Virtual Network resources.
674 questions
Azure SQL Edge
Azure SQL Edge
An Azure service that provides a small-footprint, edge-optimized data engine with built-in artificial intelligence. Previously known as Azure SQL Database Edge.
48 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mustafa Elmasry 76 Reputation points
    2020-07-01T22:41:06.31+00:00

    Can you check this post my be help you as configuration review
    https://mostafaelmasry.com/2020/05/27/azure-sql-database-data-sync-group/

    Mustafa EL-Masry
    Independent SQL Server Consultant, DB Performance Tuning Specialist, AZURE, Technical Author
    https://www.linkedin.com/in/mostafaelmasry/
    https://mostafaelmasry.com/
    http://www.sqlidol.com/
    M| +966 54 399 0968

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.