resolving corruption in SQL Server Compact Edition database files

前端 未结 2 1078
忘掉有多难
忘掉有多难 2020-12-03 01:43

This is not a query. Its a summary of our solution to get around the problem of corruption in SQL Compact Database files with (almost) definite success. SQLCE Corruption is

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-03 02:00

    If using SQL Server CE 4.0 there is a known issue that may prevent data from being flushed to disk (AT ALL). https://support.microsoft.com/en-us/kb/2979868 and hotfix https://support.microsoft.com/en-us/kb/2960153

    In their own words:

    Assume that you have specified the flush interval in the maximum number of seconds in the connection string before committed transactions are flushed to disk in Microsoft SQL Server Compact 4.0. In this situation, the committed transactions may take much longer time than the flush interval to be flushed to disk or may not even be flushed to disk. Additionally, data loss occurs if there is an abnormal program termination.

    The hotfix that resolves this problem is included in an on-demand hotfix update package for SQL Server Compact 4.0 Service Pack 1.

    The workaround supplied is to use transaction.Commit(CommitMode.Immediate) around the block you want to make sure gets flushed

提交回复
热议问题