[ZBX-4188] Trunk not working with Oracle DB Created: 2011 Sep 29  Updated: 2017 May 30  Resolved: 2011 Dec 05

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 1.9.7 (beta)
Fix Version/s: 2.0.0

Type: Incident report Priority: Blocker
Reporter: dimir Assignee: Unassigned
Resolution: Fixed Votes: 2
Labels: NCLOB, Oracle, crash
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
RedHat EL 5.3 x64


Attachments: PNG File zabbix_error.png    
Issue Links:
Duplicate
is duplicated by ZBX-4239 oracle db faulty statements Closed
is duplicated by ZBX-4240 configuration -> items / triggers lis... Closed

 Description   

After an upgrade to 2.0 go to "Configuration" -> "Hosts" -> "Items" (of any host) and look down for the error:

ociexecute(): ORA-00932: inconsistent datatypes: expected - got NCLOB [include/db.inc.php:458]
SQL error [ORA-00932: inconsistent datatypes: expected - got NCLOB] in [SELECT DISTINCT i.*,f.triggerid FROM items i,functions f WHERE i.itemid BETWEEN 000000000000000 AND 099999999999999 AND 1=0 AND i.itemid=f.itemid]
ocifetchinto(): ORA-24374: define not done before fetch or execute and fetch [include/db.inc.php:606]

You can got to Oracle command-line (e. g. sqlplus) and execute next query in order to reproduce the error:

SELECT DISTINCT i.*,f.triggerid FROM items i,functions f WHERE i.itemid BETWEEN 000000000000000 AND 099999999999999 AND 1=0 AND i.itemid=f.itemid;

An error points to "i.*", selecting all the fields of an item. This is caused by the change of the "description" field in the "items" table from "nvarchar2(255)" to "NCLOB".



 Comments   
Comment by dimir [ 2011 Sep 29 ]

If you do a fresh install in trunk when viewing Items you won't get any output at all (even in debug mode). Same goes for triggers. In order to be able to see the error:

  • delete default host "Zabbix server"
  • add host "Zabbix server"
  • view it's items
Comment by dimir [ 2011 Oct 03 ]

I propose it's another blocker for 2.0 .

Comment by matthias zeilinger [ 2011 Oct 18 ]

any update on this issue, is it possilbe to simply change from NCLOB to NVARCHAR2?

Comment by matthias zeilinger [ 2011 Oct 24 ]

after i changed this field from NCLOB to NVARCHAR2(255) everything works fine

the max of NVARCHAR2 is 4000, i think this should be enough.

Comment by dimir [ 2011 Oct 24 ]

Who knows what was the reason for choosing NCLOB in the first place?

Comment by Alexey Fukalov [ 2011 Nov 11 ]

dev branch: svn://svn.zabbix.com/branches/dev/ZBX-4188

Comment by Olgierd Wolodkiewicz [ 2011 Nov 17 ]

I just downloaded trunk 1.9.8 23295 (17Nov2011) and this error is still there.
I am new so maybe I am not aware of that if you fix error 15th Nov it is not yet present in trunk 17th Nov?

Comment by richlv [ 2011 Nov 17 ]

it has only been fixed in a development branch (as noted above). when the fix will be tested & reviewed it will be merged to trunk

Comment by Alexey Fukalov [ 2011 Nov 21 ]

svn://svn.zabbix.com/trunk 23354

Comment by Olgierd Wolodkiewicz [ 2011 Nov 29 ]

Please tell me why this fix is not in 1.9.8 (beta) and even not in 1.9.9 (trunk)?

Comment by richlv [ 2011 Nov 29 ]

this fix was merged to trunk in revision 23354. what do you mean by "not in 1.9.8" ?

Comment by Olgierd Wolodkiewicz [ 2011 Nov 29 ]

In official Zabbix 1.9.8 (Third Beta Release of 2.0) released 25 November, 2011 in file ChangeLog is info:
---------
(...)
Bug Fixes:
(...)

  • ZBX-4188 fixed nclob problem for Oracle (Vedmak)
    ----------

but after upgrade to 1.9.8, I still have errors on Configuration (ITEMS and TRIGGERS lists) and Monitoring (Latest data) in Frontend.

I tried also most recent Pre-1.9.9.x (alpha) 23577 29 Nov, 2011 with the same result:

  • ociexecute(): ORA-00932: inconsistent datatypes: expected - got NCLOB [include/db.inc.php:439]
  • SQL error [ORA-00932: inconsistent datatypes: expected - got NCLOB] in [SELECT DISTINCT i.*,f.triggerid FROM items i,functions f WHERE i.itemid BETWEEN 000000000000000 AND 099999999999999 AND 1=0 AND i.itemid=f.itemid]
  • ocifetchinto(): ORA-24374: define not done before fetch or execute and fetch [include/db.inc.php:570]
Comment by Olgierd Wolodkiewicz [ 2011 Nov 29 ]

It is working properly but I had to manually modify items.description.

patch.sql didn't work for this line:
ALTER TABLE items RENAME COLUMN description to name;
because there was already column name in table items.

I removed manually empty column name from table items and rerun patch.sql - now it works perfectly

Comment by dimir [ 2011 Nov 30 ]

Reopening based on previous comment.

Comment by Alexander Vladishev [ 2011 Nov 30 ]

Please recreate a database with a new database schema and retest again.

The problem resolution consisted in change of types of fields from 'nclob' to 'nvarchar'

Comment by Guoyu Li [ 2011 Dec 05 ]

I got a similar error when login with another user(not admin, created myself), it was thrown when entering dashboard, by "Last 20 issues". The error disappeared after changing table SCRIPTS->DESCRIPTION from NCLOB to NVARCHAR.

Please see the screenshot for details.

Thanks.

Comment by Alexey Fukalov [ 2011 Dec 05 ]

As Alexander Vladishev have already said, database schema was fixed. If you create new database or upgrade from 1.8, everything should work.
If you have 2.0 schema created before this fix, you should manually change nclob fields to nvarcvhar2.

Please reopen issue if you have any problems with creation of new database or upgrading from 1.8.

Comment by Olgierd Wolodkiewicz [ 2011 Dec 05 ]

Yes. Everything related to these errors work fine after manual modification of types from NCLOB to NVARCHAR2 in database.
Thank you.

Generated at Fri Apr 26 18:22:01 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.