Follow

How to manually delete logs from the log tables

Applies To:

16.2 +

 

Summary:

You may want to manually clean up logs from the log table to free up space, to make an upgrade quicker or for some other reason. Prior to 16.2 it was one table and was very simple. In 16.2 we enhanced our logging and now there is a little more complexity in manual deletion. Below is an example to do so. You may need to alter it slightly to fit your database and date/time considerations.

More Info:

1. DELETE TOP(100000) FROM DAL_T_LOG_LOG_MESSAGE;

2. DELETE TOP(100000) FROM DAL_T_LOG_LOG_COMP WHERE NOT EXISTS (SELECT 1 FROM DAL_T_LOG_LOG_MESSAGE msg WHERE DAL_T_LOG_LOG_COMP.COMP_ID = msg.COMP_ID);

3. DELETE TOP(100000) FROM DAL_T_LOG_LOG_DATA WHERE NOT EXISTS (SELECT 1 FROM DAL_T_LOG_LOG_MESSAGE msg WHERE DAL_T_LOG_LOG_DATA.DATA_ID = msg.DATA_ID);

4. DELETE TOP(100000) FROM DAL_T_LOG_LOG_PARAMS WHERE NOT EXISTS (SELECT 1 FROM DAL_T_LOG_LOG_MESSAGE msg WHERE DAL_T_LOG_LOG_PARAMS.PARAMS_ID = msg.PARAMS_ID);

5. DELETE TOP(100000) FROM DAL_T_LOG_LOG_SOURCE_IP WHERE NOT EXISTS (SELECT 1 FROM DAL_T_LOG_LOG_MESSAGE msg WHERE DAL_T_LOG_LOG_SOURCE_IP.SOURCE_IP_ID = msg.SOURCE_IP_ID);

Note: You will want to change the query to probably have date/time in there so it does not delete all logs.

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk