adminbd

Записи по mssql,oracle,windows и linux

Have a Question?

If you have any question you can ask below or enter what you are looking for!

Zabbix. Очистить базу zabbix.

Заходим в mysql

mysql -u root

B ходим в базу

use zabbix;

И чистим

DELETE FROM history WHERE itemid NOT IN (SELECT itemid FROM items WHERE status='0');
DELETE FROM history_uint WHERE itemid NOT IN (SELECT itemid FROM items WHERE status='0');
DELETE FROM history_str WHERE itemid NOT IN (SELECT itemid FROM items WHERE status='0');
DELETE FROM history_text WHERE itemid NOT IN (SELECT itemid FROM items WHERE status='0');
DELETE FROM history_log WHERE itemid NOT IN (SELECT itemid FROM items WHERE status='0');
DELETE FROM trends WHERE itemid NOT IN (SELECT itemid FROM items WHERE status='0');
DELETE FROM trends_uint WHERE itemid NOT IN (SELECT itemid FROM items WHERE status='0');

и 2 вариант

TRUNCATE alerts;
TRUNCATE acknowledges;
TRUNCATE events CASCADE;
TRUNCATE auditlog CASCADE;
TRUNCATE auditlog_details CASCADE;
TRUNCATE history;
TRUNCATE history_uint;
TRUNCATE history_log;
TRUNCATE history_str;
TRUNCATE history_text;
TRUNCATE trends;
TRUNCATE trends_uint;
TRUNCATE auditlog;