Transactional Replication Initialized from Backup

Answered Transactional Replication Initialized from Backup

  • Friday, November 16, 2012 7:40 PM
     
     

    Hello,

    I'm a replication noob.  I am attempting to setup Transactional Replication and Initialize the subscripber from a backup.  I get everything setup ok and everything starts okay but I will receive a "column name or number of supplied values does not match table definition" error once I start pushing through transactions.  I traced in out using profiler and found the transactions and objects causing the issues.  The schemas of the tables in question are the same.  Also, if I run the statement in SSMS against the subscriber it works just fine.  There are no identity fields that are causing any issues.  Also this seems to happen on multiple tables.  Any thoughts?

    Thank you!!

All Replies

  • Saturday, November 17, 2012 2:18 AM
    Moderator
     
     

    Can you tell me if it is up an update or insert statement giving you the problem?

    What you need to do is get the article ID for this problem table - query sysarticles for this

    select artid from sysarticles where dest_table='ProblemTableName'

    Then issue the following command:

    sp_scriptinsproc artID

    or

    sp_scriptsupdproc artid

    Now this will regenerate the replication stored procedures for you. Take the results and paste them into a query window on the subscriber and run them there.


    looking for a book on SQL Server 2008 Administration? http://www.amazon.com/Microsoft-Server-2008-Management-Administration/dp/067233044X looking for a book on SQL Server 2008 Full-Text Search? http://www.amazon.com/Pro-Full-Text-Search-Server-2008/dp/1430215941

  • Tuesday, November 20, 2012 9:24 PM
     
     
    It's an Insert statement.  It happens on most tables.   I found the SPs and can run them from SSMS as well as the insert statements by themselves.  All run successfully.   There's probably some step I'm missing in the initialization process.  If I initialize from snapshot then I don't get these errors and everything runs great.  I hate to abandon the idea of initializing from a BU, but if it's not working, and intitializing from a snapshot does...well...
  • Tuesday, November 20, 2012 10:35 PM
    Moderator
     
     
    Are you following the steps in Initialize a Transactional Subscription from a Backup?

    Brandon Williams (blog | linkedin)

  • Tuesday, November 20, 2012 10:52 PM
     
     
    Yeah,  I think so.  I'd run the sp_addsubscription andthe sp_addpushsibsciption_agent procedures.  I'd also check on the syncronization status and it would look like it was in process.  I'd verify it and all the table row counts would match up.   I'm thinking I never maunally fired of a syncronization and asumed it was happening automatically.  I also wonder if there were some issues with the indexes that would cause this issue.
  • Tuesday, November 20, 2012 10:55 PM
    Moderator
     
     
    Initializing from a backup definitely works.  You will need to follow every step in the document provided above.

    Brandon Williams (blog | linkedin)

  • Tuesday, November 20, 2012 11:46 PM
    Moderator
     
     Answered

    You may want to regenerate your insert proc.

    Get your article ID from sysarticles

    select artid from sysarticles where dest_Table='PRoblemTable'

    and then issue this call

    sp_scriptinsproc 15

    where 15 is the artid obtained from above, then paste the results in a new query window on the subscription database. and execute them. Then run your distribution agent again.


    looking for a book on SQL Server 2008 Administration? http://www.amazon.com/Microsoft-Server-2008-Management-Administration/dp/067233044X looking for a book on SQL Server 2008 Full-Text Search? http://www.amazon.com/Pro-Full-Text-Search-Server-2008/dp/1430215941