What exporting a schema means and why you'd do it

Exporting a schema from DBeaver means saving the structure of your database — the tables, columns, data types, and relationships — as a file you can keep, share, or use to rebuild the database elsewhere. You are not exporting the actual data inside those tables, just the blueprint.

People do this for several reasons: to back up the structure before making changes, to move a database to a different server, to share the design with a colleague, or to version-control how your database is organized. DBeaver is a database management tool that works with many different database systems — PostgreSQL, MySQL, Oracle, SQL Server, and others — so the steps vary slightly depending on which one you are using.

Key Takeaways

  • Right-click the database or schema name in DBeaver's left panel, then choose "Generate SQL" or "Export" to create a text file of the structure.
  • The exported file is plain SQL code that shows every table, column, and constraint — you can read it in any text editor or run it to recreate the database.
  • Different database systems (MySQL, PostgreSQL, Oracle) produce slightly different SQL syntax, so the exported file works best with the same database type it came from.
  • You can also export individual tables instead of the whole schema by right-clicking a single table and choosing the same export option.

How to export an entire schema in DBeaver

Open DBeaver and connect to the database you want to export. In the left panel under "Database Navigator," find the database or schema name. Right-click it directly.

A menu will appear. Look for an option called "Generate SQL" or "Export" — the exact wording depends on your DBeaver version and which database system you are connected to. Click it. DBeaver will open a dialog box asking where you want to save the file and what to include. Choose a location on your computer, give the file a name (something like my_database_schema.sql), and click "Save" or "Export."

DBeaver will generate a text file full of SQL code. This code contains all the CREATE TABLE statements, column definitions, indexes, and constraints that make up your database structure. You can open this file in any text editor — Notepad, VS Code, or any other — to read it or edit it.

What the exported file actually contains

The exported SQL file is a set of instructions that, if you run them against a blank database, will recreate the exact structure you exported. It includes the names of every table, the name and data type of every column, any rules about what values are allowed (constraints), and relationships between tables (foreign keys).

It does not include the data — the actual rows and values stored in those tables. If you need both the structure and the data, you will need to export the data separately, which is a different process.

The SQL syntax in the file is specific to the database system you exported from. A schema exported from a PostgreSQL database will use PostgreSQL syntax, which may not run without changes on a MySQL database. If you are moving the schema to a different database system, you may need to edit the file or use a conversion tool.

Exporting a single table instead of the whole schema

If you only need the structure of one table, you do not have to export the entire schema. In the left panel, expand the schema name to see the list of tables inside it. Right-click the specific table you want to export.

Choose "Generate SQL" or "Export" from the menu. DBeaver will create a file containing only the CREATE TABLE statement for that table, plus any indexes or constraints tied to it. This is useful when you are sharing a single table design with someone else or testing changes to one table without touching the rest of the database.

Choosing what to include in the export

When you click "Generate SQL," DBeaver often opens a dialog with checkboxes for what to include. You might see options like "Create table," "Create indexes," "Create constraints," or "Create triggers." Check the boxes for the parts of the structure you want in the exported file.

For most purposes, you want everything checked — tables, indexes, constraints, and any triggers or stored procedures that are part of the schema. If you are only interested in the basic table structure and do not care about performance indexes, you can uncheck "Create indexes" to keep the file simpler.

Some versions of DBeaver also ask whether to include comments or metadata. These are optional and do not affect whether the schema will work; they just make the file more readable for humans.

Saving and using the exported file

Once you have saved the .sql file, you can store it anywhere — on your computer, in cloud storage, or in a version-control system like Git. The file is plain text, so it takes up very little space and can be read by anyone with a text editor.

To use the exported schema to recreate the database, open a new connection to a blank database in DBeaver (or any other database tool), then open the .sql file and run it. The database system will execute all the CREATE TABLE statements and build the exact structure you exported. This is how people move databases between servers or restore a database structure after a mistake.

You can also edit the .sql file before running it — for example, to change table names, add new columns, or remove tables you do not need. Since it is just text, any changes you make will be reflected when you run the file.

Frequently Asked Questions

Does exporting the schema also export the data in the tables?

No. The schema export contains only the structure — table names, columns, and data types. To export the actual data, you need to use DBeaver's "Export Data" feature instead, which is a separate process. Some people export both the schema and the data to move a complete database.

Can I export a schema from one database type and use it in another, like PostgreSQL to MySQL?

The exported file will be SQL code written in the syntax of the original database. You can try to run it on a different database type, but you may get errors because the syntax differs. You would need to edit the file to change things like data type names or constraint syntax to match the new database system.

What if the export option does not appear when I right-click?

Make sure you are right-clicking the database or schema name itself, not a table inside it. Also check that you have a working connection to the database — if the connection is closed or failed, the export option may not show. If you are still stuck, try right-clicking a table instead and exporting just that one to test whether the feature is working.

Can I edit the exported SQL file and then run it to change my database?

Yes. The exported file is plain SQL code that you can edit in any text editor. You can add new tables, remove old ones, change column names, or modify constraints. When you run the edited file against a database, it will execute all the statements in the file. Be careful with edits — a mistake in SQL syntax can cause the whole file to fail.

Where should I save the exported schema file?

Save it anywhere that makes sense for your workflow — your Documents folder, a project folder, or a Git repository if you are version-controlling your database design. Many people name the file something descriptive like production_schema_2024.sql or user_database_backup.sql so they remember what it contains and when it was made.