cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
unityhealth
Engaged Sweeper
We have been running lansweeper for a number of years and noticed the tblNtlogMessage table is pushing 17GB. We don't use much in the way of historical reporting, so I'm wondering if we can just truncate this table and let it start over?
1 ACCEPTED SOLUTION
Hemoco
Lansweeper Alumni
Stop the Lansweeper service, run the script below instead (which won't write data to your log file) and restart the service.
truncate table [tblNtlog]
GO

ALTER TABLE [tblNtlog] DROP CONSTRAINT [FK_tblntlog_tblntlogmessage]
GO

truncate table tblntlogmessage
GO

ALTER TABLE [tblNtlog] WITH NOCHECK ADD CONSTRAINT [FK_tblntlog_tblntlogmessage] FOREIGN KEY([MessageID])
REFERENCES [tblNtlogMessage] ([MessageID])
NOT FOR REPLICATION
GO

ALTER TABLE [tblNtlog] CHECK CONSTRAINT [FK_tblntlog_tblntlogmessage]
GO

View solution in original post

7 REPLIES 7
amarosi1
Engaged Sweeper
winner winner chicken dinner! That fixed it! Thanks!
Hemoco
Lansweeper Alumni
Stop the Lansweeper service, run the script below instead (which won't write data to your log file) and restart the service.
truncate table [tblNtlog]
GO

ALTER TABLE [tblNtlog] DROP CONSTRAINT [FK_tblntlog_tblntlogmessage]
GO

truncate table tblntlogmessage
GO

ALTER TABLE [tblNtlog] WITH NOCHECK ADD CONSTRAINT [FK_tblntlog_tblntlogmessage] FOREIGN KEY([MessageID])
REFERENCES [tblNtlogMessage] ([MessageID])
NOT FOR REPLICATION
GO

ALTER TABLE [tblNtlog] CHECK CONSTRAINT [FK_tblntlog_tblntlogmessage]
GO
amarosi1
Engaged Sweeper
*bump*
amarosi1
Engaged Sweeper
After waiting 47mins i got this error

Msg 9002, Level 17, State 4, Line 1
The transaction log for database 'lansweeperdb' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
Msg 9002, Level 17, State 4, Line 1
The transaction log for database 'lansweeperdb' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
Hemoco
Lansweeper Alumni
Please try this

1) Stop Lansweeper service
2) Run this sql script
DELETE FROM [tblNtlog]
GO
ALTER TABLE [tblNtlog] DROP CONSTRAINT [FK_tblntlog_tblntlogmessage]
GO
DELETE FROM [tblntlogmessage]
GO
ALTER TABLE [tblNtlog] ADD CONSTRAINT [FK_tblntlog_tblntlogmessage] FOREIGN KEY([MessageID]) REFERENCES [tblNtlogMessage] ([MessageID])
GO

3) Start Lansweeper service
amarosi1
Engaged Sweeper
I'm running into the same issue - 10.2GB tblNtlogMessage and my Errorlog.txt is 24MB
Hemoco
Lansweeper Alumni
Please contact support@lansweeper.com and provide us with:
- Link to this forum thread.
- Program Files (x86)\Lansweeper\Service\Errorlog.txt, as present on your Lansweeper server, so we can see which Lansweeper version you're using.
- Screenshot of the Configuration\Scanning Setup\Database Scripts section of the web console, so we can see your table sizes and database server edition and version.