I work since weeks at following problem:
I created a MsSQL replication which works fine until a range_end is reached. Normaly the range_end should automaticly change to next_range_begin. In my application the users get following message:
and in the next replication log you can findFehler beim Einfügen. Es lag ein Konflikt mit einer Einschränkung für die Identitätsbereichsüberprüfung in der YYY-Datenbank in der replizierten Tabelle XXX vor. Falls die Identitätsspalte automatisch von der Replikation verwaltet wird, aktualisieren Sie den Bereich wie folgt: Führen Sie sp_adjustpublisheridentityrange für den Verleger und den Verteilungs-Agent oder den Merge-Agent für den Abonnenten aus.
after startingThe Publisher failed to allocate a new set of identity ranges for the subscription. This can occur when a Publisher or a republishing Subscriber has run out of identity ranges to allocate to its own Subscribers or when an identity column data type does not support an additional identity range allocation. If a republishing Subscriber has run out of identity ranges, synchronize the republishing Subscriber to obtain more identity ranges before restarting the synchronization. If a Publisher runs out of identit (Quelle: MSSQL_REPL, Fehlernummer: MSSQL_REPL-2147199417)
Hilfe abrufen: http://help/MSSQL_REPL-2147199417
Fehler beim Konvertieren des nvarchar-Datentyps in numeric. (Quelle: MSSQLServer, Fehlernummer: 8114)
Hilfe abrufen: http://help/8114
Code: Select all
sp_adjustpublisheridentityrange @publication = 'Repl_FMaQMa_SerNr'the problem is solved until I reach next time the range_end
Looking to the SQL profiler I found following:
Taking only two queries, one as source and one as target and insert for example 1100 records (range is for testing set to 1000) with
Code: Select all
with dmSerNr.dbquSerNr do
begin
dmSerNr.dbquSerNr_Insert.Open;
for iAnz := 1 to lAnzInsert do
begin
sSerNr := 'F01'+FormatDateTime('HHMMSSZZZ', now);
dmSerNr.dbquSerNr_Insert.Insert;
try
for j := 0 to FieldCount - 1 do
begin
sName:=LowerCase(Fields[j].FieldName);
if sName='sernr' then
dmSerNr.dbquSerNr_Insert.FieldByName('SerNr').Value := sSerNr
else if (sName'id') and (sName'rowguid') and (pos('def',sName)1) then
dmSerNr.dbquSerNr_Insert.FieldByName(sName).Value := Fields[j].Value;
end;
dmSerNr.dbquSerNr_Insert.Post;
except
dmSerNr.dbquSerNr_Insert.Cancel;
end;
end;
Code: Select all
Audit Login
-- network protocol: TCP/IP
set quoted_identifier on
set arithabort off
set numeric_roundabort off
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on
set cursor_close_on_commit off
set implicit_transactions off
set language Deutsch
set dateformat dmy
set datefirst 1
set transaction isolation level read committed
RPC:Completed
declare @p17 int
set @p17=6471555
exec sp_executesql N'INSERT INTO Ser_Nr
(SerNr, LiefID, Typ, BauDat, Status, ErstellerID, Dat, Info, ServOrt, ErstUserID, ErstDat, LastUserID, LastDat, Serial)
VALUES
(@P1, @P2, @P3, @P4, @P5, @P6, @P7, @P8, @P9, @P10, @P11, @P12, @P13, @P14)
SET @P15 = SCOPE_IDENTITY()',N'@P1 nvarchar(4000),@P2 int,@P3 nvarchar(4000),@P4 datetime2(7),@P5 nvarchar(4000),@P6 int,@P7 datetime2(7),@P8 nvarchar(4000),@P9 nvarchar(4000),@P10 int,@P11 datetime2(7),@P12 int,@P13 datetime2(7),@P14 nvarchar(4000),@P15 int OUTPUT',N'F01140310564',499,N'jhfjhfhj','2012-01-21 00:00:00',N'S',3,'2012-01-21 00:00:00',NULL,N'F',3,'2012-01-21 14:02:32.4890000',3,'2012-01-21 14:02:39.0390000',N'S',@p17 output
select @p17
Audit LogoutWhy the Audit Login Logout? I think, that that is the reason, why the range change fails.
My configuration:
Delphi XE Professional
UniDac 4.1.3
MsSQL 2008 R2
Best regards
Gerd