Shrink & Repair
SQL Server Compact can reduce the size of a database by removing unused pages. This operation occurs without the need for another file, temporary or otherwise, to be created.
SQL Server Compact can also repair a database by examining the database file for corruption and repairing it if it is required.
Note
The Shrink & Repair dialog box is available in Server Explorer in Visual Studio.
Options
None
Select None if you do not want SQL Server Compact to shrink or repair the database.
Shrink database by deleting free pages
Select Shrink database by deleting free pages if you want SQL Server Compact to delete free pages and shrink the database.
Perform full database compaction
Select Perform full database compaction to compact the whole database without deleting pages.
Repair physically corrupted databases
Select Repair physically corrupted databases to have SQL Server Compact look for database corruption and automatically repair the database.
Recover corrupted rows
If you select Repair physically corrupted databases, the Recover corrupted rows check box becomes enabled, and you can choose to preserve any corrupted rows.
Replace existing database
If you want to replace the existing database by using the new version that has been shrunk or repaired, select Replace existing database.
Create new database with this file name
To create a new database during the repair process, specify the path and a new file name for the database.
Overwrite existing database file
Select Overwrite existing database file to instruct SQL Server Compact to automatically overwrite the existing database during the repair process.
Advanced
Click the Advanced button to display SQL Server Compact advanced Shrink & Repair properties. For a list of properties, see Shrink & Repair - Advanced Properties.