pg_dump -x -O url > file_to_be_saved.sql
Restore:
psql database_name < file_to_be_saved.sql
And that's it, have a great day!
Oh wait, what is this
-x
and -O
parameters at pg_dump
? These are the two most common parameters I have used to get a clean backup for queries, without having privileges and owners. They are very helpful if you plan to move the database into another db, let's say locally.
Some more information for the parameters:
Postgresql pg_dump and parameters
Hope you found it useful. Send me an email with what you use for moving pg databases.