Professional Documents
Culture Documents
Emergency and data availability tools for InterBase and Firebird databases
IBSurgeon contacts:
www.ib-aid.com su""ort#ib-aid.com
More information:
Data uard ! "rotecting your data $mergency too%set for &irebird and InterBase
Contents
Firebird and InterBase databases' corruptions reasons....................................................1 Hardware-related errors................................................................................................3 Abnormal shutdown..................................................................................................3 Light HDD corruption.................................................................................................3 Hea ! HDD corruption..............................................................................................3 "D#D$D corruption....................................................................................................% Flash Dri e corruption...............................................................................................% &A' corruption.........................................................................................................% Lac( o) dis( space )or the database.........................................................................% Lac( o) dis( space )or temp )iles...............................................................................* Lac( o) dis( space )or interbase.log or )irebird.log...................................................* "orruptions caused b! maintenance carelessness .....................................................+ Accidentall! deleted database )ile.............................................................................+ ,Disappeared- )iles on Linu.#/ni.#H0-/1#................................................................+ 2rroneous implementation limits...................................................................................3 3+.+4b limit o) table's si5e.......................................................................................3 BL6B ma.imum si5e restrictions..............................................................................3 7oo man! transactions in pre InterBase +.* ersions...............................................3 7oo man! generators ...............................................................................................8 "orruptions caused b! 9:L..........................................................................................8 "reating and dropping tables during intensi e users' wor(......................................8 7his is not the end.........................................................................................................; "ontacts ...................................................................................................................... .;
' IBSurgeon
' IBSurgeon
CD/D D corruption
If you store databases on DADs or BDs ! for arc)i0ing "ur"oses or as a read-on%y dictionary database ! t)ey may brea6. +sua%%y t)e s)owing of corru"tion is t)at you can-t read t)e database fi%e from t)e DAD. *)e first t)ing to do is to e/tract t)e corru"ted fi%e from t)e DAD wit) some too% %i6e &i/DADC +nfortunate%y, in DDE of cases, a database fi%e e/tracted from a DAD is in a bad state: t)e e/tracted fi%e is t)e rig)t si<e but it is fi%%ed wit) a mi/ture of database "ages and garbage=<ero data. *)e most affordab%e way w)en e/tracting database fi%es from DAD is to create an image of t)e entire DAD .4.F b1 and %oo6 for database "ages in t)is area wit) s"ecia% IBSurgeon too%s.
!A" corruption
(mongst a%% )ardware corru"tions, 8(M corru"tion is t)e rea% nig)tmare. In genera%, it-s fortunate t)at 8(M corru"tion becomes a""arent wit) a BS;D .B%ue Screen ;f Deat)1 or ot)er critica% e0ents w)ic) can be easi%y detected by system administrator. But sometimes 8(M corru"tion is so s%ig)t t)at on%y s"ecia% too%s can detect it and it s)ows its teet) on%y during intensi0e usage. :)en ot)er )ardware corru"tions occur, it-s at t)e database "age %e0e%. :)o%e "ages are missed w)i%e ot)er "ages are intact. *)e "rob%em w)en 8(M becomes corru"ted is t)at any bit in t)e database fi%e can be intermittent%y c)anged from 0 to ?, or 0ice 0ersa. *)is 6ind of corru"tion is recogni<ab%e on%y after t)e fact: it s)ows u" on%y w)en some database "age become sufficient%y corru"ted to trigger an error. So, RAM corruption is hidden until the level of damage becomes critical. I once saw a couple of databases from a single server with corrupted RAM. The customer sent them one by one, with various corruptions, before I asked him to send me the interbase.log. There, I saw multiple rong record length errors, rong page type and even several esoteric errors. e tested the RAM with the memtest tool and found RAM problems. ( furt)er "rob%em e/)ibited wit) 8(M corru"tion is t)at attem"ts to 0a%idate t)e database wit) gfi/ on t)e com"uter wit) t)e bad 8(M can "roduce different resu%ts eac) time you run it. :orse, t)e wor6 of gfi! "mend, w)ic) tries to fi/ errors, can "roduce additiona% corru"tion of t)e database because it 0isits e0ery database "age and, in writing of 2mended3"ages, it can %ay down more wrong bits.
&irebird and InterBase databases corru"tions reasons t)e ser0er tries to re9uest more "age to e/tend t)e database fi%e and disco0ers t)at t)ere is no s"ace a0ai%ab%e on t)e dis6 or "artition. *)e most dangerous situation occurs w)en %ac6 of dis6 s"ace is combined wit) a %arge cac)e and forced writes off. *)e o"erating system tries to f%us) a %arge amount of data to dis6 and sim"%y fai%s if t)ere is not enoug) room. In t)is case t)e database wi%% be inconsistent, because %oss of t)e cac)e means t)at a%% c)anges in "age and record c)ains were interru"ted. :)en you try to re"air corru"tion caused by %ac6 of dis6 s"ace wit) &IH you may find interesting side effect: t)e interbase.%og wi%% be fi%%ed wit) a %oo"ing se9uence of 2"age doub%y a%%ocated3 errors. fi/ wi%% ne0er finis), t)e interbase.%og can grow 0ery %arge and dis6 s"ace can be e/)austed again.
' IBSurgeon
' IBSurgeon
&irebird and InterBase databases corru"tions reasons Database page size ?024 byte 2048 byte 40DP byte 8?D2 byte Critical number of transactions ?@? JDP 28F 2PJ 8?4 0?P J@4 24D 4F2 ? 0F? ?20 @84
Corruptions caused by SQL Creating and dropping tables during intensive users' wor#
:e%%, it-s t)e to" one from t)e most often ways to corru"t database. Breating and dro""ing tab%es w)i%e users are writing somet)ing into database can %ead to confusion between system "ages .used by created=dro""ed tab%es1 and user data. +sua%%y suc) corru"tions %eads to moderate %oss of data and can be reco0ered using manua% IBSurgeon ser0ice.
' IBSurgeon
More information:
&BData uard ! "rotecting your &irebird data $mergency too%set for &irebird and InterBase
' IBSurgeon