> ## Content Index
> Fetch the complete content index at: https://suigeneriscode.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Postgres backup and restore a database
- URL: https://suigeneriscode.com/postgres-backup-restore/
- Published: 2020-06-12T16:24:05.000Z
- Updated: 2020-06-12T16:28:00.000Z
- Author: Jose Vasquez
- Tags: Postgres, #Import 2026-11-27 21:50

![](https://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

```sql
-- Backup
pg_dump -U {user} {database_name} -f {dumpfilename.sql} -h {host}
-- Restore
psql -U {user} -d {database_name} -h {host} -f {dumpfilename.sql}
```