Repairing a corrupt SQL Compact database

Lansweeper data can be stored in a Microsoft SQL LocalDB, Microsoft SQL Server or (deprecated) Microsoft SQL Compact database. Certain operations, like manipulating your database file while services are connected to it, can lead to corruption of your SQL Compact database and errors like the one below. If your SQL Compact database is corrupt, you can use a built-in Lansweeper tool to perform a repair. This article explains how.

The database file may be corrupted. Run the repair utility to check the database file. [ Database name = C:\Program Files (x86)\Lansweeper\SQLDATA\lansweeperdb.sdf ]
Keep in mind that, from March 2020 onward, SQL Compact is no longer a supported database server for hosting Lansweeper. In addition to repairing your SQL Compact database in case of corruption, we recommend migrating it to SQL LocalDB or SQL Server.

To repair your corrupt SQL Compact database, do the following:

  1. Stop the Lansweeper Server service in Windows Services
    stopping the Lansweeper service
  2. Stop your web server service in Windows Services. Keep in mind that this will log everyone out of the console. Your web server service is either IIS Express or World Wide Web Publishing Service (IIS).
    stopping the web server service
  3. Take a backup of your SQL Compact database by creating a copy of the following file:
    Program Files (x86)\Lansweeper\SQLData\lansweeperdb.sdf
  4. Run the following tool on your Lansweeper server:
    Program Files (x86)\Lansweeper\Tools\DatabaseMaintenance.exe
    running the Lansweeper Database Maintenance tool
  5. Hit the Verify button, then Repair and then Compact. Each operation may take a while to complete.
  6. Restart the Lansweeper and web server services in Windows Services.
    starting the Lansweeper and web server services

Related Articles

Get Started Right Away

Try Lansweeper for Free