Question

I am facing SQL Server Replication issue (Identity Management in a Pull Merge Replication at Subscriber).

Replication situation:

  • Distributor and the Publisher are in one server running Windows Server 2012 Std and SQL Server 2012 Std
  • One Subscriber PC running Windows 7 Professional and SQL Server 2012 Express Edition
  • Both are connected through the internet using VPN

The Problem:

Subscriber has an article (Table) [DocumentItems] where its Identity field [DocumentItemsID] is managed by Replication and was assigned the following range:

([DocumentItemsID]>(280649) AND [DocumentItemsID]<=(290649) OR [DocumentItemsID]>(290649) AND DocumentItemsID]<=(300649)

The server was disconnected from electricity several times. Every time the Subscriber PC is up, The [DocumentItemsID] field will pick an identity out of its range like 330035 when inserting new rows.

The issue happened 3 times. I fixed the problem by a manual reseed:

DBCC CHECKIDENT('DocumentItems' , RESEED, xxxx)

Where xxxx is the MAX existing value for [DocumentItemsID] + 1

Once the electricity is disconnected again, the same problem occurs.

Does anybody have any idea what is happening? And why the [DocumentItemsID] field was assigned values out of its range?

Thanks

Was it helpful?

Solution

OK, finally I knew what was going on.

It is an issue happening only in SQL Server 2012. when SQL Server instance is restarted, then table's Identity value is jumped (int will jump 1000, where big int will jump 10000).

To stop this increment, Register -t272 to SQL Server Startup Parameter.

This solved the problem.

Thanks to Code Project article by S. M. Ahasan Habib, I was totally in the dark when I read it.

For details on how to register the startup parameter, read the article. It shows how to reproduce the issue and provide 2 solutions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top