Since I can never remember … . Using
pg_restore, tested with AWS RDS.
pg_dump can create SQL dumps, which can be read from
# save database; "user" can be admin user (tested) or db_user (untested) pg_dump -p my-db.host -U user -d db > my_backup.sql # restore database; maybe you can also use the admin user here (untested) psql -p my-db.host -U db_user -d db < my_backup.sql
Second option, let’s now create a
pg_dump “custom” dump file, and restore that with
# save the db ... (add "-v" for more verbosity) pg_dump -p my-db.host -U user -d db -Fc -b -f my_dump_file.pg_dump # and restore it. (add "-v" for more verbosity) pg_restore -p my-db.host -U db_user -d db -1 my_dump_file.pg_dump