2011-11-04 48 views
2

我想备份firebird数据库。以下是我用来执行备份的命令。备份期间的火鸟错误

gbak -b -v -user SYSDBA -pass ***** -service localhost:service_mgr -verify -y E:/logs/backup_20111104.log D:\data\campaign.FDB E:/backup/campaign_20111104.fbk -FIX_FSS_METADATA WIN1252 -FIX_FSS_DATA WIN1252 

但是,运行2小时后,它以一般错误结束(仅在最后一行)。以下是错误。

gbak:22068 records written 
gbak: writing data for table AA_1307265720107_842 
gbak:19872 records written 
gbak: writing data for table AA_1301338383915_1025 
gbak:4 records written 
gbak:Exiting before completion due to errors 

此数据库中有700多个表格。数据库大小为129GB。

我需要获取完整的堆栈跟踪(如果有的话)。或者任何想法在哪里检查,所以我可以知道实际的错误?

+0

为什么使用FIX_FSS_METADATA和FIX_FSS_DATA进行备份? –

+0

我认为这有助于我的数据有任何损坏。还是仅在恢复过程中使用?我运行没有它也得到了同样的错误,所以我想在这种情况下FIX_FSS_METADATA和FIX_FSS_DATA没有帮助。 –

+0

FIX_FSS_METADATA和FIX_FSS_DATA不修复任何数据库结构或数据的损坏。它们用于帮助将数据库从Firebird 1.x,2.0.x迁移到2.5版本。 –

回答

1

尝试备份之前修复数据库:

gfix -mend -full -ignore <db name> -user sysdba -pas masterkey 

备份时增加两个开关-g -Ig为了禁止垃圾收集和忽略校验和错误。

+0

我是否需要先关闭从我的应用程序到数据库的所有连接?因为我得到这个错误: “关于附加或创建数据库的错误参数 - 二级服务器附件无法验证数据库” 我谷歌它,发现gfix需要有独占访问数据库。 –

+1

是的。验证数据库需要完全控制文件。不允许其他连接。 –

+0

好的,那种情况下,我需要安排与客户以后的应用程序停机时间。我会先用'-g -ig'选项进行备份。 –

0

查阅gfix手册章节Database Validation and Recovery

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".

这些是本节最重要的一点,但请务必阅读整章。如果您需要额外的支持,在Firebird支持列表中,有许多人熟悉Firebird的来龙去脉以及如何处理这些类型的错误。