Medoc. Database Error Fixes

One day, after a Medoc update, an error occurred while filling in counterparty data from the directory. I was asked to investigate. It turned out to be a bug. Medoc support sent me a patch, and a couple of days later they released an update for other users. But while I was searching for the cause, I discovered that there were errors in the database.

The task scheduler also had a task to create a program archive weekly, but with the “database check” box unchecked. I also checked the program archives for previous months and discovered that there were fewer errors in them, meaning the errors had arisen long ago.

Firebird has utilities for checking the database and making backups, so I used them, but first I made a copy of the ZVIT-Copy.FDB database file, then opened the command line and went to the directory with the utilities:

D:
cd D:\Program Files\Medoc\MedocSRV\Firebird_M\

Started checking the copy of the database file:

gfix.exe -v -full -user SYSDBA -password masterkey "D:\Program Files\Medoc\MedocSRV\ixnfo.com\db\ZVIT-Copy.FDB"

Essentially, the errors displayed are the same as when creating a program archive with a database check.

Created a backup copy:

gbak -b -user SYSDBA -password masterkey "D:\Program Files\Medoc\MedocSRV\ixnfo.com\db\ZVIT-Copy.FDB" D:\backup.fbk

Recovered from backup:

gbak -c -user SYSDBA -password masterkey D:\backup.fbk D:\newzvit.fdb

During recovery, indexes are recreated, damaged pages and garbage are removed, and the database is rebuilt. This process will prevent any database errors since the corrupted data is gone. Just in case, I left a copy of the original ZVIT.FDB file in case important data is lost. The file was about 5 GB in size and decreased by 130 MB after recovery.

Now all that remains is to stop the two Firebird Server + ZvitGrp services and replace the working database file ZVIT.FDB with the repaired file newzvit.fdb, and then restart the services.

services.msc

After that, there were no more errors, and in the Task Scheduler, I also checked the box to check the database when creating the program archive. If there are errors, the program archive won’t be created, and an empty file will be created instead. I synchronize local Medoc backups to a separate backup server, and this will be noticeable there. You can also create a script that will notify you when a small archive is created.

Leave a comment

Leave a Reply