# Postgres: Backup and Restore 

By [Suyi](https://paragraph.com/@suyi-cn) · 2023-02-26

---

> backup and restore with postgres

    # dump to sql
    $ pg_dump -h localhost -d postgres --username postgres -t '"Orders"" > public_orders.sql
    
    # restore from sql
    $ psql -h localhost -U postgres -d postgres < public_orders.sql
    
    $ pg_restore -U postgres -d postgres -1 public_orders.sql

---

*Originally published on [Suyi](https://paragraph.com/@suyi-cn/postgres-backup-and-restore)*
