Repairing a corrupt 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 database is corrupt, you can use a built-in Lansweeper tool to perform a repair.

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 ]

To repair your 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