SS2K5 Errors in transactional replication

Last post 11-13-2008, 8:48 AM by timothyawiseman@gmail.com. 5 replies.
Sort Posts: Previous Next
  •  11-05-2008, 8:51 AM Post number 70353

    SS2K5 Errors in transactional replication

    Hi all,

    I have a very interesting ss2K5 problem, which I am currently bypassing in hope of a solution. 

    My topology:

    •  1 publication database in SS2K (600GB)
    • 2 SS2K pull read-only subscribers
    • Replication is occurring via a SS2K5 distributer.
    • Replication is read-only one-way transactional (non-updating)

    My settings:

    • The publication setting is currently:

    Subscriptions never expire

    • Articles copy clustered and non-clustered indexes, and drop and create new objects, copy insert, update and delete sp's.
    • Snapshot = Native SQL
    • Subscriptions = Allow pull transactions

    Agent profiles:

    •  Currently added skip errors (2601:2627:20598) to -skiperrors

    And herein lies my problem.  I am getting a huge number of errors relating to 'row not found at Subscriber when applying replicated command. (Error: 20598)'.

    This exact configuration was working perfectly when the environment was totally SS2K but now we have a mixed environment and they system is failing. This is the reason for the skip errors flags being set.

     Do you have any idea as to why these errors are occurring and how to solve them.

    Kind regards

    James.

  •  11-05-2008, 5:12 PM Post number 70364 in reply to post number 70353

    Re: SS2K5 Errors in transactional replication

    jamescool:

    And herein lies my problem.  I am getting a huge number of errors relating to 'row not found at Subscriber when applying replicated command. (Error: 20598)'.

    This exact configuration was working perfectly when the environment was totally SS2K but now we have a mixed environment and they system is failing. This is the reason for the skip errors flags being set.

     Do you have any idea as to why these errors are occurring and how to solve them.

    Kind regards

    James.



    The only time I have seen that error before is when someone has done deletes on the subscriber side and removes rows that later get updated on the publisher side.  So, you may want to ensure that no one is changing the data on the subscriber side.

    Another possibility, though not one I have seen personally, is if rows were created on the publisher and the creation did not get replicated for some reason but later the update statement did replicate.

    For both of those, the easiest fix is to reinitialize from a snapshot and validate often.  With a 600GB database reinitializing may take some time, so if you cannot wait, there are other tools that can help you bring them back into synch without doing a full reinitializaton.

    For validating, what I do personally is use this script I wrote:
    Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

    alter procedure ValidateDbPublications

          @dbname sysname /*should not be bracketed, quotename is used in procedure */

    as

     

    /* Sample:

     

    sp_msforeachdb '

     

    execute ValidateDbPublications ''?''

    '

     

    execute ValidateDbPublications 'querytrackingv2'

    */

     

    /*

    This will execute sp_publication_validation against every publication in a database.

     

    It can be used in conjunction with sp_msforeachdb to execute it against every active publication in a server.

     

    This is designed to use with SQL Server 2005 only.

    */

     

    /************************ Variables ****************************************/

    Declare

          @HasRepl bit,

          @nsql nvarchar(4000), /* Used for dynamic SQL */

          @nsql2 nvarchar(max) /* Used for dynamic sql generated within dynamic sql.*/

    /***************************************************************************/

     

    /* Make sure the database exists */

    if not exists (select * from sys.databases where name = @dbname)

    BEGIN

          RAISERROR(

                N'The database specified does not exist', /* Message */

                12, /*Severity */

                1 /*State */)

           RETURN 1

    END

     

    /* This helps shield against sql injection, as well as names that require quotes */

    set @dbname = quotename(@dbname)

         

    /******************** Check to ensure it has replication*********************************/

     

    set @nsql = N'

          if exists (select * from ' + @dbname + '.information_schema.tables where table_name = ''syspublications'')

                set @HasRepl = 1

          Else

                set @hasRepl = 0

                '

               

    exec sp_executesql

          @nsql,

          N'@HasRepl bit OUTPUT',

          @HasRepl OUTPUT

         

    if @HasRepl = 0

    BEGIN

          print 'The database ' + @dbname + ' does not have replication enabled. Exiting Procedure.'

          RETURN

    END

     

    /* From here forward the replication is assumed.  There is no if statement, but it will not reach this point if it is not enabled. */

     

    set @nsql = '

         

          select @nsql2 =

                ''exec ' + @dbname + '.sys.sp_publication_validation  '''''' + name +''''''''

          from

                ' + @dbname + '.dbo.syspublications'

     

     exec sp_executesql

          @nsql,

          N'@nsql2 nvarchar(max) OUTPUT',

          @nsql2 OUTPUT

         

    exec (@nsql2)


    And I have it in a job that runs it using the undocumented stored procedure sp_msforeachdb.  That way it will issue a validation command for every database that has a publication and ignore the others.

    Of course, that is most useful if you have alerts set up to notify you if a validation fails.

    I hope this helps.

    TimothyAWiseman@gmail.com
  •  11-06-2008, 9:05 AM Post number 70371 in reply to post number 70364

    Re: SS2K5 Errors in transactional replication

    Hi Tim,

    Thanks for your response.  That is a great script, and I will put it to good use.  But I am very concerned that at this point in time, there is no other user that has access to the subscriptions!  So the updating of the subscriber is only being done by the distribution agent!

    I have noticed that when my achitecture was only on a SS2K platform the @schema_option = 0x00000000000000F3, in SS2K5 the @schema_option = 0x00000000000080F3.  Otherwise, when you script and compare the two replications everything else is exactly the same.

    I am not sure if the 0x8000 (Generates ALTER TABLE statements when scripting constraints) setting is causing the problem!

    Kind regards

    James

  •  11-08-2008, 1:08 PM Post number 70397 in reply to post number 70371

    Re: SS2K5 Errors in transactional replication

    I can't imagine how 0x8000 would cause the problem you are describing.

    This is probably pretty unlikely, do you have any filters on the rows passed?  Its possible that the insert statement was filtered out, but the update statement was not, though you would have to be doing some rather unusual things to get to that point.
  •  11-10-2008, 3:10 AM Post number 70400 in reply to post number 70397

    Re: SS2K5 Errors in transactional replication

    Hi

    I have now recreated the replication from scratch with the same settings, except I am using a push replication. Touch wood - I have not experienced and errors! 

    I wonder if the problem has something to do with the fact I was using a Pull Subscription and the server that was "pulling" was a SS2K server?

    Regards

    James

  •  11-13-2008, 8:48 AM Post number 70470 in reply to post number 70400

    Re: SS2K5 Errors in transactional replication

    Well, hopefully you don't get any errors this way.

    It is certainly possible it had something to do with the subscriber being set in pull mode, but I have had similar set ups without running into that particular problem.
View as RSS news feed in XML