Home  >  Q&A  >  body text

Backup of PostgreSQL database design - no data

<p>I'm trying to find a way to back up my database design without including the data stored in the database. In fact, one might say I want a file containing all "CREATE Scripts" in the database. Ideally, this file can be used to recreate the database (without the data of course). </p> <p>How to avoid data in database backup? </p> <p>I'm using pgAdmin 4.1.3 and PostgreSQL 9.6. </p>
P粉098417223P粉098417223421 days ago586

reply all(1)I'll reply

  • P粉242741921

    P粉2427419212023-08-25 00:43:28

    You can use it from psql (terminal):

    pg_dump -s databasename > file.dump

    According to the pg_dump documentation, "-s" only dumps the object definition (schema), not the data.

    pg_dump documentation

    reply
    0
  • Cancelreply