Hello,
i’m trying to open dude db exported from two different router on 7.16, but unfortunately when i try to using sqlite3, it returns that this file is not a database.
I want to open it since in the past i made some shrinking and cleaning of DB thanks to guide posted which tells that deleting historical data will reduce the size of DB.
I have also some problem regarding dude, when i remove a dependencies, it crashes.
Thanks a lot for your support.
You can not do this. DB has Mikrotik appended header, which IMHO has checksum for real SQLite DB. If you cut this header, you will get normal DB, but this is the end. Dude does not start edited DB with same old header.
Cut this part to gen normal DB
Hello, surprisingly i was able to open the db, remove the history data and re-import into dude, thanks to this guide:
- Transfer database to Windows PC (i was using Debian)
- Download sqlite3.exe https://www.sqlite.org/download.html
- The following is from http://www.abit.ie/how_to_solve_dude_issue_with_database/
- sqlite3.exe dude.db
- pragma integrity_check;
At this stage you probably will be able to see errors like Error: “database disk image is malformed” (i don’t see any error) - vacuum;
- .output dude.sql
- .dump
- .exit
Check your folder sqlite3 you should see that the dude.sql file, is much bigger than database file - Rename “dude.db” to “dude.db.old”
- Text edit dude.sql (i was using nano)
- Remove all lines that DO NOT start with “INSERT INTO objs”
Most of the file is outage history - Save as objs.sql
- Connect to the router and open files
- Delete dude.db
- Start Dude server to make it create an empty database
- Stop Dude server
- Transfer empty database to PC
- sqlite3.exe dude.db
- pragma integrity_check;
This time there should be no error because we use clean database. - vacuum;
- delete from objs;
- .read objs.sql
- .exit
- Transfer dude.db to router
- Start Dude server
Now i can see a much smaller db, but i still have error when i try to remove some dependencies.
I also used this great tool: GitHub - german77/TheDudeToHuman: Converts "The Dude" database from Mikrotik into something more usable than binary blobs and it gives me back the json of all the db. During the export it reports some corrupted entry linked to services (i can understand that the sys id is regarding a service of a device) but if i clear the services and trying to redo everything, it founds another errors.
Someone can help me in this?
Thanks