Full Validation
By default, validation works at page level. If no need to go deeper and validate at the record level as well, the command to do this is:
gfix -v[alidate] -full database_name
using this option will validate, report and update at both page and record level. Any corrupted structures etc will be fixed.
[...]
Database Recovery
If the database validation described above produces no output then the database structures can be assumed to be valid. However, in the event that errors are reported, you may have to repair the database before it can be used again.
Recover a Corrupt Database
The option required to fix a corrupted database is the gfix -m[end] command. However, it cannot fix all problems and may result in a loss of data. It all depends on the level of corruption detected. The command is:
gfix -m[end] database_name
This causes the corruptions in data records to be ignored. While this sounds like a good thing, it is not. Subsequent database actions (such as taking a backup) will not include the corrupted records, leading to data loss.
Important
The best way to avoid data loss is to make sure that you have enough regular backups of your database and to regularly carry out test restorations. There is no point taking backups every night, for example, if they cannot be used when required. Test always and frequently.
Equally, when attempting to recover a potentially corrupted database, always work with a copy of the main database file and never with the original. Using the -mend option can lead to silent deletions of data because gfix doesn't care about internal database constraints like foreign keys etc, the -mend option simply says to gfix "go ahead and clean out anything you don't like".
为什么使用FIX_FSS_METADATA和FIX_FSS_DATA进行备份? –
我认为这有助于我的数据有任何损坏。还是仅在恢复过程中使用?我运行没有它也得到了同样的错误,所以我想在这种情况下FIX_FSS_METADATA和FIX_FSS_DATA没有帮助。 –
FIX_FSS_METADATA和FIX_FSS_DATA不修复任何数据库结构或数据的损坏。它们用于帮助将数据库从Firebird 1.x,2.0.x迁移到2.5版本。 –