I have a large SQL Server CE .sdf file with lots of historical data in it. Recently, the file hit the max file size limit for both my connection string and SQL Server CE.

I'm trying to use SQLCECmd40.exe to make a connection and delete data or shrink the file but each time I run a command, this message is shown.

SqlCeCmd40.exe -d "Data Source='Diagnostics.sdf';" -e compact

or

SqlCeCmd40.exe -d "Data Source='Diagnostics.sdf'; Max Database Size=4091;" -e compact

or

SqlCeCmd40.exe -d "Data Source='Diagnostics.sdf'; Max Database Size=4091;" -q "select top 10 Trace from Request order by Trace ;"

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) = 4092 ]
Minor Err.: 25104
Source : SQL Server Compact ADO.NET Data Provider
Num. Par. : 4092

Windows reports the file's size on disk as 3.99 GB (4,292,657,152 bytes).

How can I regain access to this file to delete old data, compact and shrink the file?

0

There are 0 best solutions below