Points to consider and comments
for more than 9 servers to be managed at the same replicated environment.
identity ranges have to be selected carefully to assure the max value of the
range is never reached.
is suggested to monitor the identity values so you know a head if any table is
about to reach the max range value
the ranges requires knowing the activity on site and taking into account future
growth and you may need to modify int data type columns to bigint to allow for
ranges to exceed the 2^32 figure supported by the int data type.
new table that has an identity column added to the replication has to be seeded
(a one time event) to match the range for the given server using the DBCC
CHECKIDENT command (see the accompanied scripts). A failure to do so results in
a PRIMARY KEY Violation error until the situation is corrected.
more maintenance / management and is prone to more errors.
- Limited for up to 9 servers to be managed at the same replicated
new table that has an identity column added to the replication has to be
created using a slightly different command because of the identity seed and
increment values and this can effect the way you load
versions to your servers because of the differences in the schema scripts.
method is safer – once the table is correctly created there is no additional maintenance
/ management and points of failure.
if you need to modify int data type columns to bigint to assure the int data
type 2^32 figure is never reached.
Scripts in this article:
All three scripts can be downloaded
assume the existence of a database called PerfDB.
procedures are designed to be executed from a monitoring tool periodically. i.e. daily or every few hours.
procedure MonitorReplicationIdentityRange works on all published
databases on the given sql server instance and checks for any identity column with
a seed (not a value) falling outside the predefined identity range of the given
server. Any such table that is found is logged to table IdentityRangeLog
and then the logged/ inserted data is retrieved and returned to the calling
application. In case the calling application is a monitoring tool you send the
returned results set in a notification email.
procedure is executed with the @Reseed input parameter set to 1 (true) then
it calls the procedure SetReplicationIdentityRange that makes the seed
correction/ modification to match the range of the given server.
— Excecute the
procedure in a read-only mode: @Reseed = 0
— Find identity
seeds that fall outside the predefined range but no modification takes place.
EXEC PerfDB.dbo.MonitorReplicationIdentityRange @Reseed = 0;
— Excecute the procedure in a read-write mode.
— Find identity seeds that fall outside the predefind range and modify
the seed to the correct value within the range.
EXEC PerfDB.dbo.MonitorReplicationIdentityRange @Reseed = 1;