Monday 16 September 2024

How to Switch HANA alerts off/on with SQL Statement ?

 we can switch off the underlying alert checker, so it no longer runs automatically or you can switch it back on again using the following methods:

If you need to disable or enable these alerts in batch (more than one at once), the easy way is to manipulate STATISTICS_SCHEDULE (_SYS_STATISTICS).
STATISTICS_SCHEDULE Table (Embedded Statistics Service)
Statistics schedule per host. This view contains information only for the last 7 days.

 

Caution
If you switch off alerts, you may not be warned about potentially critical situations in your system.
Be careful when modifying data on SYSTEM_STATISTICS through SQL Script.

For example: You want to disable all the schedules for the alerts shown in both HANA Cockpit > Configure Alerts / HANA studio > Alerts. Run the following statement:

UPDATE _SYS_STATISTICS.STATISTICS_SCHEDULE SET "STATUS" = 'Inactive' where "ID" between 1 and 710

In case you want to activate them back to the original schedule, you can run the following statement:

UPDATE _SYS_STATISTICS.STATISTICS_SCHEDULE SET "STATUS" = 'Idle' where "ID" between 1 and 710

You can build your own scripts and procedures for this purpose. For example, to save the current status of the alerts to restore later or to just disable a few alerts for a given maintenance window.