locked
How to reset sync anchors and start fresh? RRS feed

  • Question

  • Hi All

    Busy going through the new sync tech and was wondering how to reset the sync anchors. I am working with a test db and would like to clear all the data and start a fresh sync.


    Any tips greatly appreciated.

    Chev
    • Moved by Hengzhe Li Friday, April 22, 2011 5:42 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Saturday, January 10, 2009 7:52 AM

All replies

  • before jumping into how to "start fresh", we'd better to understand the scenario:

    I assumed you are using the hub-spoke ( or server-client) case:

     

    1. is this a snapshot sync sceanrio, or a bidirectional one ? snapshot sync direction doesn't require any tracking on either server nor client side, so you don't need to reset the anchors

    2. do you just want to refresh one client or all of you clients, is server needs to be refreshed ? resetting the anchor on server could affect the future syncs if you have mutiple clients.

    3. are you using sql server change tracking ?

     

    Thanks

    Yunwen

    Monday, January 12, 2009 6:59 PM
    Moderator
  • hi all,

    I am also facing the same Scenario where i have to reset the sync anchors and start using it fresh.
    using a Oracle Server and SQL Ce Client
    Bi-Directional Sync and Not Change Tracking is used.

    I tried to use the system created tables like syssyncarticles and SyssyncSubscriptions but nothing is happening.

    Just want to clear the Anchors so that i can download and upload data back

    Thanks in Advance
    Regards
    Biju

    Tuesday, February 3, 2009 2:52 PM
  • The below code should reset the Received anchor on the client for a given table ("orders" in the sample).  Before running the code, first delete all the data out of the client's table.

     

    1                 // Before executing this code, execute "delete orders" query   
    2                 // to remove all existing rows.  
    3                 // Reset the received anchor to redownload the data for this table  
    4                 clientSyncProvider.SetTableReceivedAnchor("orders"new SyncAnchor((byte[])null));  
    5                   
    6                 // Use AcceptChanges so changes to the previous data are not uploaded  
    7                 clientSyncProvider.AcceptChanges("orders");  
    8  

    Let me know if you have any questions-
    Wednesday, February 4, 2009 5:31 PM
  • hi phil,

    Thanks for the code.
    I tried to use the SQLCEClientProvider and implement the mentioned code,  i am getting the following error:

    Microsoft.Synchronization.Data.MetadataException: Internal Error: Unable to set 'ReceivedAnchor' for '[orders]' in system tables in the client database. Check the inner exception for more details. ---> The conversion is not supported. [ Type to convert from (if known) = nvarchar, Type to convert to (if known) = image ]

    The Code we have used out here as follows:

    clientsyncprovider.SetTableReceivedAnchor("orders"new SyncAnchor((byte[])null)); 
    clientsyncprovider.AcceptChanges("orders");

    Thanks in Advance
    Regds
    Biju

    Thursday, February 5, 2009 2:05 PM
  • Biju-

    Could you pass along the stack trace of the exception?  Thanks-
    Thursday, February 5, 2009 5:24 PM
  • hi phil,

    Pl. find the stack trace out here for the error:

    ex.StackTrace

    ex.StackTrace
    "   at Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider.SetTableAnchorInternal(String tableName, SyncAnchor anchor, String anchorType)\r\n   at Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider.SetTableReceivedAnchor(String tableName, SyncAnchor anchor)\r\n   at SyncApp.AppMobile.HomeUI.mnitLogout_Click(Object sender, EventArgs e)\r\n   at System.Windows.Forms.MenuItem.OnClick(EventArgs e)\r\n   at System.Windows.Forms.Menu.ProcessMnuProc(Control ctlThis, WM wm, Int32 wParam, Int32 lParam)\r\n   at System.Windows.Forms.Form.WnProc(WM wm, Int32 wParam, Int32 lParam)\r\n   at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)\r\n   at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)\r\n   at System.Windows.Forms.Application.Run(Form fm)\r\n   at SyncApp.AppMobile.Program.Main()\r\n"



    Ex.Inner Exception:

    {"The conversion is not supported. [ Type to convert from (if known) = nvarchar, Type to convert to (if known) = image ]"}
        [System.Data.SqlServerCe.SqlCeException]: {"The conversion is not supported. [ Type to convert from (if known) = nvarchar, Type to convert to (if known) = image ]"}
        _HResult: -2146233087
        _innerException: null
        _message: "The conversion is not supported. [ Type to convert from (if known) = nvarchar, Type to convert to (if known) = image ]"
        _methodDescs: {System.IntPtr[15]}
        HResult: -2146233087
        InnerException: Could not evaluate expression
        Message: "The conversion is not supported. [ Type to convert from (if known) = nvarchar, Type to convert to (if known) = image ]"
        StackTrace: "   at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)\r\n   at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()\r\n   at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)\r\n   at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery()\r\n   at Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider.SystemCommandExecuteNonQuery(SqlCeCommand cmd)\r\n   at Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider.SetTableAnchorInternal(String tableName, SyncAnchor anchor, String anchorType)\r\n   at Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider.SetTableReceivedAnchor(String tableName, SyncAnchor anchor)\r\n   at SyncApp.AppMobile.HomeUI.mnitLogout_Click(Object sender, EventArgs e)\r\n   at System.Windows.Forms.MenuItem.OnClick(EventArgs e)\r\n   at System.Windows.Forms.Menu.ProcessMnuProc(Control ctlThis, WM wm, Int32 wParam, Int32 lParam)\r\n   at System.W
    indows.Forms.Form.WnProc(WM wm, Int32 wParam, Int32 lParam)\r\n   at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)\r\n   at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)\r\n   at System.Windows.Forms.Application.Run(Form fm)\r\n   at SyncApp.AppMobile.Program.Main()\r\n"
    • Proposed as answer by Biju S Melayil Monday, February 16, 2009 9:46 AM
    Friday, February 6, 2009 4:32 AM
  • Hi All,

    The issue got resolved once i installed hte SQL CE 3.5 SP1 and the ADO SyncService Update.
    Updates are available in the following URL:

    SQL CE 3.5 SP1:

    http://blogs.msdn.com/stevelasker/archive/2008/08/07/sql-server-compact-3-5-sp1-released.aspx

     

    OCS Device RTW:

    http://www.microsoft.com/downloads/details.aspx?familyid=75FEF59F-1B5E-49BC-A21A-9EF4F34DE6FC&displaylang=en

    Hope it might be useful for others..
    Thanks Phil for your Help

    Cheers
    Biju

    • Proposed as answer by Biju S Melayil Monday, February 16, 2009 9:53 AM
    Monday, February 16, 2009 9:53 AM