Backup and Restore all Databases in PostgreSQL

Backup and Restore all databases in PostgreSQL

Back up all databases in PostgreSQL using pg_dumpall utility.

pg_dumpall -f [alldatabasebackup.sql]

Example:
C:\Program Files\PostgreSQL\15\bin>pg_dumpall -U postgres -f C:\testwork\alldatabase.sql
Password:
Password:
Password:
Password:
Password:

C:\Program Files\PostgreSQL\15\bin>

Restore the database in PostgreSQL using psql utility:

psql -f alldatabasebackup.sql
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.