|Subject||Re: [firebird-support] Database/Backup consistency check|
On Mon, Jul 4, 2016 at 2:52 PM, 'Steffen Heil (Mailinglisten)' lists@... [firebird-support] <firstname.lastname@example.org> wrote:Late, but I was away...
I have a database on a hard drive which is failing. The hard drive already has some bad sectors and we are about to replace it.
Now I have a backup of that database created with gbak that I could use. However I am not sure if the hard drive was still fine, when the backup was created.If the backup succeeded, then the database file had no corrupted data pages or system pages. It might have corrupted pages in indexes on user tables.On the other hand, I can right now access the database just fine and I could try to simply copy it.Copying it is a good option if a backup fails - you'll have something to try to recover from.As third option I could create a new backup to external media right now.That would have been the best option. If the backup succeeded, then you would know that all your data is fine and up to date.
Now my questions:
- Is there any way to check a copied database file for corruption?If the file copy works without error (no file system I/O error) can I be sure or is there a command to be sure, if the file is completely intact?Gfix -v works on the physical level. Backup or sweep checks the logical consistency of data and system structures but not user indexes.- If I restore the backup and gbak does not report an error, can I be sure that everything is okay?Yes. If there were bad index pages, they will be replaced.- If I create a new backup and gbak does not report an error, can I be sure that the new backup is okay?Yes, the backup will be OK - yes there have been bugs in backup but they were generally mishandled dependencies ... not bad pages
There used to be a checksum in the page header, but IIRC that field was abandoned.Decades ago.Good luck,Ann