Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server CE / December 2008

Tip: Looking for answers? Try searching our database.

Corrupted databases

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alberto Salvati - 28 Nov 2008 08:37 GMT
Hi. all.
Using my sqlce based application (based on vs2005 + CF 2.0..) as lot
of users have trouble about sqlce file corruption.
My app is very simple and uses a little database with 5 tables.
There is not a lot of data...Main table, customer, has 3000 records.

I dont' understand why this situation occures.
Application and database are stored in SD memory card.

In some group I've found some tips like to compact database file each
time application starts....
I've added code to execute this operation...
But, I don't like that this situation occures without I know WHY.....

TIA for any suggestion.

A. Salvati
Ginny Caughey MVP - 28 Nov 2008 13:00 GMT
Alberto,

Generally versions of SqlCe newer than 2.0 are less prone to corruption.
Have you considered moving to the current version 3.5 sp1?

Signature

Ginny Caughey
Device Application Development MVP

> Hi. all.
> Using my sqlce based application (based on vs2005 + CF 2.0..) as lot
[quoted text clipped - 13 lines]
>
> A. Salvati
Alberto Salvati - 28 Nov 2008 14:09 GMT
Hi, Ginny.
Now, I'm using sqlce 3.1......

AS
Laxmi Narsimha Rao Oruganti [MSFT] - 01 Dec 2008 04:32 GMT
If you just want an answer to "WHY" then Checkout this blog post:
http://blogs.msdn.com/sqlservercompact/archive/2008/06/25/insight-into-sql-serve
r-compact-database-corruptions.aspx


Thanks,
Laxmi

> Hi, Ginny.
> Now, I'm using sqlce 3.1......
>
> AS
Alberto Salvati - 01 Dec 2008 13:29 GMT
Hi, Laxmi.
Tnx for the link.
Now, I'm stopping all to THINK....

Therefore, i've a simple question...
At this link:

http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceconnection.
connectionstring(VS.80).aspx


I see this:

<cut>
flush interval
Specified the interval time (in seconds) before all committed
transactions are flushed to disk. If not specified, the default value
is 10.

autoshrink threshold

The percent of free space in the database file that is allowed before
autoshrink begins. A value of 100 disables autoshrink. If not
specified, the default value is 60.

temp path
The location of the temporary database. If not specified, the default
is to use the database specified in the data source property for
temporary storage.

<cut>

I've these simle questions...

1) Now, i'm not using transaction...
So, flush interval is rilevants for my context?

2) Now, My app does a compact operation each time starts...
But, if default is 60, I dont' need this operation

3) in my connection string I've not specified temp path...
My english isn't good, ok, but WHAT' S MEAN "the default is to use the
database specified in the data source property for temporary storage"?

This is LAST ppc projects, for me....! :-((

tnx all for these answer

AS

On 1 Dic, 05:32, "Laxmi Narsimha Rao Oruganti [MSFT]"
<laxmi.onl...@msnews.com> wrote:
> If you just want an answer to "WHY" then Checkout this blog post:http://blogs.msdn.com/sqlservercompact/archive/2008/06/25/insight-int...

> Thanks,
> Laxmi
[quoted text clipped - 3 lines]
>
> > AS
Laxmi Narsimha Rao Oruganti - 01 Dec 2008 14:44 GMT
Alberto> 1) Now, i'm not using transaction...
Alberto> So, flush interval is rilevants for my context?

Whether or not you use a transaction, there is always a transaction in the
system and that is what database system revolves around.  If you don't
create one, system creates a temporary one internally!

Flush Interval is to Minimize the disk I/O to accumulate the dirty pages
till 10ms and then flush them all in a single go.  This also helps the user
thread to be more responsive as the main thread is not blocked on finishing
the I/O but rather is delegated to a background thread and the background
thread works at this interval.

Alberto> 2) Now, My app does a compact operation each time starts...
Alberto> But, if default is 60, I dont' need this operation

There is  a difference between Shrink and Compaction.  "Autoshrink
threshold" is about Shrink and Compact does not have any parameters but to
be explicitly invoked.

Assume each page is of 4096 bytes and 16 bytes is reserved for page header.
Now the remaining space is 4080 bytes.

Shrink deals with fragmentation inside a page, like:
Page has 2 rows of sizes 1000 bytes each.  But are not together one after
other, rather they are separated by 1000 bytes.  So, in effect there is a
space of 2080 bytes.  However, if I need to insert a row of 2000 bytes we
can not use this page as 2080 bytes is not continuous.  Shrink deals with
fragmentation in a page.

Compact deals with fragmentation outside a page, like:
Database has 10 pages, out of these let us say 5 pages are occupied and 5
are not.  The free pages are not together, but database system want to have
a colocated space of 5 pages to flush the pages in a single I/O call which
would not be possible with this database state. Compacting database moves
the pages around.

Thanks,
Laxmi

> Hi, Laxmi.
> Tnx for the link.
[quoted text clipped - 56 lines]
>>
>> > AS
Alberto Salvati - 01 Dec 2008 15:12 GMT
> Flush Interval is to Minimize the disk I/O to accumulate the dirty pages
> till 10ms and then flush them all in a single go.  This also helps the user
> thread to be more responsive as the main thread is not blocked on finishing
> the I/O but rather is delegated to a background thread and the background
> thread works at this interval.

ok.. but at link in my prev post, you can read that:

<cut>
flush interval
Specified the interval time
>>>>>>>>>> (in seconds) <<<<<<<<<<<<<<<<<
before all committed transactions are flushed to disk. If not
specified, the default value is 10.
<cut>

So, 10 are seconds or milliseconds? I think tah 10 SECONDS delay is
very dangerous.

Tnx

AS
Laxmi Narsimha Rao Oruganti [MSFT] - 02 Dec 2008 11:16 GMT
Sorry for missing the details.  Yes, default is 10 seconds (and not
milli-seconds).

Thanks,
Laxmi

> Flush Interval is to Minimize the disk I/O to accumulate the dirty pages
> till 10ms and then flush them all in a single go. This also helps the user
> thread to be more responsive as the main thread is not blocked on
> finishing
> the I/O but rather is delegated to a background thread and the background
> thread works at this interval.

ok.. but at link in my prev post, you can read that:

<cut>
flush interval
Specified the interval time
>>>>>>>>>> (in seconds) <<<<<<<<<<<<<<<<<
before all committed transactions are flushed to disk. If not
specified, the default value is 10.
<cut>

So, 10 are seconds or milliseconds? I think tah 10 SECONDS delay is
very dangerous.

Tnx

AS
Alberto Salvati - 03 Dec 2008 10:30 GMT
Hi, Laxmi...
Now, after 3 days, I never replicate database corruption on my pcc.
I've killed application, none
I've writed a "stress" application that does a lot of insert and
delete on my database... None.
I've used a lot of files to fill main memory of my pcc to try
situation like "disk full", none.
And so on....

I dont understand how application user's put database in corrupted
state.

Yesterday, I found a difference....
On my pcc, I've settings enabled to turn off device after inactivity
of 3 minutes..
Users have this settings disabled. Therefore, device never turn off.
I've done a lot of test after changed this setting on my pcc, today,
and I've started a save operation in my app with device with low
battery.
Device goes off during save operation, ok.
But, whenn I get database from device to check it, it is not
corrupted.

I'm going crazy to think other test to replicate database
corruption....

TIA

AS

On 2 Dic, 12:16, "Laxmi Narsimha Rao Oruganti [MSFT]"
<laxmi.onl...@msnews.com> wrote:
> Sorry for missing the details.  Yes, default is 10 seconds (and not
> milli-seconds).
[quoted text clipped - 25 lines]
>
> AS
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.