How can I perform a dump and restore of a PostgreSQL database?

2023-06-20

Docshowtosnippetops

#Dump

Use pg_dump to dump the database

$ pg_dump -U username -d database_name -f dump_file.sql

#Restore

psql -U username -d database_name -f dump_file.sql