cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Lansweeper
Lansweeper Tech Support
Lansweeper Tech Support

TL;DR-Sweepy-Icon (1).png
This page explains how you can clear tables in your database to free up space or improve performance in general.


In general, the cleanup options found in the web console under Configuration > Server Options should keep the size of your Lansweeper database within limits. Cleanups are performed when the Lansweeper Server service is started and subsequently every 24 hours. If you're scanning a lot of Windows data however, and storing a lot of historical information, a more radical cleanup of your Lansweeper database may be required.

If Lansweeper is using more memory, processor resources or disk space than desired, or if web console or service performance is not like it used to be, clearing some of your largest database tables is recommended. Databases hosted in SQL LocalDB and SQL Server Express are limited in size by Microsoft.

SQL Compact is no longer a supported database server for hosting Lansweeper. To learn how you to move to SQL LocalDB or SQL Server, see Convert a deprecated SQL Compact database.

Uncontrolled database growth will negatively impact performance and may even cause you to reach your database server's built-in size limit, which in turn can lead to errors such as:

Spoiler
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) = 4091]
Could not allocate space for object in database 'lansweeperdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.

Clear database tables

  1. Determine which database server is hosting your Lansweeper database by using the ConfigEditor tool. You can follow the instructions in this knowledge base article.
  2. Stop the Lansweeper Server service in Windows Services on all of your scanning servers.
    procedure-stopping-the-lansweeper-service.jpg
  3. 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).
    procedure-stopping-the-web-server-service.jpg
  4. Run the DatabaseMaintenance tool on your Lansweeper server, which can be found at Program Files (x86)\Lansweeper\Tools\DatabaseMaintenance.exe.
    menu-databasemaintenance.jpg
  5. Select Truncate logs, then Shrink and then Compact (if highlighted). Each operation may take a while to complete.
    This step will clear the tblNtlog and tblNtlogMessage tables in your database, deleting all Windows event log information from your database. Event log data generally takes up the most space. You can still scan new events afterward.
  6. Open the Script Execution tab of the tool and execute the script below. This will rebuild all indexes in the database. Keep in mind that this script may take a while to complete.
    execute PsysRebuildAllIndexes
  7. Restart the web server service in Windows Services.
    procedure-starting-the-web-server-service.jpg
  8. Scanning non-error events from your Windows computers' Event Viewers quickly increases the size of the database. Disable scanning of any event types you don't need in the Configuration > Server Options section of the web console.
    clearing-tables-to-free-up-space-and-improve-performance-3.jpg
  9. Lower the Delete eventlog entries after XX days setting as much as possible on the same page.
    clearing-tables-to-free-up-space-and-improve-performance-4.jpg
  10. If you're scanning performance information of Windows or Linux computers, lower the Delete performance counter data after XX days setting as much as possible.
    clearing-tables-to-free-up-space-and-improve-performance-6.jpg
  11. If you're scanning performance information of Windows or Linux computers, reduce the number of machines you're scanning performance data for under Scanning > Performance Scanning.
    menu-scanning-performance-scanning.jpg
  12. Restart the Lansweeper Server service in Windows Services and wait a few minutes for the automated cleanup options to finish running.
    procedure-starting-the-lansweeper-service.jpg

Was this post helpful? Select Yes or No below!
Did you have a similar issue and a different solution? Or did you not find the information you needed? Create a post in our Community Forum for your fellow IT Heroes!
More questions? Browse our Quick Tech Solutions.


Was this article helpful? Yes No
No ratings

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now
Version history
Last update:
‎04-08-2024 03:20 PM
Updated by: