snippetMinor
How to export database structure from Firebird?
Viewed 0 times
databasestructureexporthowfromfirebird
Problem
I'm doing replication and I need to export db structure from one Firebird db (dialect 3) into another. I've seen a couple tools like IBPump and FBExport, however all I can find is how to export all the data and not the structure. Any advice?
Solution
There are several ways to do this:
-
A metadata-only backup using gbak:
And then restore that backup.
-
A metadata-only restore using gbak:
This can be useful if you already have a backup with data.
-
Exporting the DDL of a database with ISQL (or another tool)
And then use that script to populate a new database.
For options 1 & 2 see gbak: Backup & Restore Recipes: Meta Data Only
For option 3 see ISQL: Command Line Switches.
-
A metadata-only backup using gbak:
gbak -backup -meta_data employee employee.meta.fbkAnd then restore that backup.
-
A metadata-only restore using gbak:
gbak -create employee.fbk mytest.fdb -meta_dataThis can be useful if you already have a backup with data.
-
Exporting the DDL of a database with ISQL (or another tool)
isql -ex -o ddldump.sql /path/to/your/database.fdbAnd then use that script to populate a new database.
For options 1 & 2 see gbak: Backup & Restore Recipes: Meta Data Only
For option 3 see ISQL: Command Line Switches.
Code Snippets
gbak -backup -meta_data employee employee.meta.fbkgbak -create employee.fbk mytest.fdb -meta_dataisql -ex -o ddldump.sql /path/to/your/database.fdbContext
StackExchange Database Administrators Q#168064, answer score: 4
Revisions (0)
No revisions yet.