Postgres backup and restore a database
![Postgres backup and restore a database](/content/images/2020/06/Webp.net-resizeimage--1--1.png)
![](http://suigeneriscode.com/content/images/2020/06/Webp.net-resizeimage--1-.png)
In some cases is useful to load production data on development environments to check some data bugs, then you need create backups and import on others machine ( or database ) to be used
You can achieve with two simple commands
-- Backup
pg_dump -U {user} {database_name} -f {dumpfilename.sql} -h {host}
-- Restore
psql -U {user} -d {database_name} -h {host} -f {dumpfilename.sql}