Backup and Restore Single Table in PostgreSQL

Backup and restore single table in PostgreSQL

Back up a single table from the specific database

pg_dump -d [sourcedatabase] -t [tablename]-f [dbtablebackup.sql]

pg_dump -U postgres -d testdb -t test -f C:\testwork\tablebackup.sql

Restore a single table in the database:

psql -d testdb -f C:\testwork\tablebackup.sql

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.