SlideShare a Scribd company logo
Firebird database recovery: tools and 
techniques 
Alexey Kovyazin 
IBSurgeon 
www.ib-aid.com 
www.ibsurgeon.com 
www.ibase.ru 
Firebird Conference 2014 (c) IBSurgeon, 2014 1
Thanks to sponsors! 
Firebird Conference 2014 (c) IBSurgeon, 2014 2
About IBSurgeon 
● Firebird and 
InterBase recovery 
and optimization: 
tools and services 
● Platinum sponsor of 
Firebird Foundation 
● Since 2002 
● Moscow, Russia 
Firebird Conference 2014 (c) IBSurgeon, 2014 3
Typical corruption «environment» 
● No backups 
● No administrator 
● Unreliable hardware or wrong configuration of 
hardware 
● Big database and 24/7 workmode – can’t do 
backup/restore 
● Corruption never happened before or no 
responsible persons 
Firebird Conference 2014 (c) IBSurgeon, 2014 4
Behind the corruption 
● Hardware failure 
● Administrators/developers failures 
● Server bugs 
● Mr. Murhy and his laws:) 
Firebird Conference 2014 (c) IBSurgeon, 2014 5
Corruption from user's point of view 
● Unavailable database — i.e., cannot connect 
there, with various errors 
● Errors while trying 
SELECT/UPDATE/INSERT/DELETE 
● Low performance 
● «Something is wrong» 
Firebird Conference 2014 (c) IBSurgeon, 2014 6
Corruption from the server point of 
view 
● Cannot build internal database image 
– System data lost? 
– Transactions pages lost? 
● Cannot read some records 
– Record is corrupted? 
● Indices corruption 
Firebird Conference 2014 (c) IBSurgeon, 2014 7
Symptoms of corruptions 
Corruptions appear at: 
1.Users screen (“internal Firebird software consistency 
check” error message) 
2.In firebird.log 
Firebird Conference 2014 (c) IBSurgeon, 2014 8
Heavy and Easy corruptions 
•Easy corruptions 
• Users data are corrupted (partially) 
• User’s indices corrupted 
•Heavy corruptions 
• System data are damaged (We can’t read users data!) 
Firebird Conference 2014 (c) IBSurgeon, 2014 9
Examples 
● Cannot find TIP page 
– Lost TIP pages 
– Wrong transaction number in record header 
● What we can do 
– Recreate TIP 
– Delete records 
Firebird Conference 2014 (c) IBSurgeon, 2014 10
Wrong record length 
● Record length does not correspond to declared 
size 
– Must be deleted 
Firebird Conference 2014 (c) IBSurgeon, 2014 11
Attempted to read more segments.. 
● BLOB corruption — loss of BLOB parts 
● What we can do? 
– Export as is 
– Delete corrupted BLOB 
Firebird Conference 2014 (c) IBSurgeon, 2014 12
Cannot find record fragment 
● Fragment of record disappeared 
– Usually on another data page 
● We can only delete remained part 
Firebird Conference 2014 (c) IBSurgeon, 2014 13
Nbackup delta won't merge 
● Database delta won't merge 
● What we can do 
– Delete delta (it hurts!) 
– Manual merge with special tools 
– Export data 
Firebird Conference 2014 (c) IBSurgeon, 2014 14
Fixing 
Firebird Conference 2014 (c) IBSurgeon, 2014 15
Standard means 
•Stop Firebird server. 
•Make a copy of Firebird database. 
•Start Firebird server and run the following commands: 
gfix.exe -v -full 
gfix.exe -mend –ig 
gbak -b –g -v 
•If backup completed successfully, restore database: gbak -c -v 
-user SYSDBA -pass masterkey path_to_backup 
path_to_database 
Firebird Conference 2014 (c) IBSurgeon, 2014 16
Not very well known, but still 
standard means 
1.Run them all, even if gfix shows errors. 
2.Always use switch –ig for gbak to ignore checksum errors 
3.Always use switch –g for gbak to suppress garbage collection 
(and to workaround index errors) 
4.Use –v switch to have detailed output 
5. Set database to read_only with gfix -mode read_only 
Firebird Conference 2014 (c) IBSurgeon, 2014 17
Restore errors 
•After fixing corruptions it's a often to see "Cannot 
commit index" error at restore step. 
•In Firebird 2.0 and later this comes as a warning and database will be not 
brought on-line 
How to workaround 
● IBDataPump 
– Bug with circular links 
● FirstAID Extractor 
Firebird Conference 2014 (c) IBSurgeon, 2014 18
Effectiveness 
Gbak+Gfix can recover almost all easy corruptions 
What they cannot fix: 
● Heavy corruptions with a lot of losses 
● System data corruptions 
Firebird Conference 2014 (c) IBSurgeon, 2014 19
IBSurgeon Tools 
Firebird Conference 2014 (c) IBSurgeon, 2014 20
IBSurgeon Tools for Recovery and 
data protection 
● FirstAID 
– Direct 
– Extractor 
● FBDataGuard 
– Protection 
– Backups 
Firebird Conference 2014 (c) IBSurgeon, 2014 21
IBSurgeon FirstAID: Direct 
● Scan internal structure and finds inconsistencies 
● Replace/restore lost system pages where it is 
possible 
● Delete wrong pages and dead records 
● Fast! 
● Effective for user's data corruptions 
Firebird Conference 2014 (c) IBSurgeon, 2014 22
IBSurgeon FirstAID: Extractor 
● Reads metadata from database and read records 
bypassing server 
– Free preview of records is available 
● Export all good records to the new database 
● Resolve dependencies 
– Foreign Keys, Triggers, UDFs 
● Speed is 1Gb/hour 
● Very effective 
Firebird Conference 2014 (c) IBSurgeon, 2014 23
External metadata 
● Extractor can borrow metadata from good 
healthy database with the same structure and 
export data from corrupted one, even if all 
system data lost 
● 
Firebird Conference 2014 (c) IBSurgeon, 2014 24
Metadata repository 
Firebird Conference 2014 (c) IBSurgeon, 2014 25
Increased recovery rate 
● Metadata repository increase recovery rate up 
to 99% 
● FBDataGuard is a tool to create metadata 
repository 
Firebird Conference 2014 (c) IBSurgeon, 2014 26
Better prevent when fix! 
● FBDataGuard vs FirstAID? 
● Easy licensing options 
● Special offer for attendees of Firebird 
Conference 2014 
Firebird Conference 2014 (c) IBSurgeon, 2014 27
Thank you! 
● Www.ib-aid.com 
● Www.ibsurgeon.com 
● support@ib-aid.com 
Firebird Conference 2014 (c) IBSurgeon, 2014 28

More Related Content

PDF
Life with big Firebird databases
PPTX
Firebird migration: from Firebird 1.5 to Firebird 2.5
PDF
Professional tools for Firebird optimization and maintenance from IBSurgeon
PDF
Firebird migration: from Firebird 1.5 to Firebird 2.5
PPTX
Resolving Firebird performance problems
PDF
45 ways to speed up firebird database
PPTX
Firebird's Big Databases (in English)
PDF
Working with Large Firebird databases
Life with big Firebird databases
Firebird migration: from Firebird 1.5 to Firebird 2.5
Professional tools for Firebird optimization and maintenance from IBSurgeon
Firebird migration: from Firebird 1.5 to Firebird 2.5
Resolving Firebird performance problems
45 ways to speed up firebird database
Firebird's Big Databases (in English)
Working with Large Firebird databases

What's hot (20)

PDF
Initial review of Firebird 3
PPTX
Migration from Firebird 1.5 to Firebird 2.5
PPTX
Fail-Safe Cluster for FirebirdSQL and something more
PPTX
Firebird Anti-Corruption Approach
PDF
Firebird.performance.testing
ODP
Understanding the lock manager internals with the fb lock print utility
PDF
Technical Modifications to Compress Period End Close - R12.1.3
PDF
Postgres Vision 2018: WAL: Everything You Want to Know
 
PDF
Firebird 3.x guida alla migrazione
PDF
Introduction to firebidSQL 3.x
PDF
Understanding and controlling transaction logs
PDF
Presentation maximizing database performance performance tuning with db time
PDF
Best Practices: Migrating a Postgres Production Database to the Cloud
 
PPTX
Open Policy Agent for governance as a code
PDF
PGConf APAC 2018 - Monitoring PostgreSQL at Scale
PPTX
PostgreSQL Hangout Replication Features v9.4
PDF
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
PDF
How to Upgrade Major Version of Your Production PostgreSQL
PDF
Presentation oracle net services
PDF
Major features postgres 11
 
Initial review of Firebird 3
Migration from Firebird 1.5 to Firebird 2.5
Fail-Safe Cluster for FirebirdSQL and something more
Firebird Anti-Corruption Approach
Firebird.performance.testing
Understanding the lock manager internals with the fb lock print utility
Technical Modifications to Compress Period End Close - R12.1.3
Postgres Vision 2018: WAL: Everything You Want to Know
 
Firebird 3.x guida alla migrazione
Introduction to firebidSQL 3.x
Understanding and controlling transaction logs
Presentation maximizing database performance performance tuning with db time
Best Practices: Migrating a Postgres Production Database to the Cloud
 
Open Policy Agent for governance as a code
PGConf APAC 2018 - Monitoring PostgreSQL at Scale
PostgreSQL Hangout Replication Features v9.4
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
How to Upgrade Major Version of Your Production PostgreSQL
Presentation oracle net services
Major features postgres 11
 
Ad

Similar to Firebird recovery tools and techniques by IBSurgeon (6)

PPTX
Firebird database recovery and protection for enterprises and ISV
ODP
How Firebird transactions work
PDF
Firebird 3.0 statistics and plans
PPTX
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
PPTX
Superchaging big production systems on Firebird: transactions, garbage, maint...
PPTX
Orphans, Corruption, Careful Write, and Logging
Firebird database recovery and protection for enterprises and ISV
How Firebird transactions work
Firebird 3.0 statistics and plans
Nbackup and Backup: Internals, Usage strategy and Pitfalls, by Dmitry Kuzmenk...
Superchaging big production systems on Firebird: transactions, garbage, maint...
Orphans, Corruption, Careful Write, and Logging
Ad

More from Alexey Kovyazin (20)

PPTX
High-load performance testing: Firebird 2.5, 3.0, 4.0
PPTX
Новые возможности языка SQL в Firebird 3.0
ODP
How Firebird transactions work
PDF
Firebird Dataguard (Russian)
PPT
Решения на базе СУБД Firebird в крупных компаниях и государственных учреждени...
PDF
Firebird DataGuard - Еще раз об уверенности в завтрашнем дне
PDF
Firebird usage promo draft
PPTX
FBScanner: IBSurgeon's tool to solve all types of performance problems with F...
ODP
Firebird 2.5 - вектор дальнейшего развития, Dmitry Yemanov, (in Russian)
ODP
Understandung Firebird optimizer, by Dmitry Yemanov (in English)
PPTX
Firebird: cost-based optimization and statistics, by Dmitry Yemanov (in English)
ODP
СУБД Firebird: Краткий обзор, Дмитрий Еманов (in Russian)
ODP
Open Source: взгляд изнутри, Дмитрий Еманов (The Firebird Project) (in Russian)
PPT
Firebird Scalability, by Dmitry Yemanov (in English)
ODP
Firebird 2.1 What's New by Vladislav Khorsun (English)
ODP
Firebird: Универсальная СУБД. Краткая презентация на Интероп 2008, Дмитрий Ем...
PPT
Firebird Roadmap-2006 Текущее состояние разработки и перспективы развития (in...
ODP
Firebird в 2008: новые возможности и планы по дальнейшему развитию, by Дмитри...
PPT
Firebird в 2008 году: эволюция или революция? (in Russian, by Dmitry Kuzmenko)
PPT
Новые возможности Firebird 2.1 (in Russian, Vlad Khorsun)
High-load performance testing: Firebird 2.5, 3.0, 4.0
Новые возможности языка SQL в Firebird 3.0
How Firebird transactions work
Firebird Dataguard (Russian)
Решения на базе СУБД Firebird в крупных компаниях и государственных учреждени...
Firebird DataGuard - Еще раз об уверенности в завтрашнем дне
Firebird usage promo draft
FBScanner: IBSurgeon's tool to solve all types of performance problems with F...
Firebird 2.5 - вектор дальнейшего развития, Dmitry Yemanov, (in Russian)
Understandung Firebird optimizer, by Dmitry Yemanov (in English)
Firebird: cost-based optimization and statistics, by Dmitry Yemanov (in English)
СУБД Firebird: Краткий обзор, Дмитрий Еманов (in Russian)
Open Source: взгляд изнутри, Дмитрий Еманов (The Firebird Project) (in Russian)
Firebird Scalability, by Dmitry Yemanov (in English)
Firebird 2.1 What's New by Vladislav Khorsun (English)
Firebird: Универсальная СУБД. Краткая презентация на Интероп 2008, Дмитрий Ем...
Firebird Roadmap-2006 Текущее состояние разработки и перспективы развития (in...
Firebird в 2008: новые возможности и планы по дальнейшему развитию, by Дмитри...
Firebird в 2008 году: эволюция или революция? (in Russian, by Dmitry Kuzmenko)
Новые возможности Firebird 2.1 (in Russian, Vlad Khorsun)

Recently uploaded (20)

PPTX
L1 - Introduction to python Backend.pptx
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Digital Strategies for Manufacturing Companies
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
assetexplorer- product-overview - presentation
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
System and Network Administraation Chapter 3
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PPTX
ai tools demonstartion for schools and inter college
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
Designing Intelligence for the Shop Floor.pdf
L1 - Introduction to python Backend.pptx
Softaken Excel to vCard Converter Software.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
How to Choose the Right IT Partner for Your Business in Malaysia
Computer Software and OS of computer science of grade 11.pptx
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Design an Analysis of Algorithms I-SECS-1021-03
Digital Strategies for Manufacturing Companies
CHAPTER 2 - PM Management and IT Context
assetexplorer- product-overview - presentation
Wondershare Filmora 15 Crack With Activation Key [2025
System and Network Administraation Chapter 3
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
ai tools demonstartion for schools and inter college
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Navsoft: AI-Powered Business Solutions & Custom Software Development
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Designing Intelligence for the Shop Floor.pdf

Firebird recovery tools and techniques by IBSurgeon

  • 1. Firebird database recovery: tools and techniques Alexey Kovyazin IBSurgeon www.ib-aid.com www.ibsurgeon.com www.ibase.ru Firebird Conference 2014 (c) IBSurgeon, 2014 1
  • 2. Thanks to sponsors! Firebird Conference 2014 (c) IBSurgeon, 2014 2
  • 3. About IBSurgeon ● Firebird and InterBase recovery and optimization: tools and services ● Platinum sponsor of Firebird Foundation ● Since 2002 ● Moscow, Russia Firebird Conference 2014 (c) IBSurgeon, 2014 3
  • 4. Typical corruption «environment» ● No backups ● No administrator ● Unreliable hardware or wrong configuration of hardware ● Big database and 24/7 workmode – can’t do backup/restore ● Corruption never happened before or no responsible persons Firebird Conference 2014 (c) IBSurgeon, 2014 4
  • 5. Behind the corruption ● Hardware failure ● Administrators/developers failures ● Server bugs ● Mr. Murhy and his laws:) Firebird Conference 2014 (c) IBSurgeon, 2014 5
  • 6. Corruption from user's point of view ● Unavailable database — i.e., cannot connect there, with various errors ● Errors while trying SELECT/UPDATE/INSERT/DELETE ● Low performance ● «Something is wrong» Firebird Conference 2014 (c) IBSurgeon, 2014 6
  • 7. Corruption from the server point of view ● Cannot build internal database image – System data lost? – Transactions pages lost? ● Cannot read some records – Record is corrupted? ● Indices corruption Firebird Conference 2014 (c) IBSurgeon, 2014 7
  • 8. Symptoms of corruptions Corruptions appear at: 1.Users screen (“internal Firebird software consistency check” error message) 2.In firebird.log Firebird Conference 2014 (c) IBSurgeon, 2014 8
  • 9. Heavy and Easy corruptions •Easy corruptions • Users data are corrupted (partially) • User’s indices corrupted •Heavy corruptions • System data are damaged (We can’t read users data!) Firebird Conference 2014 (c) IBSurgeon, 2014 9
  • 10. Examples ● Cannot find TIP page – Lost TIP pages – Wrong transaction number in record header ● What we can do – Recreate TIP – Delete records Firebird Conference 2014 (c) IBSurgeon, 2014 10
  • 11. Wrong record length ● Record length does not correspond to declared size – Must be deleted Firebird Conference 2014 (c) IBSurgeon, 2014 11
  • 12. Attempted to read more segments.. ● BLOB corruption — loss of BLOB parts ● What we can do? – Export as is – Delete corrupted BLOB Firebird Conference 2014 (c) IBSurgeon, 2014 12
  • 13. Cannot find record fragment ● Fragment of record disappeared – Usually on another data page ● We can only delete remained part Firebird Conference 2014 (c) IBSurgeon, 2014 13
  • 14. Nbackup delta won't merge ● Database delta won't merge ● What we can do – Delete delta (it hurts!) – Manual merge with special tools – Export data Firebird Conference 2014 (c) IBSurgeon, 2014 14
  • 15. Fixing Firebird Conference 2014 (c) IBSurgeon, 2014 15
  • 16. Standard means •Stop Firebird server. •Make a copy of Firebird database. •Start Firebird server and run the following commands: gfix.exe -v -full gfix.exe -mend –ig gbak -b –g -v •If backup completed successfully, restore database: gbak -c -v -user SYSDBA -pass masterkey path_to_backup path_to_database Firebird Conference 2014 (c) IBSurgeon, 2014 16
  • 17. Not very well known, but still standard means 1.Run them all, even if gfix shows errors. 2.Always use switch –ig for gbak to ignore checksum errors 3.Always use switch –g for gbak to suppress garbage collection (and to workaround index errors) 4.Use –v switch to have detailed output 5. Set database to read_only with gfix -mode read_only Firebird Conference 2014 (c) IBSurgeon, 2014 17
  • 18. Restore errors •After fixing corruptions it's a often to see "Cannot commit index" error at restore step. •In Firebird 2.0 and later this comes as a warning and database will be not brought on-line How to workaround ● IBDataPump – Bug with circular links ● FirstAID Extractor Firebird Conference 2014 (c) IBSurgeon, 2014 18
  • 19. Effectiveness Gbak+Gfix can recover almost all easy corruptions What they cannot fix: ● Heavy corruptions with a lot of losses ● System data corruptions Firebird Conference 2014 (c) IBSurgeon, 2014 19
  • 20. IBSurgeon Tools Firebird Conference 2014 (c) IBSurgeon, 2014 20
  • 21. IBSurgeon Tools for Recovery and data protection ● FirstAID – Direct – Extractor ● FBDataGuard – Protection – Backups Firebird Conference 2014 (c) IBSurgeon, 2014 21
  • 22. IBSurgeon FirstAID: Direct ● Scan internal structure and finds inconsistencies ● Replace/restore lost system pages where it is possible ● Delete wrong pages and dead records ● Fast! ● Effective for user's data corruptions Firebird Conference 2014 (c) IBSurgeon, 2014 22
  • 23. IBSurgeon FirstAID: Extractor ● Reads metadata from database and read records bypassing server – Free preview of records is available ● Export all good records to the new database ● Resolve dependencies – Foreign Keys, Triggers, UDFs ● Speed is 1Gb/hour ● Very effective Firebird Conference 2014 (c) IBSurgeon, 2014 23
  • 24. External metadata ● Extractor can borrow metadata from good healthy database with the same structure and export data from corrupted one, even if all system data lost ● Firebird Conference 2014 (c) IBSurgeon, 2014 24
  • 25. Metadata repository Firebird Conference 2014 (c) IBSurgeon, 2014 25
  • 26. Increased recovery rate ● Metadata repository increase recovery rate up to 99% ● FBDataGuard is a tool to create metadata repository Firebird Conference 2014 (c) IBSurgeon, 2014 26
  • 27. Better prevent when fix! ● FBDataGuard vs FirstAID? ● Easy licensing options ● Special offer for attendees of Firebird Conference 2014 Firebird Conference 2014 (c) IBSurgeon, 2014 27
  • 28. Thank you! ● Www.ib-aid.com ● Www.ibsurgeon.com ● support@ib-aid.com Firebird Conference 2014 (c) IBSurgeon, 2014 28