|
|
|
|
|
|
|
|
Download - How to keep your Interbase database healthy
|
|
|

|
Marco Bommeljé 27 nov 2002
[email]
Simple recommendations for Interbase DBA's to avoid corruption of database files. And what to do when you suspect corruption.
General
- Maintain and preserve the database source code If you do not have the original database creation scripts, you can re-generate the database DDL using:
isql -extract -output <ddl_output> <db_name>
- With the DDL script you should be able to re-create an empty database. Make sure that this actually works.
Backup and restore
- Frequently
backup and restore using GBAK. GBAK performs consistency checks and housekeeping
operations that are vital to prevent database corruption.
Restoring the database from
a .gbk file builds database structures from scratch. Because it also rebuilds
the indices, it is also the best way to guarantee performance.
Also, garbage collection during backup ensures that back versions do not take up space in the restored database.
Finally, a GBAK backup/restore
cycle updates the database's On Disk Structure (ODS) when a new Interbase
server version is installed.
- Do not rely on .gdb file copies as backups.
If you must make copies
of .gdb files, ensure that the server is down. In principle, it should be
safe when there are no connections to the database, but then you need to
be sure nonew connections can be established. That means that you need to shut down the database before copying.
- Regularly
validate the database using GFIX Monitor the validity of the database on
a regular basis. This allows you to recognize problems soon after they occur
and take immediate steps.
- Regularly
check the server log for errors. Sometimes, the server has crashed and recovered
without anyone noticing (or warning you). Validate the database structure
when a crash has occurred .
Steps to take when the database seems corrupt
Try repairing the database using GFIX.
- Disable sweeping:
gfix -housekeeping 0 <db_name>
- Validate and Repair:
gfix -v -f <db_name>
- Mark corrupt data to skip on subsequent backup:
gfix -m <db_name>
- Read-Only Validate to detect more validation errors:
gfix -v -n <db_name>
- If this reports more errors, repeat the last three steps.
Try re-creating the database using GBAK.
- Backup without sweeping and ignoring checksum errors.
gbak -B -v -ig -g <db_name> <bu_name>
- Restore creating the database as new
gbak -C -v <bu_name> <db_name>
- If the restore does not succeed, try restoring with a commit after each table:
gbak -C -v -o <bu_name> <db_name>
If you succeeded in restoring the database partially, you will need to re-load the missing data using a separate procedure.
For more details and solutions, read:
Diagnosing and Repairing Database Corruption
Paul Beach, Sep 2000
http://www.ibphoenix.com
An in-depth article about possible causes of Interbase database
corruption:
http://delphi.weblogs.com/stories/storyReader$232
|
|
|
 |
 |
 |
|
|
|
(C) - Last updated: |
|
|
|