Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-19932

Zabbix Server - Oracle Error ORA-00932 with NCLOB columns and DISTINCT on alrts table

XMLWordPrintable

    • Icon: Incident report Incident report
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • None
    • 5.0.14, 5.0.15, 5.4.4
    • Server (S)
    • None

      Hello,

      there is a problem in the Zabbix server for oracle according the usage of the NCLOB columns.

      Zabbix server tries to get data from the alerts table using the DISTINCT keyword including a NCLOB column.
      See the following statement, the message column is defined as NCLOB:

      select distinct userid,mediatypeid,subject,message,esc_step from alerts where actionid=28 and mediatypeid is not null and alerttype=0 and acknowledgeid is null and eventid=71910340 order by userid,mediatypeid,esc_step desc

      Resulting Error:
      ORA-00932: inconsistent datatypes: expected - got NCLOB [select distinct userid,mediatypeid,subject,message,esc_step from alerts where actionid=28 and mediatypeid is not null and alerttype=0 and acknowledgeid is null and eventid=71910340 order by userid,mediatypeid,esc_step desc]

      It does not matter if the query returns data. Also the following statement will fail:

      select distinct userid,mediatypeid,subject,message,esc_step from alerts

      In both cases you will get the ORA-00932 error because it is not supported by Oracle to use the DISTINCT keyword on a NCLOB column.

      To fix this problem the NCLOB column must be converted in the statement.
      The best way for that would be to use the dbms_lob.substr() function for that, because it can convert text values with more than 4000 characters.

      The following statement will succeed without the ORA-00932 error:
      SELECT DISTINCT userid,mediatypeid,subject,dbms_lob.substr(message, 65535, 1) ,esc_step
      from alerts

      So the Zabbix server should be modified to use the dbms_lob.substr() function on all CNLOB columns in the zabbix database in conjunction with DISTINCT queries.

            zabbix.support Zabbix Support Team
            thomas.oftring Thomas Oftring
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: