File: items_nvarchar_prepare.sql

package info (click to toggle)
zabbix 1%3A7.0.10%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 272,688 kB
  • sloc: sql: 946,050; ansic: 389,440; php: 292,698; javascript: 83,388; sh: 5,680; makefile: 3,285; java: 1,420; cpp: 694; perl: 64; xml: 56
file content (29 lines) | stat: -rw-r--r-- 1,640 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- nclob can be slow with high number of items and items preprocessing, to improve performance it can be converted to nvarchar2(4000)
-- Following select queries should be executed to find out templates that must be removed before converting nclob to nvarchar2(4000):
-- select h.name,i.name from item_preproc pp,items i,hosts h where pp.itemid=i.itemid and i.hostid=h.hostid and length(pp.params) > 4000;
-- select h.name,i.name from items i,hosts h where i.hostid=h.hostid and length(i.params) > 4000;
-- Alternatively if MAX_STRING_SIZE is set then it's possible to change nvarchar2(4000) to nvarchar2(32767) in following queries
ALTER TABLE items RENAME COLUMN params TO zbx_old_tmp;
ALTER TABLE items ADD params nvarchar2(4000) DEFAULT '';
UPDATE items SET params=zbx_old_tmp;
ALTER TABLE items DROP COLUMN zbx_old_tmp;

ALTER TABLE items RENAME COLUMN description TO zbx_old_tmp;
ALTER TABLE items ADD description nvarchar2(4000) DEFAULT '';
UPDATE items SET description=zbx_old_tmp;
ALTER TABLE items DROP COLUMN zbx_old_tmp;

ALTER TABLE items RENAME COLUMN posts TO zbx_old_tmp;
ALTER TABLE items ADD posts nvarchar2(4000) DEFAULT '';
UPDATE items SET posts=zbx_old_tmp;
ALTER TABLE items DROP COLUMN zbx_old_tmp;

ALTER TABLE items RENAME COLUMN headers TO zbx_old_tmp;
ALTER TABLE items ADD headers nvarchar2(4000) DEFAULT '';
UPDATE items SET headers=zbx_old_tmp;
ALTER TABLE items DROP COLUMN zbx_old_tmp;

ALTER TABLE item_preproc RENAME COLUMN params TO zbx_old_tmp;
ALTER TABLE item_preproc ADD params nvarchar2(4000) DEFAULT '';
UPDATE item_preproc SET params=zbx_old_tmp;
ALTER TABLE item_preproc DROP COLUMN zbx_old_tmp;