SQLCE Corrupt Database!!!

G

Guest

We have 5 .sdf databases on our handhelds. The most active is the OrdersDB
where we have 4 tables. The first users who have used our product have now
experienced some corruption(we think) whereby when they go to view orders in
a ListView, the app hangs. On connection within Query Analyser on the
HandHeld, the connection also hangs. This has not happened with newly setup
ysers. We think it may be a volume issue.

We have a large volume of small orders being sent to the back end server two
ways via replication. Some of the activity involves the entry of say 10
orders. 1 is deleted on handheld and given a deleted status. We replicate all
10 orders upward. Then our replication monitor sends 9 back down. We decided
to use no programatic control over this and let replication do it for us as
we were advised.

Is there too many pointers to deletions and the DB is overworked?
Is there a way of reindexing a .sdf file?
Any ideas very welcome.

Marc
 
P

Peter Foot [MVP]

How is your .sdf stored? On device memory or on a Storage card? I've
encountered data corruption before on an SD card with frequent reads/writes.

Peter
 
P

Pete Vickers [MVP]

Hi,
if it is corrupt, you should get a message saying so when you open it
(presuming you are error checking ;))

Try compacting it, that is the recommended way to attempt to recover a
corrupt database, but no guarantees.
Compacting on a regular basis should help

Pete
 
G

Guest

It' on the storage card Peter.

Peter Foot said:
How is your .sdf stored? On device memory or on a Storage card? I've
encountered data corruption before on an SD card with frequent reads/writes.

Peter
 
D

Darren Shaffer

Yes, Compact will recover freed extent space and recalculate index
statistics
on your SQL CE database.

In fact, it is good practice to Compact your database periodically
to keep it well-tuned, above and beyond the repair issue Peter helped you
with.

-Darren Shaffer
 
G

Guest

Hi MarcMC!!!

Also, just to verify that everything is going well, check if the memory
distribution between programs and storage is a healthy one.

Let me tell you why: I used to have the same problem:
* I had a healthy database,
* I would call my program,
* My program would execute a select statement,
* My program would hang it self, the PDA, etc.

As it turned out, the PDA didn't have any memory left for running
programs when my select statement was executed. After I redistributed the
memory, everything started to work just fine!

Of course, somebody may argue that a message box should pop out saying
that the PDA is running out of memory and all that stuff. That never happens
in my program :(

Hope it helps!!!!

Tark ik
PS: This posting has been posted "AS IS"
 
Joined
May 28, 2009
Messages
1
Reaction score
0
Cannot compact if using Sync Services

We have discovered that compacting a SqlCE database resets the anchors used by Microsoft Synch Services. So compacting is prohibited in our systems.






But we are having a rash of corrupt databases on remote devices.






Peter Foot [MVP] said:
Use the SqlCeEngine class and it's Compact method. There is some sample code
in the online documentation:-
http://msdn.microsoft.com/library/d...tasqlservercesqlceengineclasscompacttopic.asp

Compact creates a new copy of the database, so this sample shows how to do
this then delete the original and rename the copy.

Peter

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

"marcmc" wrote in message
news:[email protected]...
> Thanks Pete, will look into it. How do you go about compacting it?
>
> "Pete Vickers [MVP]" wrote:
>
>> Hi,
>> if it is corrupt, you should get a message saying so when you open it
>> (presuming you are error checking ;))
>>
>> Try compacting it, that is the recommended way to attempt to recover a
>> corrupt database, but no guarantees.
>> Compacting on a regular basis should help
>>
>> Pete
>>
>> --
>> Pete Vickers
>> Microsoft .NET Compact Framework MVP
>> HP Business Partner
>> http://www.gui-innovations.com
>>
>> "marcmc" wrote in message
>> news:[email protected]...
>> > We have 5 .sdf databases on our handhelds. The most active is the
>> > OrdersDB
>> > where we have 4 tables. The first users who have used our product have
>> > now
>> > experienced some corruption(we think) whereby when they go to view
>> > orders
>> > in
>> > a ListView, the app hangs. On connection within Query Analyser on the
>> > HandHeld, the connection also hangs. This has not happened with newly
>> > setup
>> > ysers. We think it may be a volume issue.
>> >
>> > We have a large volume of small orders being sent to the back end
>> > server
>> > two
>> > ways via replication. Some of the activity involves the entry of say 10
>> > orders. 1 is deleted on handheld and given a deleted status. We
>> > replicate
>> > all
>> > 10 orders upward. Then our replication monitor sends 9 back down. We
>> > decided
>> > to use no programatic control over this and let replication do it for
>> > us
>> > as
>> > we were advised.
>> >
>> > Is there too many pointers to deletions and the DB is overworked?
>> > Is there a way of reindexing a .sdf file?
>> > Any ideas very welcome.
>> >
>> > Marc
>> >
>> >
>> >

>>
>>
>>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top