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
This entry was posted in PostgreSQL on by .
Unknown's avatar

About SandeepSingh

Hi, I am working in IT industry with having more than 15 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

Leave a Reply