AppWorx, Dollar Universe and Sysload Community

 View Only

Management Server: Repairing a SQLite Database

  • 1.  Management Server: Repairing a SQLite Database

    Posted Dec 18, 2017 06:10 AM
    If the the Management Server's database is corrupted. The error below appears in the logs of the MS "<sysload>\sldmgts\sldmgts.log "

    DD.MM  HH:MM:SS YYYY: LPtrVerif - OBaseOfObjects.c[1479] - Invalid Pointer Error
    DD.MM  HH:MM:SS YYYY: sldmgts - ODbMgrResultSet_FreeResult() failed: couldn't delete compiled statement: database disk image is malformed (DB rc=11)

    There are two different issue:
    • On the SQLite data file.
    • On the Sysload objects: ACLs, agents, events, models ...

    Repairing the SQLite file systematically leads to inconsistencies on Sysload objects: an object that lacks a property, an object without its associated ACL ... At first, you must first repair the SQLite file and also restore consistency from the base of Sysload objects.

    NB: Please read the entire procedure carefully before performing any manipulation on the database. If you are not sure if you can perform these operations, we recommend that you open an incident on our Portal and send us the following files and your database. This procedure may require in-depth database skills.

    Repairing the database (SQL Lite) :

    • Stop the Management Server
    • Back-up the database's file
                  - Windows : <sysload>\sldmgts\storage\sldat\sld_objects_repository
                  - Linux : /usr/local/sysload/sldmgts/storage/sldat/sld_objects_repository
    • Use a SQLite's client in CLI: 
    $ sqlite3 sld_objects_repository
    sqlite> pragma integrity_check;

    sqlite> .quit
    $ echo .dump | sqlite3 sld_objects_repository > sld_objects_repository_repaired.sql
    $ sqlite3 -init sld_objects_repository_repaired.sql sld_objects_repository_repaired

    The new database file is: sld_objects_repository_repaired

    Restoring Sysload Object Base Consistency

    *** We recommend that you send us your database so we can do this. ***

    Please use a SQL client for SQLite, as SQLiteSpy. 

    This is to directly manipulate the records constituting the Sysload objects. Knowledge of the schema's database is a requirement.

    Please use a SQL client for SQLite, as SQLiteSpy.

    Example: Unable to add an alert "EVN | Unix-FS |"

    • Retrieve the SQL IDs of the event and the associated ACL: 
    select * from sld_object where sld_object_key="EVN|Unix-FS|" -- ID de l’objet 14420
    select * from sld_object where sld_object_key=14420 -- -- l'ACL est 14421


    •  Checking the properies:


    select * from sld_property where sld_object_id=14421select * from sld_property where sld_object_id=14420



    •  Delete ACL:


    delete from sld_object where sld_object_id=14421delete from sld_property where sld_object_id=14421


    •  Delete the associated objectle:


    delete from sld_object where sld_object_id=14420delete from sld_property where sld_object_id=14420


    Le fichier sld_objects_repository_repaired obtenu est le nouveau fichier de données SQLite. Il suffit ensuite de remplacer le fichier 'sld_objects_repository' par le fichier sld_objects_repository_repaired et de redémarrer le Management Server.

    The resulting sld_objects_repository_repaired file is the new SQLite database. Then simply replace the 'sld_objects_repository' file with the sld_objects_repository_repaired file and restart the Management Server.