Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 296076 - Last Review: March 26, 2008 - Revision: 6.2
A Windows CE device power failure that occurs during a transaction commit may cause a SQL Server CE database to be marked suspect
This article was previously published under Q296076
SYMPTOMS
A power failure or an explicit reset that occurs during a
transaction commit may cause a Microsoft SQL Server 2000 Windows CE (SQL Server
CE) database to be marked suspect. You may not be able to recover the database,
even if you use the
Compact method.
Note The
Compact method and the
CompactDatabase method are the same methods in SQL Server 2000 Windows CE
Edition. The method that you use depends on the development environment that
you use. Use the
Compact method in applications that are created with Microsoft Visual
Studio .NET. Use the
CompactDatabase method in applications that are created with Microsoft eMbedded
Visual Tools.
CAUSE
You may experience this problem when any one of the
following actions occurs during a transaction commit:
- A SQL Server CE application abnormally
closes.
- The Windows CE device is reset.
- SQL Server CE stops responding.
If this problem occurs, the database will be marked
suspect. A transaction commit includes all the Data Manipulation Language (DML)
statements that are not explicitly in a transaction. Depending on the stage of
writing data from the temporary database and the SQL Server CE cache, the
database might be left in an unrecoverable state.
This problem can
occur when you are writing to any storage medium, including RAM.
WORKAROUND
The
Compact method will try to repair a suspect database. However, the
Compact
method may not be able to recover the database.
To
minimize the effect of this problem, use the following guidelines:
- Make sure that you keep a backup copy of your SQL Server CE
database files.
- Add a progress bar to your application to prevent users
from performing an explicit reset during data manipulation
operations.
- Keep your transactions short. Use explicit transactions
that encompass small amounts of work.
MORE INFORMATION
The following types of corruption may occur:
Logical corruption is something that makes the database
inconsistent. For example, two pages may reference each other and only one of
the pages is correctly written to disk.
Physical corruption is
something that damages part of a file to the point that the hardware does not
recognize the data.
This article discusses a physical corruption
problem.
The "CompactDatabase Method" topic in SQL Server CE Books
Online states:
"If SQL Server CE is terminated when writing data because of power failure or a
full disk, the data can become corrupted."
APPLIES TO
- Microsoft SQL Server 2000 Windows CE Edition 1.1
- Microsoft SQL Server 2000 Windows CE Edition 2.0
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please