This project has moved and is read-only. For the latest updates, please go here.


The database file is larger than the configured maximum database size.


See below for command prompt results. The compact seems to run, but then when complete raises an error that the connection string max DB size isn't big enough when it is. It is like it reverts back to use the default after it runs the compact instead of using the supplied Max Database Size.
sqlcecmd -d "Data Source=CeDatabase.sdf;Max Database Size = '1280'" -e compact -v
SqlCeCmd: Database Information
locale identifier: 1033
encryption mode:
case sensitive: False
Database: CeDatabase.sdf
ServerVersion: 3.5.5692.0
DatabaseSize: 329969664
Created: 01/06/2010 11:23 AM
Error Code: 80004005
Message : The database file is larger than the configured maximum database size. This setting takes effect on the first concurrent database connection only.
[ Required Max Database Size (in MB; 0 if unknown) = 315 ]
Minor Err.: 25104
Source : SQL Server Compact ADO.NET Data Provider
Num. Par. : 315
Closed Sep 25, 2015 at 11:04 AM by ErikEJ
Fix in later SQL CE builds


opherko wrote Jan 6, 2010 at 10:39 PM

This only seems to appear when the database has been recently compacted and the new file size is approximately the same as the old. But that is only based on a few observations.

jjchen wrote Feb 7, 2011 at 7:41 PM

Hi Opherko,

Max Database Size = '1280'
what is Max Database size defined?
we consider SQL ce database size, its maximum is 2GB.
here it seems it can not exceed 329 MB? why?

opherko wrote Feb 8, 2011 at 2:04 PM

Actually SQLCE max size is 4GB and I routinely set connection strings to 4000 MB. Jjchen seems to be having similar problems. I think this is a bug in the sqlcecmd. I haven't tried it for 4.0 yet to see if it is fixed.

wrote Feb 14, 2013 at 8:31 PM

wrote Sep 25, 2015 at 11:04 AM