Manual:The Dude v6/Malformed db repair

From MikroTik Wiki
Jump to navigation Jump to search

Useful procedure on how to repair malformed db before importing in v6.xx The Dude versions. Procedure is done on v4.0b3 and after it is completed newly generated backups should work in new versions.

Warning: Works only on db versions up to v6.37 software builds.


Dude database repair description:

Preparation:

  • Close Dude Service und Dude.exe
  • Download sqlite3 and create the folder \Downloads\sqlite3 https://www.sqlite.org/download.html
  • Search Dude database file, such as-> C:\Users\"user"\AppData\Local\VirtualStore\Program Files (x86)\Dude\data\dude.db
  • copy dude.db in Downloads\sqlite3\...

Repair database:

<<<All history data will be lost>>>

  • run cmd with admin
  • change into sqlite3 directory
  • execute <echo .dump | sqlite3.exe dude.db > dude.sql> (export dude.db into sql text file)
  • edit dude.sql file with notepad++
  • save all lines starting with <INSERT INTO "objs"> into a new textfile <objs.sql>
  • in user folder delete dude.db , dude.db-journal and dude.view files
  • start dude (new empty dude.db file will be created)
  • close dude and copy new dude.db file into sqlite3 folder
  • start sqlite3 and execute <.open dude.db>
  • execute <pragma integrity_check;> (check dude.db)
  • with <delete from objs;> delete entries in objs
  • with <.read objs.sql> data from objs.sql will be importet into dude.db
  • <.quit> to close sqlite3
  • put new dude.db file from sqlite3 folder back into user directory
  • in user folder, delete any existing <dude.db-journal> and <dude.view> files
  • start dude and service. all settings will be back, just without history values
  • as soon, everithing works well, do a backup export out of dude. The new file should be much smaller in size


Credit goes to @Heydude for db repair manual in original forum post