The gbak utility analyzes and decomposes Firebird database files, storing cleaned metadata and data separately, in a compact format. A backup made with gbak is not a database file and will not be recognized by the server. In order to become useable, it must be restored to a Firebird format that is readable by the server, using the version of gbak that corresponds to the version of Firebird server that is running.
When restoring its files back to database format, gbak performs validation of both metadata and data before using query-language commands internally to reconstruct the database and repopulate it with its data.
If corrupt structures or data are detected, gbak stops restoring and reports the condition. Its ability to analyze problems makes it an invaluable helper when recovery of broken databases is being attempted.
gbak’s Other Talents
gbak also performs an important sequence of other utility tasks in the course of analyzing, storing, and restoring your database. Some are automatic; others can be requested by means of switches in the command-line call when you invoke the program.
Restore tasks can include
Backup and restore also have important roles to play in the unfortunate event that databases become corrupt.
Upgrading the On-Disk Structure
New major releases of the Firebird server are likely to feature changes that alter the on-disk structure (ODS). If the ODS has changed and you want to take advantage of any new Firebird features, upgrade your databases to the new ODS. A new server version can access databases created with some previous versions, but it will not be able to share any of its new features with an older database with a lower ODS.
You can use most Firebird 1.0.x databases directly with Firebird 1.5, even though the ODS of v.1.5 (10.1) is a point higher than that of v.1.0.x (10.0). All the same, it isrecommended that you do follow the upgrade procedure on your databases when you do the transition from 10.0 to 10.1, to take advantage of the performance increase made possible by the v.1.5 indexing of system tables.
To upgrade existing databases to a new ODS, perform the following steps:
Dialect 1 Databases
A dialect 1 database remains dialect 1 when it is restored. The database remains limited to the language features of InterBase 5, although some restrictions apply to a dialect 1 database under the new ODS that do not apply to InterBase 5. For example, Firebird has a number of new reserved words that will be “illegal” in a dialect 1 database.
To diverge from the topic slightly, it is possible to change the dialect of a restored dialect 1 database to dialect 3, using the gfix tools discussed in the next chapter. However, migration is not as simple as that. Language is not the only thing about the two dialects that has differences. Data type differences are at least as important, if not more so.
For example, fixed numeric domains and columns retain their old attributes when the database is changed to dialect 3. NUMERIC and DECIMAL types with precision higher than 10 are stored as DOUBLE PRECISION in dialect 1. Conversion to true, 64-bit fixed numeric types is not done when you change the dialect to 3—you must create new columns of the required type and cast the old values into the new columns.
Firebird inherited some features to assist with migrating from dialect 1 to Firebird’s native SQL dialect (known as dialect 3). It’s widely acknowledged that there are much easier and safer ways to do this migration. Best results are achieved by extracting a metadata script, updating it, if necessary, and reconstituting an “empty” dialect 3 database. Excellent free and low-cost data-pumping tools are widely available for repopulating your new database with your old data.
Database Backup and Restore Rights
Use of gbak is restricted to SYSDBA and the owner of the database named in the backup or restore request.
Changing Ownership of a Database
A restored database file, or one created from a gbak file, is owned by the user that performed the restore. Backing up and restoring a database is thus a mechanism for changing the ownership of a database.
User Name and Password
When Firebird checks authority to run gbak, it determines the user according to the following hierarchy:
Firebird Related Interview Questions
|RDBMS Interview Questions||MySQL Interview Questions|
|Linux Interview Questions||Mac OS X Deployment Interview Questions|
|Windows Administration Interview Questions||Windows Server 2003 Interview Questions|
|SQL Interview Questions||NoSQL Interview Questions|
|Advanced C++ Interview Questions|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.