Clean up of EH tables in Postgres (PSQL) database in v12.2 and v12.3
Release:12.2, 12.3, 21.0
Component: AUTOMIC AUTOMATION ENGINE
In different situation it might be necessary to clean up the Activity Window of an Automic Operation Manager / Automic Automation Engine.
The cleanup is possible in two different ways:
The SQL statements delete all activities specified in the sub- select. Therefore it's very important to use the same sub-select for all statements!
With the sub-select it's possible to choose which activities you like to remove. Most common is to specify the client and the name of the object. This is also used in the examples below.
Here some other fields sometime used – in general all fields of the eh-table can be used if necessary:
Name | DB Field Name | Example |
Client | EH_CLIENT | EH_CLIENT = 22 |
Activity or Object Name | EH_NAME | EH_NAME = 'SCRI.BIG.RUNFOREVER' |
RunID | EH_AH_IDNR | EH_AH_IDNR = 1234567890 |
Activity or Object Type | EH_OTYPE | EH_OTYPE = 'JOBS' |
Status / Status Number | EH_STATUS | EH_STATUS = 1572 |
Start Timestamp | EH_STARTTIME | EH_STARTTIME < '2011-06-16 00:00:00' |
Agent | EH_HOSTDST | EH_HOSTDST like 'WIN%' |
The different DB fields are combined with "or" and "and". Here an example:
(select EH_AH_IDNR from EH with (nolock) where EH_CLIENT = 22 and EH_OTYPE = 'JOBS' and EH_STATUS = 1572 and EH_STARTTIME < '2011-06-16 00:00:00' and EH_HOSTDST like 'WIN%')
So this one will select all activates which are in client 22 and have the object type "JOBS" and the status 1572 – which is "Generating". The start of the Jobs has to be at latest on 15th of June 2011 or earlier and the Jobs run on Agents with the name "WIN…." in the beginning.
Most important is to select the correct activities via the sub-select. If you are in doubt about that, just verify which activities will be affected. Use the sub-select created and add for example client, object type and name and the RunID for output. Here an example:
select EH_CLIENT, EH_OTYPE, EH_NAME, EH_AH_IDNR from EH with (nolock) where EH_CLIENT = 22 and EH_OTYPE = 'JOBS' and EH_STATUS = 1572 and EH_STARTTIME < '2011-06-16 00:00:00' and EH_HOSTDST like 'WIN%'
The statements set the end date for the statistic record and for the reports to the current DB time. If a specific timestamp is necessary it is possible to remove GETDATE() and specify specific date and time.
Example:
Use '2011-06-16 00:00:00' instead of GETUTCDATE() will set the end timestamp to 16th of June 2011, 00:00 AM.
As the cleanup of activities is a serious action, it should be done guided by a Automic support engineer only! Therefor the statements itself are not posted in this article.
For further information on this knowledge base article please contact Automic Support.