HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How to export database structure from Firebird?

Submitted by: @import:stackexchange-dba··
0
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:

gbak -backup -meta_data employee employee.meta.fbk


And then restore that backup.

-
A metadata-only restore using gbak:

gbak -create employee.fbk mytest.fdb -meta_data


This 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.fdb


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.

Code Snippets

gbak -backup -meta_data employee employee.meta.fbk
gbak -create employee.fbk mytest.fdb -meta_data
isql -ex -o ddldump.sql /path/to/your/database.fdb

Context

StackExchange Database Administrators Q#168064, answer score: 4

Revisions (0)

No revisions yet.