[ZBXNEXT-6285] Oracle initial scheme creating and image loading in to the BLOB fields Created: 2020 Oct 22  Updated: 2024 Apr 10  Resolved: 2021 Jan 18

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: Frontend (F), Installation (I), Proxy (P), Server (S)
Affects Version/s: None
Fix Version/s: 5.4.0alpha1, 5.4 (plan)

Type: Change Request Priority: Trivial
Reporter: Gatis Rumbens Assignee: Andrejs Kozlovs
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File BEGINNING_OF_DIFF.png     PNG File END_OF_DIFF.png     GIF File map_error.gif    
Team: Team C
Sprint: Sprint 69 (Oct 2020), Sprint 70 (Nov 2020), Sprint 71 (Dec 2020), Sprint 72 (Jan 2021)
Story Points: 2

 Description   

When installing a ZABBIX server independent from Oracle RDBMS (not on a single server) - you will face the inconvenience of deploying the Zabbix database and the offered SQL files for creating an Oracle schema which comes with data and image data that is need to copy all images to the Oracle server fileystem (../misc/images/png_modern/* .png) to run this procedure later which loads the contents to the BLOB field from the filesystem files.

CREATE OR REPLACE PROCEDURE LOAD_IMAGE (IMG_ID IN NUMBER, IMG_TYPE IN NUMBER, IMG_NAME IN VARCHAR2, FILE_NAME IN VARCHAR2)
IS
        TEMP_BLOB BLOB := EMPTY_BLOB();
        BFILE_LOC BFILE;
BEGIN
        DBMS_LOB.CREATETEMPORARY(TEMP_BLOB,TRUE,DBMS_LOB.SESSION);
        BFILE_LOC := BFILENAME('IMAGE_DIR', FILE_NAME);
        DBMS_LOB.FILEOPEN(BFILE_LOC);
        DBMS_LOB.LOADFROMFILE(TEMP_BLOB, BFILE_LOC, DBMS_LOB.GETLENGTH(BFILE_LOC));
        DBMS_LOB.FILECLOSE(BFILE_LOC);
        INSERT INTO IMAGES VALUES (IMG_ID, IMG_TYPE, IMG_NAME, TEMP_BLOB);
        COMMIT;
END LOAD_IMAGE;
/

BEGIN
        LOAD_IMAGE(1,1,'Cloud_(128)','png_modern/Cloud_(128).png');
        LOAD_IMAGE(2,1,'Cloud_(24)','png_modern/Cloud_(24).png');
        ....

Instead I suggest loading the contents of the BLOB fields from the CBLOB (created from the BASE64 string that contains the PNG image data).

base64encode.sql
base64decode.sql

Or then create a column with text information (CLOB, VARCHAR2) which contains only BASE64 content, which can later be converted in the Zabbix UI using PHP to the displayed image.

This is just to reduce the inconvenience and time saving. Even more a such a thing already exists in MySQL and PGSQL Zabbix provided source SQL files (images.sql) - and that is only natural



 Comments   
Comment by Andrejs Kozlovs [ 2021 Jan 13 ]

Available in:

Comment by Andrejs Kozlovs [ 2021 Jan 15 ]

Updated documentation:

Generated at Wed Apr 23 13:21:36 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.