Cleaning Up Errorlogs

Cleaning Up Errorlogs

  
Hi guys,

Does anyone of you have experience in cleaning up errorlogs?
My Production Platform Server has been logging loads of errors for about a month.
My log tables are about 1.3 Gigabyte in size combined. (Should be a few MB at moast if you'd ask me)

Can I just use something like this without trashing my entire installation:
TRUNCATE TABLE dbo.oslog_Error_0;
TRUNCATE TABLE dbo.oslog_Error_1;
TRUNCATE TABLE dbo.oslog_Error_2;
TRUNCATE TABLE dbo.oslog_Error_3;
TRUNCATE TABLE dbo.oslog_Error_4;
TRUNCATE TABLE dbo.oslog_Error_5;
TRUNCATE TABLE dbo.oslog_Error_6;
TRUNCATE TABLE dbo.oslog_Error_7;
TRUNCATE TABLE dbo.oslog_Error_8;
TRUNCATE TABLE dbo.oslog_Error_9;


Ofcourse I could also use some kind of advanced GROUP BY / HAVING script that finds the common duplicate error notifications and wipe those; but I'm just looking for an effective, efficient way to quickly cleanup a mess. :)
Ok; executing a Truncate worked nice but didn't make the database any smaller.
Use below statements to "Shrink" your database file.
 
ALTER DATABASE outsystems SET RECOVERY SIMPLE
GO
DBCC SHRINKFILE (outsystems, 5)
GO
ALTER DATABASE outsystems SET RECOVERY FULL
GO
Hi Eric,

Just dont forget that when switching the database to simple mode you lose the backup log chain up to that point, so no recovery to previous points will be available.
If that is not an issue why have the database in full mode anyway?

Regards,
João Rosado
Hi João,

Good point.
This however is just a one-time action; so full recovery mode is 'normally' indeed preferred.
Moving to simple is merely to speedup the cleanup for this one time.

For the same reason I'm using a TRUNCATE instead of a DELETE statement.

I did a snapshot before executing the task, so if needed a full restore would be possible.
Hi guys,

Just as a followup for the proposed solution.

The following causes the Transaction log of the system to grow very rapidly.
Every action executed on the databased is stored in it and causes the database transaction log to grow.
ALTER DATABASE outsystems SET RECOVERY FULL

In order to eliminate this do the following:
ALTER DATABASE outsystems SET RECOVERY SIMPLE
GO

After that make sure you shrink the log Files (Task on the database).

I just shrunk my Transaction Logfile by about 54 Gigabytes :)