[ZBX-6085] Query error in retrive host info on Oracle 10.1.0.4.0 EE Created: 2013 Jan 09 Updated: 2017 May 30 Resolved: 2013 Jan 31 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 2.0.3 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Major |
Reporter: | yayo | Assignee: | Unassigned |
Resolution: | Won't fix | Votes: | 0 |
Labels: | database, oracle, server | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
OS: ZABBIX: ORACLE: BANNER SQL*CLIENT (istant client): rpm -qa | grep oracle-instant sqlplus /nolog NSL_LANG: PARAMETER VALUE PARAMETER VALUE |
Issue Links: |
|
Description |
Errors found in zabbix server log: [Z3005] query failed: [-1] ORA-01425: escape character must be character string of length 1 [select host from hosts where host like 'servername.domain.net%' escape '!' and hostid between 0 and 99999999999999] escape character used is '!' Workaround used: |
Comments |
Comment by yayo [ 2013 Jan 09 ] |
I think this a zabbix realted bug: I have found a note in oracle MOS (AKA metalink): ORA-01425 when using 'like' or 'escape' on NVARCHAR2 column [ID 1470516.1] Solution Change the query on the NVARCHAR2 column to Use TO_CHAR or LIKEC Please use any of the following solutions : select * from t1 where to_char(col2) like '%\?“%' escape '\'; or select * from t1 where col2 likec '%\?“%' escape '\'; I think the problem is inside zabbix server not frontend. I don't know where |
Comment by yayo [ 2013 Jan 09 ] |
I have started a find against all zabbix source. Only related string with "escape" are: ./libs/zbxdbhigh/db.c:1142: * ... LIKE 'a!_b!%c\\d\'e!!f' ESCAPE '!' (MySQL, PostgreSQL) * ./libs/zbxdbhigh/db.c:1143: * ... LIKE 'a!_b!%c\d''e!!f' ESCAPE '!' (IBM DB2, Oracle, SQLite3) * based on metalink note 1470516.1 above, the strings must be: LIKE 'a!_b!%c\d''e!!f' ESCAPE '\!' |
Comment by yayo [ 2013 Jan 11 ] |
I have tested the 3 workaround and no one works ... it's a blocker issue and i can't change status of bug |
Comment by Andris Zeila [ 2013 Jan 31 ] |
Actually the problem comes from this place (src/libs/zbxdbhigh/db.c:1987) result = DBselect( "select host" " from hosts" " where host like '%s%%' escape '%c'" ZBX_SQL_NODE, host_name_sample_esc, ZBX_SQL_LIKE_ESCAPE_CHAR, DBand_node_local("hostid")); Changing the code you listed above won't affect anything. But the problem might be You environment data appears to be truncated, could you please check what charsets |
Comment by yayo [ 2013 Jan 31 ] |
Based on your query, this is the output:
SQL> select * from v$nls_parameters where parameter like '%CHARACTERSET%';
PARAMETER VALUE
---------------------------------------------------------------- ----------------------------------------------------------------
NLS_CHARACTERSET AL32UTF8
NLS_NCHAR_CHARACTERSET AL16UTF16
|
Comment by Andris Zeila [ 2013 Jan 31 ] |
That explains. Apparently there are some conversion problems with like operator and nvarchar2/varchar2 types. But, Zabbix requires UTF8 character set (see Oracle section in http://www.zabbix.com/documentation/2.0/manual/appendix/install/db_scripts#scripts), so I'm closing this one. |
Comment by yayo [ 2013 Jan 31 ] |
Ok... So what is the right output i need to see with this query?
select * from v$nls_parameters where parameter like '%CHARACTERSET%';
This for my DBAs ... Thank you! |
Comment by Andris Zeila [ 2013 Jan 31 ] |
NLS_NCHAR_CHARACTERSET should also be AL32UTF8 |