Postgresql backup and restore

In this quick tip post, I'll describe how to quickly backup and restore pg databases. Ok here are the commands: Backup:
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.
Max one mail per week.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.