RefLib

Reference library for AI

Back

postgresql_16:7.2.12.5 Examples

PostgreSQL 16 > Reference > PostgreSQL Client Applications > pg_dumpall > Examples

To dump all databases: $ pg_dumpall > db.out

To restore database(s) from this file, you can use: $ psql -X -f db.out -d postgres It is not important which database you connect to here since the script file created by pg_dumpall will contain the appropriate commands to create and connect to the saved databases. An exception is that if you specified --clean, you must connect to the postgres database initially; the script will attempt to drop other databases immediately, and that will fail for the database you are connected to.

Back