Examples of removing old items from AuditTable and AuditLoginTable

Build 1501 on 14/Nov/2017  This topic last edited on: 13/Jul/2016, at 11:43

IMPORTANT: DELETING ITEMS FROM THE AUDITTABLE OR OTHER DATABASE TABLES
MAY BREAK YOUR GN4 SYSTEM!

DO NOT DELETE ANYTHING WITHOUT CONSULTING TERA SUPPORT FIRST!

You may want to get rid of the old items in the AuditTable and AuditLoginTable

Queries to clear old logins and logouts

declare @DAYS int

set @DAYS = 90

delete from gn_AuditLoginTable where gn_Id in (select gn_ExtraInfo from gn_AuditTable where gn_Action=0 and DATEDIFF(dd, gn_time, GETDATE())>@DAYS)

delete from gn_AuditTable where gn_Action=0 and DATEDIFF(dd, gn_time, GETDATE())>@DAYS

delete from gn_AuditTable where gn_Action=1 and DATEDIFF(dd, gn_time, GETDATE())>@DAYS

Enter the appropriate number of days (@DAYS) and run it.

You may want to execute it before on a test system to find out how long it will take. The first time it will delete many records and will take probably a lot of time, so it would be better to execute it out of production.

Queries to clear actions 0,1 or 13

declare @DAYS int

set @DAYS = 90

delete from gn_AuditLoginTable where gn_Id in (select gn_ExtraInfo from gn_AuditTable where gn_Action=0 and DATEDIFF(dd, gn_time, GETDATE())>@DAYS)

delete from gn_AuditTable where gn_Action=0 and DATEDIFF(dd, gn_time, GETDATE())>@DAYS

delete from gn_AuditTable where gn_Action=1 and DATEDIFF(dd, gn_time, GETDATE())>@DAYS

delete from gn_AuditTable where gn_Action=13 and DATEDIFF(dd, gn_time, GETDATE())>@DAYS

Enter the appropriate number of days (@DAYS) and run it.

You may want to execute it before on a test system to find out how long it will take. The first time it will delete many records and will take probably a lot of time, so it would be better to execute it out of production.

Action codes

0 = Login

3403380

You can delete the rows containing these codes after confirmed by the Tera support

1 = Logout

390067

13 = Search

159645

14 = Objects load


15 = CheckOut

1822809

16 = UncheckOut

1821465

2 = Create

2201521

MUST NOT BE DELETED EVER!

3 = Update

1026866

6 = AutoUpdate

68504

4 = Spike

11892

10 = CopyTo

9067

19 = SpikeUpdate

760

21 = Print

186

See also

Making AuditTable smaller