Dumping and Restoring in Postgresql

From Foochal

Jump to: navigation, search


Dumping

The following command spits out a sql file.

pg_dump -h localhost -U myuser -d -t mytable mydb > mydb.sql

Restoring

The following command restores from sql file

psql -h localhost -U myuser -f mydb.sql

Personal tools