<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SQL Server Compact - Compact &amp; Capable : Engine</title><link>http://blogs.msdn.com/sqlservercompact/archive/tags/Engine/default.aspx</link><description>Tags: Engine</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>After moving the database from one platform to other, the first SqlCeConnection.Open() takes more time</title><link>http://blogs.msdn.com/sqlservercompact/archive/2009/04/01/after-moving-the-database-from-one-platform-to-other-the-first-sqlceconnection-open-takes-more-time.aspx</link><pubDate>Wed, 01 Apr 2009 15:16:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9529517</guid><dc:creator>SQLCEBLOG</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sqlservercompact/comments/9529517.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlservercompact/commentrss.aspx?PostID=9529517</wfw:commentRss><description>&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 12pt"&gt;&lt;/SPAN&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 12pt"&gt;&lt;/SPAN&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 12pt"&gt;If you move a SQLCE database from one platform to other, it's&amp;nbsp;first SqlCeConnection.Open()&amp;nbsp;takes more time and also increases the database file size.&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;U&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 12pt"&gt;&lt;/SPAN&gt;&lt;/U&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;U&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 12pt"&gt;The Reason&lt;/SPAN&gt;&lt;/U&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 12pt"&gt;: F&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;or an index on string type columns, SQLCE uses &lt;A href="http://msdn.microsoft.com/en-us/library/dd318700(VS.85).aspx"&gt;&lt;FONT color=#800080&gt;LCMapString&lt;/FONT&gt;&lt;/A&gt; API to get the normalized sort key. LCMapString API behavior will be different for different NLS sort versions. &lt;A href="http://msdn.microsoft.com/en-us/library/dd318105(VS.85).aspx"&gt;&lt;FONT color=#800080&gt;NLS sort version&lt;/FONT&gt;&lt;/A&gt; is different for Desktop Windows OS and WM/WCE. During the first database connection open, SQLCE rebuilds all indexes if there is a NLS sort version mismatch with the last accessed OS platform. Index recreation requires space on database file and hence the database file size will be increased. You can use &lt;A href="http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceengine.compact(VS.85).aspx"&gt;&lt;FONT color=#800080&gt;Compact()&lt;/FONT&gt;&lt;/A&gt;/&lt;A href="http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.sqlceengine.shrink(VS.85).aspx"&gt;&lt;FONT color=#800080&gt;Shrink()&lt;/FONT&gt;&lt;/A&gt; API to get the database file with approximately old file size. &amp;nbsp;Because of this index recreation, first database connection open takes more time as it has to rebuild all indexes. &amp;nbsp;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;Note&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;: If your database doesn’t&amp;nbsp;have any indexes you will not see above mentioned symptoms on first connection open.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;B&gt;&lt;U&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;&lt;o:p&gt;&lt;SPAN style="TEXT-DECORATION: none"&gt;&lt;/SPAN&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/U&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;&lt;/SPAN&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;&lt;/SPAN&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;Don’t inter-op SQLCE 3.0 databases between devices and desktop:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;SQLCE started supporting desktops only from SQLCE 3.1 (3.0.5300.0) release. SQLCE 3.0 doesn’t have index rebuilding logic and the index re-creation was added during SQLCE 3.1 (3.0.5300.0) release as it is required to support platform inter-op for SQLCE databases. &amp;nbsp;On desktop you can open SQLCE 3.0 databases, which were created on devices. Again If you open these databases on SQLCE 3.0 devices, your device app might receive an error/exception.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="COLOR: #1f497d; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-weight: bold; mso-themecolor: text2; mso-bidi-font-style: italic"&gt;&lt;U&gt;For example:&lt;/U&gt; Opening&amp;nbsp;a SQLCE 3.0&amp;nbsp;database with SSMS will use SQLCE 3.1 bits on desktop and hence it would drop and recreate index data. When this file is copied back to device, index data may not be valid and receive an error/exception.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;Namaskaram!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; COLOR: #1f497d; FONT-SIZE: 11pt"&gt;Manikyam Bavandla&lt;U&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/U&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoPlainText&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9529517" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/ADO.NET/default.aspx">ADO.NET</category><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/Engine/default.aspx">Engine</category><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/OLEDB/default.aspx">OLEDB</category><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/Troubleshooting/default.aspx">Troubleshooting</category><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/Performance/default.aspx">Performance</category></item><item><title>Insight into SQL Server Compact database corruptions</title><link>http://blogs.msdn.com/sqlservercompact/archive/2008/06/25/insight-into-sql-server-compact-database-corruptions.aspx</link><pubDate>Wed, 25 Jun 2008 18:20:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8652383</guid><dc:creator>SQLCEBLOG</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/sqlservercompact/comments/8652383.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlservercompact/commentrss.aspx?PostID=8652383</wfw:commentRss><description>&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Database corruptions are often the most painful bugs to repro and debug. A good percentage of the&amp;nbsp;SQL Server Compact&amp;nbsp;bugs reported are in this category. However it so turns out that in majority of the cases&amp;nbsp;Compact&amp;nbsp;is not the culprit. Surprised!! Let us see why. &lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0cm 0pt"&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'" lang=EN-US&gt;&lt;FONT size=4&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;How SQL Server Compact detects a file corruption?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Compact&amp;nbsp;database comprises of a series of pages, each 4K in size. When a page is written to disk the following sequence of steps is executed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l2 level1 lfo1" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Compute the checksum on the page data and store it as part of the page.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l2 level1 lfo1" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Encrypt the page.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l2 level1 lfo1" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Write to disk at a given file location or offset.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l2 level1 lfo1" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Update system pages/run time cache with the page offset.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;When a page is read from disk the following sequence of steps is executed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo2" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Read from the disk.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo2" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Decrypt the page.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo2" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Re-compute the checksum and compare it with the expected value. (If it fails page is not fully baked. Meaning file write failed)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo2" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Check if this is the same page that we are expecting as per the system pages/ run time cache. (If this fails we lost a complete page write)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;If (3) or (4) of the above read steps fail, the db is marked as corrupt and any further db activity is suspended till it is repaired successfully.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Notes: &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l5 level1 lfo3" class=MsoListParagraph&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-ansi-language: EN-US; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Verify reports step (3) errors as “&lt;SPAN style="COLOR: #c00000"&gt;Bad Checksum - idPage: %d, tyPage: %d, iPage: %d&lt;/SPAN&gt;”. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l5 level1 lfo3" class=MsoListParagraph&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-ansi-language: EN-US; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Verify reports step (4) errors as &lt;SPAN style="COLOR: #c00000"&gt;“Page with valid ordinal not found - idPage: %d, iPage: %d”&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0cm 0pt"&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'" lang=EN-US&gt;&lt;FONT size=4&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;What could have triggered the corruption?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l3 level1 lfo4" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;1.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;A simple device on/off or suspend/resume can result in half-baked file. (No reason to panic as we handle this as described in the next section.)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l3 level1 lfo4" class=MsoListParagraph&gt;&lt;I&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;2.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/I&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Compact&amp;nbsp;relies on underlying FAT/TFAT file system to manage the database file. Any bugs in these components can lead to&amp;nbsp;Compact file corruption. Compact stresses file system in many different ways as it tries to keep the file size as small as possible. As it employs shadow paging the writes and reads are quite random. (&lt;I&gt;Note:&lt;/I&gt;&amp;nbsp;&lt;I&gt;6 months back&amp;nbsp;a bug has been identified in FAT/TFAT system that results in a&amp;nbsp;Compact file losing some of the clusters during shrink operation.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l3 level1 lfo4" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;3.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;If SD card is being used for db file storage, it’s being equally stressed as the above. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l3 level1 lfo4" class=MsoListParagraph&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3 face=Calibri&gt;4.&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;More importantly SD cards bring in additional complexities during Suspend/Resume cycles. Here is a good blog link: &lt;/SPAN&gt;&lt;SPAN style="COLOR: #1f497d"&gt;&lt;A href="http://blogs.msdn.com/windowsmobile/archive/2007/01/12/everything-you-want-to-know-about-sd.aspx" mce_href="http://blogs.msdn.com/windowsmobile/archive/2007/01/12/everything-you-want-to-know-about-sd.aspx"&gt;&lt;FONT color=#0000ff&gt;http://blogs.msdn.com/windowsmobile/archive/2007/01/12/everything-you-want-to-know-about-sd.aspx&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0cm 0pt"&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'" lang=EN-US&gt;&lt;FONT size=4&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;Am I suggesting&amp;nbsp;SQL Server Compact&amp;nbsp;bugs can’t result in any kind of corruption?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;Of course&amp;nbsp;Compact code bugs can result in corruption. A lot of them have been found internally before v3.0 release and also reported by customers thereafter. They are more logical in nature like index constraint is compromised or a table page says there are 1000 rows when there are only 55. &amp;nbsp;We did a very good job in fixing these and they are hard to find now. However&amp;nbsp;Compact bugs don’t result in physical corruptions like “checksum errors” or “page missing” errors. &lt;/SPAN&gt;&lt;SPAN style="COLOR: #1f497d; FONT-SIZE: 12pt; mso-ansi-language: EN-US" lang=EN-US&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0cm 0pt"&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'" lang=EN-US&gt;&lt;FONT size=4&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;What does&amp;nbsp;Compact do to prevent corruptions?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;We believe most of the corruptions should be due to device suspend/resume or on/off cycles. &amp;nbsp;For ex:&amp;nbsp;Compact is trying to write to a file and the user simply boots his device. Now file is in half-baked state.&amp;nbsp;Or let’s say process gets killed before it can complete the flush cycle. How do we avoid this? &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Well, we use shadow paging to overcome this situation. We can loosely categorize the db pages into user data pages, system pages and header page. As the name suggests user data pages contain all the user data. Header pages and system pages help us locate a specific user page on the disk. When it’s time to flush the changes to disk, we write shadows of the user data pages first. Then the shadows of the updated system pages are written. Finally the header page is written. The old pages are retained till the header page is updated. This ensures that we have a transactional write to the disk. Either the change is completely present or not.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H2 style="MARGIN: 10pt 0cm 0pt"&gt;&lt;SPAN style="mso-ansi-language: EN-US; mso-fareast-font-family: 'Times New Roman'" lang=EN-US&gt;&lt;FONT size=4&gt;&lt;FONT color=#4f81bd&gt;&lt;FONT face=Cambria&gt;Conclusion: Why do we still see corruptions?&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/H2&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Clearly the above is not enough. Some of the interesting cases are&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l4 level1 lfo5" class=MsoListParagraph&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-ansi-language: EN-US; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;What if any of the underlying systems&amp;nbsp;‘SD card software’&amp;nbsp;or FAT/TFAT has a bug? &lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l1 level1 lfo6" class=MsoListParagraph&gt;&lt;SPAN style="FONT-FAMILY: Symbol; mso-ansi-language: EN-US; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol" lang=EN-US&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;·&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Suspend/resume cycle can result in file buffer loss if SD card is used. So the changes supposed to be written to disk could be lost. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="TEXT-INDENT: -18pt; MARGIN: 0cm 0cm 0pt 36pt; mso-list: l1 level1 lfo6" class=MsoListParagraph&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;&lt;o:p&gt;&lt;FONT size=3 face=Calibri&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-ansi-language: EN-US; mso-fareast-font-family: SimSun; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-theme-font: minor-fareast" lang=EN-US&gt;The intent is not to blame other components. However in the last 3 years, at least 90% of the corruption bugs reported are due to bad checksum. It means disk write is bad for some reason (which is not owned by Compact). &amp;nbsp;The fault is somewhere in the bottom stack and it has to be fixed. Our options are very limited without a repro but we are&amp;nbsp;trying&amp;nbsp;hard to improve our debugging infrastructure. We are hoping that with this knowledge customers will be able to understand the corruptions better and come up with good practices that would vastly reduce these corruptions.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt; mso-ansi-language: EN-US; mso-fareast-font-family: SimSun; mso-bidi-font-family: 'Times New Roman'; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA; mso-fareast-theme-font: minor-fareast" lang=EN-US&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;Thanks&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0cm 0cm 0pt" class=MsoNormal&gt;&lt;SPAN style="mso-ansi-language: EN-US" lang=EN-US&gt;Raja&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8652383" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/Engine/default.aspx">Engine</category><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/Troubleshooting/default.aspx">Troubleshooting</category></item><item><title>"Houston, we got some problem..." and "Houston, we got a problem..." - notice a difference?</title><link>http://blogs.msdn.com/sqlservercompact/archive/2007/12/12/houston-we-got-some-problem-and-houston-we-got-a-problem-notice-a-difference.aspx</link><pubDate>Wed, 12 Dec 2007 13:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6745126</guid><dc:creator>SQLCEBLOG</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sqlservercompact/comments/6745126.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlservercompact/commentrss.aspx?PostID=6745126</wfw:commentRss><description>&lt;P mce_keep="true"&gt;So you have run into a problem - how to efficiently report this:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;System configuration:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;On a Desktop/Server, Run Winver from Start -&amp;gt; Run.&lt;/LI&gt;
&lt;LI&gt;On a Pocket PC, Start -&amp;gt; Settings -&amp;gt; About&lt;/LI&gt;
&lt;LI&gt;On a Smart Phone, a bit more steps - start -&amp;gt; Settings -&amp;gt; More -&amp;gt;About&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Give us all the details you see here.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SQL CE Version:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Applies if you had installed SQL CE by various means &amp;lt;VS / SSMS etc.&amp;gt;&lt;/LI&gt;
&lt;LI&gt;Search for the sqlcese*.dll, right click it and give us the version in version tab.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;A detailed description of what you are trying to do:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Include all details like whether you are using Managed /Native code, single/multi-process and a sample code&lt;/LI&gt;
&lt;LI&gt;A small repro of the error you are getting would be great! &amp;lt;In case of corrupt databases, the corrupt database&amp;gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;A Dump file if the process has crashed / hung:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;On a PC, install this wonderful tool - UserDump.exe from &lt;A href="http://support.microsoft.com/kb/241215" mce_href="http://support.microsoft.com/kb/241215"&gt;http://support.microsoft.com/kb/241215&lt;/A&gt;. This tool installs a control panel entry - click this and register your application's name on this. Next time you get a crash in that app, you will get a dump file in the location you specified. Neat isn't it?&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;In case of a hang, use the same tool above to assign a hotkey and dump the process's current state.&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;A word of caution, this crash dump file can be pretty big - so ensure you have enough disk space.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;On a mobile device, this gets a bit trickier. If you are using Windows CE 5.0+ version, and if you are lucky enough to have an OEM vendor who has enabled Windows Error Reporting, you can get a dump. Read this wonderful article at &lt;A href="http://windowsfordevices.com/articles/AT7568439504.html" mce_href="http://windowsfordevices.com/articles/AT7568439504.html"&gt;http://windowsfordevices.com/articles/AT7568439504.html&lt;/A&gt; by Abraham Kcholi and Gad Meir.&lt;/LI&gt;&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;For older devices &amp;lt;Win CE 4.2 and so on&amp;gt;, contact us with the program and the problem, and we will handle it case by case.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;P.S:&lt;/B&gt; No, don't upload all the attachments on to the forums:), but keep them handy. The moment we start looking at this, we will be asking for these.&lt;/P&gt;
&lt;P&gt;&lt;B&gt;P.S.2:&lt;/B&gt; First post here - w00t! I am a developer in the engine team of SQL CE and I guess you will see me here time and again!&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;/B&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Nandri!&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;Subu Subramanian.&lt;/B&gt;&lt;/P&gt;
&lt;P&gt;There can be hope only for a society which acts as one big family, not as many separate ones. - Anwar el Sadat&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=6745126" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/Engine/default.aspx">Engine</category><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/Troubleshooting/default.aspx">Troubleshooting</category></item><item><title>SqlCeEngine/ISSCEEngine: Shrink Vs Compact</title><link>http://blogs.msdn.com/sqlservercompact/archive/2007/10/26/sqlceengine-issceengine-shrink-vs-repair.aspx</link><pubDate>Fri, 26 Oct 2007 05:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5687003</guid><dc:creator>SQLCEBLOG</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/sqlservercompact/comments/5687003.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlservercompact/commentrss.aspx?PostID=5687003</wfw:commentRss><description>&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;The difference between these two is much similar to Internal and External Memory Fragmentation.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font size="3" face="Calibri"&gt;From &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.data.sqlserverce.sqlceengine.shrink.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.data.sqlserverce.sqlceengine.shrink.aspx"&gt;&lt;font size="3" color="#800080" face="Calibri"&gt;SqlCeEngine.Shrink&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; documentation, &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font size="3" face="Calibri"&gt;Reclaims wasted space in the database by moving empty and unallocated pages to the end of the file, and then truncating the file. &lt;span style=""&gt;&amp;nbsp;&lt;/span&gt;You can configure a database to automatically shrink by setting the &lt;/font&gt;&lt;font size="3" face="Calibri"&gt;&lt;b&gt;&lt;i&gt;autoshrink threshold &lt;/i&gt;&lt;/b&gt;option in &lt;a href="http://msdn2.microsoft.com/en-us/library/system.data.sqlserverce.sqlceconnection.connectionstring%28VS.80%29.aspx" class="" title="Connection String options" target="_blank" mce_href="http://msdn2.microsoft.com/en-us/library/system.data.sqlserverce.sqlceconnection.connectionstring(VS.80).aspx"&gt;connection string&lt;/a&gt;.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;Shrink does not create a temporary database file.&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font size="3" face="Calibri"&gt;From &lt;/font&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.data.sqlserverce.sqlceengine.compact.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.data.sqlserverce.sqlceengine.compact.aspx"&gt;&lt;font size="3" color="#800080" face="Calibri"&gt;SqlCeEngine.Compact&lt;/font&gt;&lt;/a&gt;&lt;font size="3" face="Calibri"&gt; documentation, &lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Reclaims wasted space in the database by creating a new database file from the existing file. &lt;span style=""&gt;&amp;nbsp;&lt;/span&gt;By creating a new database means, it reclaims the free space between rows.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font face="Calibri"&gt;&lt;font size="3"&gt;To be more clear, Shrink claims the pages which are &lt;b style=""&gt;&lt;u&gt;entirely&lt;/u&gt;&lt;/b&gt; free or unallocated; where as, Compact claims the wasted space &lt;b style=""&gt;&lt;u&gt;with in&lt;/u&gt;&lt;/b&gt; the page &lt;b&gt;&lt;u&gt;too&lt;/u&gt;&lt;/b&gt;. &lt;span style=""&gt;&amp;nbsp;&lt;/span&gt;Hence Compact requires creating a new database file.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font face="Calibri"&gt;&lt;/font&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font size="3" face="Calibri"&gt;Empty space with in the page could be as result of:&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; text-align: justify;"&gt;&lt;span style=""&gt;&lt;span style=""&gt;&lt;font size="3" face="Calibri"&gt;1)&lt;/font&gt;&lt;span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt;If there were 5 rows in a page and two of them are deleted&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; text-align: justify;"&gt;&lt;span style=""&gt;&lt;span style=""&gt;&lt;font size="3" face="Calibri"&gt;2)&lt;/font&gt;&lt;span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt;If there was a row in the middle of the page which on update required more space, has moved out of the page (Ex: nvarchar column update)&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; text-align: justify;"&gt;&lt;span style=""&gt;&lt;span style=""&gt;&lt;font size="3" face="Calibri"&gt;3)&lt;/font&gt;&lt;span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt;Etcetera&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="margin: 0in 0in 10pt 0.75in; text-align: justify;"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font size="3" face="Calibri"&gt;Empty pages and unallocated pages could remain in database as a result of:&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; text-align: justify;"&gt;&lt;span style=""&gt;&lt;span style=""&gt;&lt;font size="3" face="Calibri"&gt;1)&lt;/font&gt;&lt;span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt;All rows in a page are deleted&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0in 0in 0pt 0.5in; text-indent: -0.25in; text-align: justify;"&gt;&lt;span style=""&gt;&lt;span style=""&gt;&lt;font size="3" face="Calibri"&gt;2)&lt;/font&gt;&lt;span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt;Whole table is dropped&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="margin: 0in 0in 10pt 0.5in; text-indent: -0.25in; text-align: justify;"&gt;&lt;span style=""&gt;&lt;span style=""&gt;&lt;font size="3" face="Calibri"&gt;3)&lt;/font&gt;&lt;span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt;Etcetera&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font size="3" face="Calibri"&gt;Thanks,&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;font size="3" face="Calibri"&gt;Laxmi Narsimha Rao ORUGANTI&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0in 0in 10pt; text-align: justify;"&gt;&lt;o:p&gt;&lt;font size="3" face="Calibri"&gt;&amp;nbsp;&lt;/font&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=5687003" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/Engine/default.aspx">Engine</category></item><item><title>Connection String - Database Creation-time Only Options</title><link>http://blogs.msdn.com/sqlservercompact/archive/2007/06/13/connection-string-database-creation-time-only-options.aspx</link><pubDate>Wed, 13 Jun 2007 22:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3273407</guid><dc:creator>SQLCEBLOG</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/sqlservercompact/comments/3273407.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlservercompact/commentrss.aspx?PostID=3273407</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;In this article, we will discuss the &lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.data.sqlserverce.sqlceconnection.connectionstring(vs.80).aspx"&gt;&lt;FONT face=Calibri color=#800080 size=3&gt;Connection String Parameters&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; that are meant for use only for database creation and not for connection open to an existing database.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Locale Identifier&lt;/B&gt; – LCID tells the engine in which locale/collation the database should be created.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Encrypt&lt;/B&gt; – As the name suggest is to encrypt a database.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;It is to tell engine to create an encrypted database.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This is going to be deprecated from v3.5 onwards.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Please use &lt;B style="mso-bidi-font-weight: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;Encryption Mode&lt;/I&gt;&lt;/B&gt; instead.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;Encryption Mode&lt;/B&gt; – This is a new connection string parameter for v3.5.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;It has three values: Platform Default (DEFAULT), Engine Default, and PPC 2003 Compatibility.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This option tells the engine to create a database of platform compatibility to support for the encryption.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Platform Default means try Engine Default if possible, otherwise go with PPC 2003 Compatibility.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Engine Default tells the engine to use the algorithms that may NOT be compatible across all platforms (Which means a DB created on Windows CE 5.0 platform cannot be opened on Windows CE 4.2 platform), on the other side PPC 2003 Compatibility tells the engine to use algorithms such a way that DB file created on Window CE 5.0 platform can be opened on any SQL CE supported platform.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/I&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;Note that these connection string creation-time only options are used while compacting a database too, as in case of compact also we create a fresh destination database and may over write the source database depending on the options chosen for compact.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;Thanks,&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;Laxmi Narsimha Rao ORUGANTI&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3273407" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/Engine/default.aspx">Engine</category></item><item><title>The Story of Max Database Size (Connection String Parameter)</title><link>http://blogs.msdn.com/sqlservercompact/archive/2007/06/13/the-story-of-max-database-size-connection-string-parameter.aspx</link><pubDate>Wed, 13 Jun 2007 22:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3273164</guid><dc:creator>SQLCEBLOG</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sqlservercompact/comments/3273164.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlservercompact/commentrss.aspx?PostID=3273164</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;&lt;/I&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;Maximum Database Size&lt;/I&gt;&lt;/B&gt; is NOT a persistent configuration (It is NOT stored in database file).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;SQL CE creates shared memory to support multi-connection scenarios.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;SQL CE maintains an entry for each page of the database file, in this shared memory.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Because we don't always grow to 4 GB, it is not wise to allocate shared memory to accommodate all page entries/references to support 4 GB.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;This means, we should have a default for max no. of page references (max database size) in shared memory to be reserved.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;B style="mso-bidi-font-weight: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;Maximum Database Size&lt;/I&gt;&lt;/B&gt; is defaulted to 128 MB on devices and 256 MB on desktops (for v3.1).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;But sometimes user knows that it may grow beyond the default &lt;B style="mso-bidi-font-weight: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;Maximum Database Size&lt;/I&gt;&lt;/B&gt; and hence should be provided with a configuration parameter in connection string.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;As you can see this connection string parameter &lt;B style="mso-bidi-font-weight: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;Max Database Size&lt;/I&gt;&lt;/B&gt; is helpful only for the connection that is creating the shared memory and reserving the page reference part; which is obviously the first connection to database.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;(Note: For every database file, there exists only one shared memory).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The 2nd connection cannot do anything with this connection string parameter as there is exists a shared memory for that database, 2nd connection has to just rely upon the existing configuration.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;The moment all connections are down, the shared memory is deleted.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;That is why you can reconfigure the &lt;B style="mso-bidi-font-weight: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;Max Database Size&lt;/I&gt;&lt;/B&gt; for &lt;B style="mso-bidi-font-weight: normal"&gt;&lt;I style="mso-bidi-font-style: normal"&gt;every&lt;/I&gt;&lt;/B&gt; first connection to the database file.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Calibri size=3&gt;The story holds good for other &lt;/FONT&gt;&lt;A href="http://msdn2.microsoft.com/en-us/library/system.data.sqlserverce.sqlceconnection.connectionstring(vs.80).aspx" mce_href="http://msdn2.microsoft.com/en-us/library/system.data.sqlserverce.sqlceconnection.connectionstring(vs.80).aspx"&gt;&lt;FONT face=Calibri color=#800080 size=3&gt;connection string parameters&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; like ‘Max Buffer Size’.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;Thanks,&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;Laxmi Narsimha Rao ORUGANTI&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=3273164" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlservercompact/archive/tags/Engine/default.aspx">Engine</category></item></channel></rss>