on 02-16-201507:30 PM - edited on 04-08-202403:20 PM by Nils
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:
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
Determine which database server is hosting your Lansweeper database by using the ConfigEditor tool. You can follow the instructions in this knowledge base article.
Stop the Lansweeper Server service in Windows Services on all of your scanning servers.
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).
Run the DatabaseMaintenance tool on your Lansweeper server, which can be found at Program Files (x86)\Lansweeper\Tools\DatabaseMaintenance.exe.
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.
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
Restart the web server service in Windows Services.
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.
Lower the Delete eventlog entries after XX dayssetting as much as possible on the same page.
If you're scanning performance information of Windows or Linux computers, lower the Delete performance counter data after XX dayssetting as much as possible.
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.
Restart the Lansweeper Server service in Windows Services and wait a few minutes for the automated cleanup options to finish running.
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.