PRB: SQL Server CE Replication Error Message: 28557 : "The database is in an unusable state. " (304060)



The information in this article applies to:

  • Microsoft SQL Server 2000 Windows CE Edition

This article was previously published under Q304060

SYMPTOMS

When you try to synchronize a database, the following error message may occur with Microsoft SQL Server 2000 Windows CE Edition (SQL Server CE) Replication Synchronize:
Source: Microsoft SQL Server 2000 Windows CE Edition
Number: 80004005
NativeError: 28557
Description: Run
Error code 28557 means:
The database is in an unusable state. Delete it and recreate it.

CAUSE

The error message shown in the "Symptoms" section may occur if the application receives an error during the initial synchronization. When an error occurs during the initial synchronization process, the subscription is actually incomplete and does not contain all of the required metadata and system tables to successfully fix itself.

RESOLUTION

To resolve this problem, use these steps:
  1. Delete the locate database (.sdf file) on the device and then re-create the local database.
  2. Call the AddSubscription method.
  3. Perform the first synchronization and download the initial snapshot by calling the Initialize, Run and Terminate methods.

STATUS

This behavior is by design.

MORE INFORMATION

Multiple error messages may occur with SQL Server CE Replication Synchronize such as:
28557 The database is in an unusable state. Delete it and recreate it.

-or-

28560 OLE DB Execute Method failed; bad or invalid SQL statement.

-or-

25082 Unique indexes/constraints cannot be created over nullable columns.

-or-

25501 Error parsing query.
Error message 25501 may occur if the database has a primary key on a nchar column that is more than 255 characters. Due to the data type mapping, SQL Server CE must map nchar to ntext and you cannot have a primary key on a ntext data type.

Another issue is that you might exceed the Index limitation, which is only 32 for SQL Server CE. So, if an attempt is made to create a 33rd Index, the attempt fails on a CE device.

The Parameters collection in the Errors collection provides you with text that contains the cause of the failure.

You can enhance error checking for the application by including the following code:
Sub ShowErrors(ErrColl As SSCEErrors)

  'Initialize error variables to view error collection
  Dim ErrRec As Object  'SSCE.ErrorRecords
  Dim param As Object
  Dim strErr As String
    
  strErr = ""

  For Each ErrRec In ErrColl
     strErr = strErr & "Source: " & ErrRec.Source & vbCrLf
     strErr = strErr & "Number: " & Hex(ErrRec.Number) & vbCrLf
     strErr = strErr & "NativeError: " & ErrRec.NativeError & vbCrLf
     strErr = strErr & "Description: " & ErrRec.Description & vbCrLf
     For Each param In ErrRec.Params
      strErr = strErr & "Param" & " = " & param.Param & vbCrLf
     Next param
     strErr = strErr & vbCrLf

  Next ErrRec
  
  MsgBox strErr, vbOKOnly

End Sub
				

REFERENCES

SQL Server CE 2000 Books Online

Modification Type:MajorLast Reviewed:9/26/2001
Keywords:kbprb KB304060