mobybrick Posted September 29, 2013 Posted September 29, 2013 Hey everyone, Is there a SQL query that I can execute to remove logon tracker entries over a certain age from the SQL logon tracker? Need to prevent my database filling up over time... Thanks! Moby
mobybrick Posted October 9, 2013 Author Posted October 9, 2013 Hi, Any ideas at all? Does anyone fancy writing a quick SQL script to truncate the log to say, the last 1000 entries? Or is no-one else worried about their log DB/disk drive filling up eventually? Ta Moby!
nickbro Posted October 10, 2013 Posted October 10, 2013 If your log file is filling up try this: Recover from a full transaction log in a SQL Server database
nickbro Posted October 10, 2013 Posted October 10, 2013 I always set the recovery mode to simple, which stops the log from getting too full
mobybrick Posted October 10, 2013 Author Posted October 10, 2013 Hi Nick, I don't mean the SQL transaction logs.... I meant the database holding the web log. If using the free version of SQL Express, then this is limited to a certain size. How to prune? Thanks Moby
nickbro Posted October 10, 2013 Posted October 10, 2013 My HAP Database has been running for 3 years now and it's still only 163.00 MB big
nickbro Posted November 5, 2013 Posted November 5, 2013 Here's the SQL Scripts, sorry for the delay: USE [hap] GO DELETE FROM [dbo].[TrackerEvents] WHERE [dbo].TrackerEvents.LogonDateTime <= '1/1/12' GO and to just clear any empty logoffs UPDATE [dbo].[TrackerEvents] SET [LogoffDateTime] = GETDATE() WHERE [dbo].TrackerEvents.LogonDateTime <= '1/1/12' AND [dbo].TrackerEvents.LogoffDateTime is null GO
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now