locked
GetSchema unable to initialize client database, error RRS feed

  • Question

  • Hi,

    When I am doing the initial step of adding a local database cache and going through the "Configure Data Synchronization" dialog I get the following error for *some* tables:

    "Synchronizing the database failed with the message:'Unable to initialize the client database, because the schema for table 'aspnet_Roles' could not be retrieved by the GetSchema() method of DbServerSyncProvider. Make sure that you can establigh a connection to the client database and that either the SelectIncrementalInsertsCommand porperty or the SelectIncrementalUpdatesCommand property of the SyncAdapter is specified correctly".

    However for other tables in the database everything is fine. All the tables in the source database have track changes turned on (We are using SQL Server Express 2008).

    The schema definition for the offending table is:

    /****** Object:  Table [dbo].[aspnet_Users]    Script Date: 10/23/2009 08:57:59 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO

    CREATE TABLE [dbo].[aspnet_Users](
        [ApplicationId] [uniqueidentifier] NOT NULL,
        [UserId] [uniqueidentifier] NOT NULL,
        [UserName] [nvarchar](256) NOT NULL,
        [LoweredUserName] [nvarchar](256) NOT NULL,
        [MobileAlias] [nvarchar](16) NULL,
        [IsAnonymous] [bit] NOT NULL,
        [LastActivityDate] [datetime] NOT NULL,
        [UserIndex] [int] IDENTITY(1,1) NOT NULL,
    PRIMARY KEY NONCLUSTERED
    (
        [UserId] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    GO

    ALTER TABLE [dbo].[aspnet_Users]  WITH NOCHECK ADD FOREIGN KEY([ApplicationId])
    REFERENCES [dbo].[aspnet_Applications] ([ApplicationId])
    GO
    ALTER TABLE [dbo].[aspnet_Users] ADD  DEFAULT (newid()) FOR [UserId]
    GO
    ALTER TABLE [dbo].[aspnet_Users] ADD  DEFAULT (NULL) FOR [MobileAlias]
    GO
    ALTER TABLE [dbo].[aspnet_Users] ADD  DEFAULT ((0)) FOR [IsAnonymous]
    GO


    So anyone have any ideas what the issue is and how to resolve it?

    Thanks.
    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:57 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Friday, October 23, 2009 8:05 AM

Answers

  • Hi,

    I do not actually set any anchor commands or anything; the wizard does this all for me.

    I have traced the problem to indexes on primary keys:
    • There must be an index on the primary key
    • The index must be clustered
    The last point is important, as we had them set to non-clustered which caused the original error. Why it has to be clustered I have no idea, but it breaks if it is not!

    Thanks
    • Marked as answer by Mark Duffill Friday, October 23, 2009 2:26 PM
    Friday, October 23, 2009 2:26 PM

All replies

  • Hi Mark,

    The problem is on anchor command. Could you share here the used sentence for getting anchor value??

    BTW: Make sure your retentin period has not expired.

    Cheers,

    José Miguel Torres
    Friday, October 23, 2009 1:39 PM
  • Hi,

    I do not actually set any anchor commands or anything; the wizard does this all for me.

    I have traced the problem to indexes on primary keys:
    • There must be an index on the primary key
    • The index must be clustered
    The last point is important, as we had them set to non-clustered which caused the original error. Why it has to be clustered I have no idea, but it breaks if it is not!

    Thanks
    • Marked as answer by Mark Duffill Friday, October 23, 2009 2:26 PM
    Friday, October 23, 2009 2:26 PM