PostgreSQL: Documentation: 12: pg_dump
www.postgresql.org › docs › 12To dump a database called mydb into a SQL-script file: $ pg_dump mydb > db.sql. To reload such a script into a (freshly created) database named newdb: $ psql -d newdb -f db.sql. To dump a database into a custom-format archive file: $ pg_dump -Fc mydb > db.dump. To dump a database into a directory-format archive: $ pg_dump -Fd mydb -f dumpdir